]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
etcupdate: Always extract to a temporary tree.
authorJohn Baldwin <jhb@FreeBSD.org>
Tue, 20 Apr 2021 20:21:42 +0000 (13:21 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 20 Apr 2021 20:21:42 +0000 (13:21 -0700)
commit0611aec3cf3a373e6a06f103699dbc91c3d6d472
treefb010dc7aa6958f8eb4946fe0575d949a984d1b0
parentdd559118ab3f065ae230b324c3fe4bb1c9b7ca56
etcupdate: Always extract to a temporary tree.

etcupdate has had a somewhat nasty race condition since its creation
in that its state machine can get very confused if it is interrupted
while building the tree to compare against.  This is exacerbated by
the fact that etcupdate doesn't emit any output while building the
tree which can take several seconds (especially in recent years with
the addition of the tree-wide buildconfig/installconfig passes).

To mitigate this, always install a new tree into a temporary directory
created via mktemp as was previously done only for dry-runs via -n.
The existing trees are only rotated and the new tree installed as
/var/db/etcupdate/current after the update command has completed.

Reported by: dim, np (and many others)
Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29843
usr.sbin/etcupdate/etcupdate.sh