Additional SYSV init script fixes.

Use the 'mount' command instead of /proc/mounts to get a list of matching
filesystems.

This because /proc/mounts reports a pool with a space 'rpool 1' as
'rpool\0401'. The space is encoded as 3-digit octal which is legal.
However 'printf "%b"', which we use to filter out other illegal
characters (such as slash, space etc) can't properly interpret this
because it expects 4-digit octal. We get a  instead of the space
we expected. The correct value should have been 'rpool\00401' (note
the additional leading zero).

So use 'mount', which interprets all backslash-escapes correctly,
instead.

Signed-off-by: Turbo Fredriksson turbo@bayour.com
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3488
This commit is contained in:
Turbo Fredriksson 2015-06-11 23:03:04 +02:00 committed by Brian Behlendorf
parent 5d6a460362
commit 036391c980

View File

@ -371,13 +371,16 @@ read_mtab()
# Unset all MTAB_* variables # Unset all MTAB_* variables
unset $(env | grep ^MTAB_ | sed 's,=.*,,') unset $(env | grep ^MTAB_ | sed 's,=.*,,')
while read -r fs mntpnt fstype opts rest; do mount | \
if echo "$fs $mntpnt $fstype $opts" | grep -qE "$match"; then grep -E "$match" | \
mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,_,g' \ sed "s,\(.*\) on \(.*\) type .*,\1;\2," | \
-e 's,-,_,g' -e 's,\.,_,g') while read line; do
eval export MTAB_$mntpnt="$fs" mntpnt=$(echo "$line" | sed -e 's,;.*,,' -e 's,/,_,g' \
fi -e 's,-,_,g' -e 's,\.,_,g' -e 's, ,_,g')
done < /proc/mounts fs=$(echo "$line" | sed 's,.*;,,')
eval export MTAB_$mntpnt="'$fs'"
done
} }
in_mtab() in_mtab()