On Sat, Oct 14, 2023 at 11:24:08AM -0700, Andrew Hewus Fresh wrote:
> While testing another patch, I noticed that fw_update will lock the
> package database even if it's just downloading and not touching the
> installed packages.
>
> Currently we do _read_ the existing firmware as part of detecting what
> we might need to download or upgrade without locking. I'm unsure if
> that is an issue.
>
> Comments, OK?
>
>
>
> Index: fw_update.sh
> ===================================================================
> RCS file: /cvs/src/usr.sbin/fw_update/fw_update.sh,v
> retrieving revision 1.51
> diff -u -p -r1.51 fw_update.sh
> --- fw_update.sh 14 Oct 2023 18:10:47 -0000 1.51
> +++ fw_update.sh 14 Oct 2023 18:12:08 -0000
> @@ -593,7 +593,7 @@ kept=''
> unregister=''
>
> if [ "${devices[*]:-}" ]; then
> - lock_db
> + "$INSTALL" && lock_db
> for f in "${devices[@]}"; do
> d="$( firmware_devicename "$f" )"
>
>
>
the package tools have two lock modes: read-only and read-write.
If you want to match them, you want lock read-only for this.