Skip to contentSkip to conversation

usrmount should skip comments in fstab

PATCH In review Dennis Schridde 1 participant 2 messages Feb 25, 2012 – Feb 28, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usrmount should skip comments in fstab

Hi!

Currently usrmount chokes on fstab lines like:
#... /usr ...
It will try to mount "#...", which obviously is wrong.

Attached patch fixes this by skipping over lines beginning with "#". It still does not handle cases like " #...", but is enough to work in my case.

Kind regards,
Dennis

usr/lib/dracut/modules.d/98usrmount/mount-usr.sh renamed from usr/lib/dracut/modules.d/98usrmount/mount-usr.sh.orig +1 -0
@@ -10,6 +10,7 @@
     local _dev _mp _fs _opts _rest _usr_found _ret
     # check, if we have to mount the /usr filesystem
     while read _dev _mp _fs _opts _rest; do
+		[ "$_dev" = "${_dev###}" ] || continue
         if [ "$_mp" = "/usr" ]; then
             case "$_dev" in
                 LABEL=*)
#1 lore raw

Am Samstag, 25. Februar 2012, 23:08:51 schrieb Dennis Schridde:

Quoted 2 lines

It still does not handle cases like " #...", but is enough to work in my case.

This is not true if IFS contains the usual whitespaces, in which case read will already strip whitespace. So the patch should be safe for all cases.