diff sbin/ftjail @ 545:566ecdd9e73b

When analyzing the output of "mount -p" check for proper parsing capability: no improper mixing of tabs and spaces. Suggest (and mostly use) "jq" in other cases.
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 10 Sep 2024 10:13:59 +0200
parents 62cd970aea9c
children 847ae246f3cc
line wrap: on
line diff
--- a/sbin/ftjail	Tue Sep 10 01:54:42 2024 +0200
+++ b/sbin/ftjail	Tue Sep 10 10:13:59 2024 +0200
@@ -537,16 +537,20 @@
     _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" || \
         { echo "ERROR: dataset not found" >&2; return 1; }
 
+    # Check for unexpected spaces
+    if ! check_for_proper_fstab; then
+        fatal 1 "Unexpected spaces in fstab. Please install \`${JQ}'."
+    fi
     /sbin/mount -t zfs -p \
-    | /usr/bin/grep -E "^${_dsname}(/|\s)" \
-    | sort -n -r \
+    | LC_ALL=C /usr/bin/grep -E "^${_dsname}(/|\s)" \
+    | LC_ALL=C /usr/bin/sort -n -r \
     | {
         while IFS=' '$'\t' read -r _name _mp _rest ; do
             echo "Umounting ${_name} on ${_mp}"
             /sbin/umount "${_mp}" || return 1
         done
         return 0
-    }
+      }
 }