Testing the new dbupdate(8) functiontionality, I noticed that I wasn't
able to do a dry-run as a non-root user.
AFAICT, it should be perfectly fine to do a dry-run as non-root, and
the diff below Seems To Work For Me(tm) allowing
user@openbsd$ dbupdate -n
without it whinging.
I'm not sure whether y'all would prefer "$DRY = false" or "$DRY -ne true",
but #bikeshedding.
Tangentially, I just copied up the same "[ $DRY = false ]" test used
elsewhere in the code, but I'm not certain why the is-root test is in
[[ ... ]] double-brackets while the rest of the tests all seem to be in
[ ... ] single-brackets.
-tkc
$ diff -u /usr/sbin/dbupdate dbupdate
--- /usr/sbin/dbupdate Thu Oct 22 16:29:45 2026
+++ dbupdate Fri Oct 23 12:33:13 2026
@@ -40,7 +40,7 @@
esac
done
-[[ $(id -u) -ne 0 ]] && echo $PROG: need root privileges && exit 1
+[ $DRY = false ] && [[ $(id -u) -ne 0 ]] && echo $PROG: need root privileges
&& exit 1
CACHE=/var/dbupdate
R=$(sysctl -n kern.osrelease | sed -e 's/\.//')