Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Nov 2015 22:49:10 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Tim Kientzle <tim@kientzle.com>
Cc:        "Simon J. Gerraty" <sjg@juniper.net>, Michal Ratajsky <michal.ratajsky@gmail.com>,  Brooks Davis <brooks@freebsd.org>, "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Re: mtree "language" enhancements
Message-ID:  <CANCZdfo3fsupKZ3TJ%2B8MBhXR27c9dHkCYVa7R6J2q-z2mdAGmA@mail.gmail.com>
In-Reply-To: <0A51B6D4-9EDD-4EFF-876F-C6B515DBB4F3@kientzle.com>
References:  <CANCZdfrDtfkwKxMV3o9tcQNzBQDKZdTx1JErkTKtC7UZORT5aA@mail.gmail.com> <AFF9BC5D-536B-4F7D-83CC-E26D9CBA8BF3@kientzle.com> <CANCZdfp%2BtCnXDkbMan9crp9YepVnZKT_hSw%2Bi43OAzZX3VWhXg@mail.gmail.com> <A5A83D40-6B19-465C-9042-3DB3FB127759@kientzle.com> <0A51B6D4-9EDD-4EFF-876F-C6B515DBB4F3@kientzle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 29, 2015 at 9:28 PM, Tim Kientzle <tim@kientzle.com> wrote:

>
> > On Nov 29, 2015, at 2:49 PM, Tim Kientzle <tim@kientzle.com> wrote:
> >
> > Simon also asked:
> >> Indeed I'd really like the ability to provide default uid/gid
> >> for the case that a uname/gname cannot be looked up.
> >
> > I think 'tar' got this right:  If uname and uid are both specified, then
> look up uname and if that fails, use the specified uid.  Ditto for
> gname/gid.  In particular, this lets a single specification be used to
> rebuild a tree on another system with different UIDs or on a system that
> does not (yet) have a full password file.  An option could be provided for
> the (rare) case that someone really wants to prefer UIDs to unames.
>
> On further reflection, preferring UIDs to unames would actually be pretty
> common here.
>
> In particular, NanoBSD (and Crochet and other similar tools) should prefer
> the UID when building images instead of looking up unames against the build
> host's password file.


I've implemented what we've talked about, except this. When doing the
makefs, we should use the /etc/master_password that's inside the image in
preference to either of these alternatives. That's the most correct thing
to do: use as much of the data as you can, as late as you can.

The thing I'm struggling with now is why would both be present? Would that
indicate an error? Or someone changing the defaults? And if they are
changing the defaults, why use a uid in preference to a uname? Is this to
avoid contamination? To set something not in the password file, or just
comfort level of the user? FreeBSD will write unames for install*.

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.

Preliminary testing of http://people.freebsd.org/~imp/mtree-dedup.awk
appears to be working. I haven't tried all the cases yet, but it is looking
promising. I don't need append_from, so that's just a stub in this file.
Since this is in awk, I don't use the host's /etc/password at all. That's
one of the failures of mtree that I've seen when I tried to use it, and
perhaps the source of your concern. I'd love to see any libmtree be able to
manipulate mtree files absent the tree it describes and even any process of
uname -> uid at all to avoid these issues. The silly awk thing I wrote is
purely a path to set of key-value pair manipulation tool.

Once I'm  more confident about this after some testing and integration into
NanoBSD, I'll post something to phabricator. But I'd welcome any comments
on what I've implemented in the mean time.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfo3fsupKZ3TJ%2B8MBhXR27c9dHkCYVa7R6J2q-z2mdAGmA>