diff options
author | Turbo Fredriksson <[email protected]> | 2015-06-11 23:03:04 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-06-17 13:30:03 -0700 |
commit | 036391c980c1e6504352b770eb385806a951b1cb (patch) | |
tree | 19245821e4f91a3a49bf86f7bde75960ae8b0c93 /etc | |
parent | 5d6a46036277e472433416dda06a0299c339ae08 (diff) |
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 [email protected]
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #3488
Diffstat (limited to 'etc')
-rw-r--r-- | etc/init.d/zfs-functions.in | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/etc/init.d/zfs-functions.in b/etc/init.d/zfs-functions.in index 372bae803..24c0bdbd1 100644 --- a/etc/init.d/zfs-functions.in +++ b/etc/init.d/zfs-functions.in @@ -371,13 +371,16 @@ read_mtab() # Unset all MTAB_* variables unset $(env | grep ^MTAB_ | sed 's,=.*,,') - while read -r fs mntpnt fstype opts rest; do - if echo "$fs $mntpnt $fstype $opts" | grep -qE "$match"; then - mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,_,g' \ - -e 's,-,_,g' -e 's,\.,_,g') - eval export MTAB_$mntpnt="$fs" - fi - done < /proc/mounts + mount | \ + grep -E "$match" | \ + sed "s,\(.*\) on \(.*\) type .*,\1;\2," | \ + while read line; do + mntpnt=$(echo "$line" | sed -e 's,;.*,,' -e 's,/,_,g' \ + -e 's,-,_,g' -e 's,\.,_,g' -e 's, ,_,g') + fs=$(echo "$line" | sed 's,.*;,,') + + eval export MTAB_$mntpnt="'$fs'" + done } in_mtab() |