From 0e08f1de8d6a7ec2e59078fb149e07a7d26e85e8 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Sun, 7 Nov 2010 00:46:53 +0300 Subject: [PATCH] 95rootfs-block: fix missing root when label contains slash It is not clearly documented, but apparently fsck (or, probably, getmntent) is using backslash as escape character. Label containing slash is converted to \x2f but '\' is eaten by fsck later. Escape '\' before writing into fstab. v2: - fix sed expression - use printf instead of echo because echo eats '\' as well Signed-off-by: Andrey Borzenkov --- modules.d/95rootfs-block/mount-root.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh index ff64209f..9065bed8 100755 --- a/modules.d/95rootfs-block/mount-root.sh +++ b/modules.d/95rootfs-block/mount-root.sh @@ -106,7 +106,9 @@ if [ -n "$root" -a -z "${root%%block:*}" ]; then done fi - echo ${root#block:} "$NEWROOT" "$rootfs" ${rflags},${rootopts} 1 1 > /etc/fstab + # backslashes are treated as escape character in fstab + esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g') + printf "%s $NEWROOT $rootfs ${rflags},${rootopts} 1 1\n" "$esc_root" > /etc/fstab if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then info "Checking filesystems"