From: Andrey Borzenkov Date: Sat, 6 Nov 2010 21:46:53 +0000 (+0300) Subject: 95rootfs-block: fix missing root when label contains slash X-Git-Tag: 008~55 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e08f1de8d6a7ec2e59078fb149e07a7d26e85e8;p=thirdparty%2Fdracut.git 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 --- diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh index ff64209ff..9065bed8b 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"