mtree "language" enhancements

Simon J. Gerraty sjg at
Tue Dec 1 18:25:52 UTC 2015

Tim Kientzle <tim at> wrote:
> > So I'm left thinking that maybe the rule should be 'last one wins' at least
> > for the use case where we use the target's /etc/master_password. That's
> > what I've actually implemented.
> There are two key cases that drove this design for tar:
> 1.  Handling user info that is not (yet) in the target password file.
> In practice, images get built up in different orders: I might add a
> bunch of new files owned by a new user before some other process gets
> a chance to add the user.

This is the issue we face.
We don't like magic numbers so prefer to use names (uid=0 gid=0
is fine).

We use mtree with BSD.var.dist at various times, and in at least some of
those cases we cannot assume that the passwd or group databases will
be complete (or even valid - eg during recovery from corrupted storage).

In such cases we could easily tollerate mtree simply using 0:0 (or
current uid:gid) for any uname:gname it could not resolve, since we
aren't likely to care about those dirs until we are up and running
properly - by which time the ownership would have been fixed.

What we don't want is for mtree to toss its cookies or flood the console
with pointless noise (which it is wont to do).

What we currently have to do to avoid problems, is run BSD.var.dist
through sed to replace all \([gu]\)name=[^ ]* with \1id=0 and
and it would be nice to be able to skip that.

More information about the freebsd-arch mailing list