From 2e0d99a953ef30ad29b3c0143c0aa7a815cf8ef1 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Thu, 8 Jun 2023 18:35:23 +0100 Subject: [PATCH] Makefile.inc1: Fix distributeworld mtree mangling for dist root dir The trailing slash means that ./base itself doesn't get mangled and remains as-is in the output, leading to a stray /base in base.txz for NO_ROOT builds and thus in the installed system. Since this action is running on a line whose file matches one listed by find (and we're printing all of these as part of that distribution), we don't need to care about the possibility of a path like ./basefoo/bar where the path prefix isn't ./base, and can thus just drop the slash rather than needing something more complicated like "slash or whitespace or EOL" as one might first think. --- Makefile.inc1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 88ae6dadd8a1..09267b8f69c2 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1482,7 +1482,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY @# the relevant mtree line. cd ${DESTDIR}/${DISTDIR}; \ find ./${dist} | ${METALOG_SORT_CMD} -u ${METALOG} - | \ - awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ + awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \ ${DESTDIR}/${DISTDIR}/${dist}.meta .endfor .for dist in ${DEBUG_DISTRIBUTIONS} @@ -1492,7 +1492,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY @# the relevant mtree line. cd ${DESTDIR}/${DISTDIR}; \ find ./${dist}/usr/lib/debug | ${METALOG_SORT_CMD} -u ${METALOG} - | \ - awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ + awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \ ${DESTDIR}/${DISTDIR}/${dist}.debug.meta .endfor .endif