From nobody Tue Jan 21 12:48:03 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ycn780M4Qz5l3QF; Tue, 21 Jan 2025 12:48:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ycn7752DSz3pln; Tue, 21 Jan 2025 12:48:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737463683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Od/28+kR07tX4bFPuKP3BabpWv/VkyL4M9Z/3nm5HG0=; b=WdHHAYl/BNilLGAwNh/mxgbxEeqkKkNbekKvQvr7J1M9cAnWSfo6fYHieHJgD1jDzMYTwo WpwWOy/JeYpKmEBGrHV6uqlvRCt7dCepIrFz9XCo0UxzbB6WxyV76z4qwxZ/crsD4/00Xw I0gCRGtfonv8B8jTPba8E/Ei7J0Q4vHahovrPG36Vc6J1qzAMfRA5u3NkFobBebhKHdbxX MxJ6nLg+rf5F7RBhrjdt3aHuf1aLaKDdPIJqn+l2pF7XdgpXdMnxzgOOycfvWzP9C7qIxO SkBDUlfqd5zDFcfjM4iHqSFEpyVqzgGeHCjFLwaYbSXTGQmkkNRpyWNDosJq+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737463683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Od/28+kR07tX4bFPuKP3BabpWv/VkyL4M9Z/3nm5HG0=; b=V1hDIFM+nP5PX+3CIQjBQcC1EFp0TUoQvjbuuQfr5YsmXu2qnlAAb85qwaMU6yBQxk98M4 grcTR+iyMAL36ntAXgERfhh8m+gOy/gnT7Tl+rm7kDvcvgmjXN4J4Ba4JXNiSVssSgl/Tw k1Ht42aUjNKaHjo7gb6jmMDFBqEY00W8NgfEByrv5Z3Al2qVZsGh49BnnDF+p8kwyeOY66 5SIDMc581bl83EsBky/YEP7MKDBpKqRyv+vdYbZKGgFq9z6uxb23uwF6o/YvA2ZjeRC953 rlCEqay930cqDZCleQEs5vCpJtn3+zlN/qNxL/+svThrmngn81N3UafS/SYgrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737463683; a=rsa-sha256; cv=none; b=iDBl/6fqbTxInkOgb1vS5wnmCHNvJaD2qINqsD8y5dcX5p9hzn5M/hPql4orwpqTWypTK8 k8gQBKhRwaSxy1ZytOuqGbazS35QktzI87rwHu5im64L8nTBbUehrdN5PZujkIWHmAojlU fRlUHmzxzIP4z/0vIDHD3S2Q9C1tm2fpNtXKsvK0904jtEg1ef3YPt4IlGARwBPQTv2VG9 UeqMmOHexUpDl9la3RwqOJagf+gLK5C6/GVoIoCiVIvUgPu1WYlm4R6fxcgkZcEpLPPih7 s61s9rmVerFNQJRj9mZSuB0mjjH/mq2zn9VbvHwGvCn0EoqAnL1TMSxcCiUmyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ycn774clYz16Qw; Tue, 21 Jan 2025 12:48:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50LCm3EY098511; Tue, 21 Jan 2025 12:48:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LCm3JW098508; Tue, 21 Jan 2025 12:48:03 GMT (envelope-from git) Date: Tue, 21 Jan 2025 12:48:03 GMT Message-Id: <202501211248.50LCm3JW098508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 4b04f5d7e8a2 - main - install: Fix METALOG ouptut for numeric -o and -g args List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b04f5d7e8a2bb0488ad5804ecaf45cef5b1d46f Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4b04f5d7e8a2bb0488ad5804ecaf45cef5b1d46f commit 4b04f5d7e8a2bb0488ad5804ecaf45cef5b1d46f Author: Ed Maste AuthorDate: 2025-01-17 19:14:22 +0000 Commit: Ed Maste CommitDate: 2025-01-21 12:47:48 +0000 install: Fix METALOG ouptut for numeric -o and -g args install's -o and -g flags both accept a name or a numeric argument. In -U -M (non-root METALOG) mode it always emitted uname= and gname= in the METALOG, but these are not appropriate for numeric IDs. If the -o and/or -u arguments parse as an ID, emit uid= and/or gid= respectively. Note that if an argument is valid as both a name and numeric ID we will prefer the name in normal (non -U -M) mode and the ID in -U -M mode. We don't want to require a passwd db in non-root mode, and entirely-numeric user or group names are a terrible idea so just accept this discrepancy. PR: 284119 Reviewed by: jlduran Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48504 --- usr.bin/xinstall/xinstall.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index d0fcda340034..02b3eeccf8a7 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -1432,10 +1432,22 @@ metadata_log(const char *path, const char *type, struct timespec *ts, p = buf; /* Print details. */ fprintf(metafp, ".%s%s type=%s", *p ? "/" : "", p, type); - if (owner) - fprintf(metafp, " uname=%s", owner); - if (group) - fprintf(metafp, " gname=%s", group); + if (owner) { + id_t id; + + if (parseid(owner, &id)) + fprintf(metafp, " uid=%jd", (intmax_t)id); + else + fprintf(metafp, " uname=%s", owner); + } + if (group) { + id_t id; + + if (parseid(group, &id)) + fprintf(metafp, " gid=%jd", (intmax_t)id); + else + fprintf(metafp, " gname=%s", group); + } fprintf(metafp, " mode=%#o", mode); if (slink) { strsnvis(buf, buflen, slink, VIS_CSTYLE, extra);