YA8fxEiJpVxhDoaK9t6uYYFWI4SkCyOfGruQ3PXZ5m2VkmUvOt6AXb/c7yA5Q0QDr YUnL48gqbFJ2cmjVnkb77gXUS8rMRcBJdcs6n4LD68rTdgScUqKXXE7LMV53RVsyuzi95y ngc1cH4UcFSNmS34I1sym+BLlQdDmOFq684HpbB9EIRNi9FHmhFmiTUBSzJbguH8OZKcDK Xk2k+jl2bdsCgEDw5rChb+kqSjktynRZE9Q0v7m4hKXI2vHTmemaHwxmpgE4Zg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760508534; a=rsa-sha256; cv=none; b=qooQXX6kdFVPQT6lEGaeqeY75vpg1WFbAblQJt/uz0gYY9EcnqnYtXtw/Bh8w+O+29MD8f TY+PYkRMyctZykU9tuWUqWzANyT2F4L2fQCD/kFPDkyzTIM1CmgW20FLJVa12t7wUPeGH0 7TNjlf+LBa04V2YpqRwlZtD1P5wF/OZx+g9ewWELdYs8A9Qh8vP/4KX730u2sdI7nngyY7 Ok3a3d9ElvrBOL1iBdqP4JkjgNwrvlPOupqji8Aw/UjraDNEgOr7+Ri/u3oDlkvpxxYdp3 Z1zztckd94N2MKLCPEJDSJBF4iGQoyhuBoA6kTi00uL8sEds6VKV9E6LDg8MIQ== 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 4cmgdL4fwLzBJq; Wed, 15 Oct 2025 06:08:54 +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 59F68sPf023298; Wed, 15 Oct 2025 06:08:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59F68sNU023295; Wed, 15 Oct 2025 06:08:54 GMT (envelope-from git) Date: Wed, 15 Oct 2025 06:08:54 GMT Message-Id: <202510150608.59F68sNU023295@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: f6751f1fc5a9 - releng/15.0 - vmimage.subr: Sort METALOG before running makefs 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: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/releng/15.0 X-Git-Reftype: branch X-Git-Commit: f6751f1fc5a941a787503d6faf63a8bbd4403653 Auto-Submitted: auto-generated The branch releng/15.0 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=f6751f1fc5a941a787503d6faf63a8bbd4403653 commit f6751f1fc5a941a787503d6faf63a8bbd4403653 Author: Colin Percival AuthorDate: 2025-10-12 04:32:29 +0000 Commit: Colin Percival CommitDate: 2025-10-15 06:08:12 +0000 vmimage.subr: Sort METALOG before running makefs When creating VM images from pkgbase, the METALOG may not be in order; in particular, files may be listed before the directories which contain them. This causes makefs to create directories with 000 permissions. Interestingly, such VM images boot just fine, since root ignores those permissions; the first sign of trouble was sshd refusing logins with an error message which said absolutely nothing about /etc/ having incorrect permissions or being unable to read files inside it. Immediately prior to running makefs, sort the METALOG file. While we're here, uniquify as well; this does not guarantee that we do not have duplicate paths, but if there are duplicate paths with different settings something else has gone wrong and we don't really have any good way of solving the problem anyway. Approved by: re (cperciva) Reviewed by: ivy Hint from: imp MFC after: 3 days Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D53046 (cherry picked from commit 0cc81b375ea43c7e853b109d00c72c8c3b3df993) (cherry picked from commit ad2ca1c5c17935d8601b3ee48f705e1e5ede57bc) --- release/tools/vmimage.subr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr index 15c4dd53e70b..c3c917dcd642 100644 --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -290,6 +290,11 @@ buildfs() { cat ${DESTDIR}/METALOG.pkg >> ${DESTDIR}/METALOG fi + # Sort METALOG file; makefs produces directories with 000 permissions + # if their contents are seen before the directories themselves. + env -i LC_COLLATE=C sort -u ${DESTDIR}/METALOG > ${DESTDIR}/METALOG.sorted + mv ${DESTDIR}/METALOG.sorted ${DESTDIR}/METALOG + case "${VMFS}" in ufs) cd ${DESTDIR} && ${MAKEFS} ${MAKEFSARGS} -o label=rootfs -o version=2 -o softupdates=1 \