Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
PR: 175311
In contrast to the approach in the PR I went with a loop looking for dump first then swap, as dump should take precedence over swap, in e.g.
# Device Mountpoint FStype Options Dump Pass# /dev/nvd0p3 none swap sw 0 0 /dev/nvd0p4 none dump sw 0 0
or if we want to avoid reading /etc/fstab twice something like
dump_try=
swap_try=
while read dev mp type more ; do
[ "${type}" = dump -o "${type}" = swap ] || continue
case ${dev} in
*.bde|*.eli)
dumpon_warn_unencrypted
dev=${dev%.*}
;;
esac
[ -c "${dev}" ] || continue
eval ${type}_try=\"\${${type}_try} ${dev}\"
done </etc/fstab
for dev in ${dump_try} ${swap_try}; do
dumpon_try "${dev}" 2>/dev/null && return 0
doneI'm not sure it's worth the added complexity, especially in a zfs world where fstab is typically very short.
The commit message needs some work, it should mention that we prefer dump to swap if both are encountered.
| libexec/rc/rc.d/dumpon | ||
|---|---|---|
| 65 | We should skip lines where ${dev} begins with #, otherwise commenting out the first dump or swap line will result in some strange console errors: unable to specify #/dev/da0p2 as a dump device | |
| 66 | The patch in the PR has it right here (except for a missing newline); case is faster than test for string comparisons. Although arguably we should fix that by giving sh a built-in [. | |
I agree that comment lines in /etc/fstab should be skipped.
| libexec/rc/rc.d/dumpon | ||
|---|---|---|
| 66 | Our sh has had a built-in [ since 2001, but case is still somewhat faster because it avoids the overhead associated with simple commands and built-in utilities. I don't think this is sufficient reason to replace [ with case even where it looks unnatural, though. | |