git: 71b2f9853529 - main - vmimage.subr: Add missing directories to METALOG
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Oct 2025 16:52:39 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=71b2f9853529b1d1a160eaaa202e93a14f91eed1
commit 71b2f9853529b1d1a160eaaa202e93a14f91eed1
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-10-17 07:01:33 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-17 16:50:52 +0000
vmimage.subr: Add missing directories to METALOG
Theoretically METALOG should include everything which needs to go
into disk images; unfortunately there are still a few bugs which
are resulting in directories not being listed -- and if METALOG
has files in unrecorded directories, the directories end up being
created with 000 permissions.
Oddly enough, systems where / has 000 permissions are not very
usable.
As a temporary hack, compare the staging tree against METALOG and
add entries for any unrecorded directories. This will hopefully
be reverted before 15.0-RELEASE.
Reviewed by: bapt, emaste, ivy
Sponsored by: https://www.patreon.com/cperciva
MFC after: 5 minutes
Differential Revision: https://reviews.freebsd.org/D53153
---
release/tools/vmimage.subr | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index c3c917dcd642..842a808c623e 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -290,6 +290,24 @@ buildfs() {
cat ${DESTDIR}/METALOG.pkg >> ${DESTDIR}/METALOG
fi
+ # Check for any directories in the staging tree which weren't
+ # recorded in METALOG, and record them now. This is a quick hack
+ # to avoid creating unusable VM images and should go away once
+ # the bugs which produce such unlogged directories are gone.
+ grep type=dir ${DESTDIR}/METALOG |
+ cut -f 1 -d ' ' |
+ sort -u > ${DESTDIR}/METALOG.dirs
+ ( cd ${DESTDIR} && find . -type d ) |
+ sort |
+ comm -23 - ${DESTDIR}/METALOG.dirs > ${DESTDIR}/METALOG.missingdirs
+ if [ -s ${DESTDIR}/METALOG.missingdirs ]; then
+ echo "WARNING: Directories exist but were not in METALOG"
+ cat ${DESTDIR}/METALOG.missingdirs
+ fi
+ while read DIR; do
+ metalog_add_data ${DIR}
+ done < ${DESTDIR}/METALOG.missingdirs
+
# 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