[Bug 284119] install(1): numeric -o / -g args produce uname and gname in METALOG

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 17 Jan 2025 19:15:04 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284119

            Bug ID: 284119
           Summary: install(1): numeric -o / -g args produce uname and
                    gname in METALOG
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: emaste@freebsd.org

install -U -M can pass the owner and group through to the METALOG:

$ install -U -M /dev/stdout -o root -g wheel /usr/bin/true /tmp
./tmp/true type=file uname=root gname=wheel mode=0755 size=5008

install also accepts numeric uid and gid.  These should produce uid= and gid=
in the METALOG, but we still get uname and gname:

$ install -U -M /dev/stdout -o 0 -g 0 /usr/bin/true /tmp
./tmp/true type=file uname=0 gname=0 mode=0755 size=5008

In normal (non -U) mode we attempt to look up the name, and parse it as an id
if that fails:

        if (owner != NULL && !dounpriv) {
                if (uid_from_user(owner, &uid) == -1) {
                        id_t id;
                        if (!parseid(owner, &id))
                                errx(1, "unknown user %s", owner);
                        uid = id;
                }
        } else
                uid = (uid_t)-1;

Something similar is needed for -U -M mode

-- 
You are receiving this mail because:
You are the assignee for the bug.