HomeFreeBSD

etcupdate: Always extract to a temporary tree.

Description

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

Details

Provenance
jhbAuthored on Apr 20 2021, 8:21 PM
Reviewer
imp
Differential Revision
D29843: etcupdate: Always extract to a temporary tree.
Parents
rGdd559118ab3f: Fix leak in libc NFSv4 flags parsing
Branches
Unknown
Tags
Unknown