95rootfs-block: fix missing root when label contains slash
PATCH 1/1 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.
--- modules.d/95rootfs-block/mount-root.sh | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
modules.d/95rootfs-block/mount-root.sh +3 -1
@@ -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 ',\\,\\\\,g') + echo "$esc_root" "$NEWROOT" "$rootfs" ${rflags},${rootopts} 1 1 > /etc/fstab if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then info "Checking filesystems"
Signature · 1 line
tg: (921f4b5..) upstream/rootdev (depends on: master)
A message that is not in the archive (sent off-list or not yet received): 1288963916-3609-1-git-send-email-arvidjaar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH v2 1/1 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
--- modules.d/95rootfs-block/mount-root.sh | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
modules.d/95rootfs-block/mount-root.sh +3 -1
@@ -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"
Signature · 1 line
tg: (1c29003..) upstream/rootdev (depends on: master)
A message that is not in the archive (sent off-list or not yet received): 1289080013-3525-1-git-send-email-arvidjaar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 23 lines · Andrey Borzenkov
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 wellSigned-off-by Andrey Borzenkov<[email protected]>--- modules.d/95rootfs-block/mount-root.sh | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)modules.d/95rootfs-block/mount-root.sh +0
-0
modules.d/95rootfs-block/mount-root.sh if [ -n "$root" -a -z "${root%%block:*}" ]; then · line 114
Quoted 10 lines
modules.d/95rootfs-block/mount-root.sh +3
-1@@ -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"
maybe we should just turn \x2f back into / ??
Quoted 23 lines · Andrey Borzenkov
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 wellSigned-off-by Andrey Borzenkov<[email protected]>--- modules.d/95rootfs-block/mount-root.sh | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)modules.d/95rootfs-block/mount-root.sh +0
-0
modules.d/95rootfs-block/mount-root.sh if [ -n "$root" -a -z "${root%%block:*}" ]; then · line 114
Quoted 10 lines
modules.d/95rootfs-block/mount-root.sh +3
-1@@ -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"
pushed