Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The shell scripts zfs-functions et al. have multiple problems: - Current shell code is hard to read and debug because of too much unoptimized code - Some bugs (like openzfs#9168, openzfs#9183, and I guess some more but I did not search in the issues, yet) - Inconsistent code style - Use of upper case variables (very confusing at least for me, as only env vars or globals should be upper case (isn't this (un)written convention?) - Very much missing documentation which makes it hard for new devs to understand what SHOULD happen (which is not always what really happens) - use of evi... eval() where it is not needed at all, e.g.: `eval export FSTAB_dev_$i="$fs"` - duplicated functionality: `in_mtab` vs. `is_mounted` - inconsistent use of `mount` and `cat/read /proc/self/mounts` (which both return the same results. The only differene is that mount does some formatting (insert `on` and `type`, put `options` in brackets, omitting `freq` and `pass`) - Caching of fstab and mtab in env makes everything very, very complicated due to special character handling and (as far as I looked at the code, yet) is not needed at all. (MAYBE this is really needed and I did not get this far, yet. We'll see.) IMHO it really does not matter if we call grep multiple times but can completely drop any `eval`. The run time difference is negligible and should be in the range of some 10s or 100s of milliseconds. - ... (more to follow) This PR does a complete rework of all existing shell scripts to fix all those problems while keeping backwards compatibility. Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
- Loading branch information