From 92da94bf213cd8d0b0586770ec2db471976138cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Salvador=20Rufo?= Date: Sat, 29 Nov 2025 21:34:55 +0100 Subject: [PATCH] support/scripts/check-merged: fix checking custom skeletons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using a custom skeleton where the merged symlinks are missing, the build fails with errors like: support/scripts/check-merged -t skeleton -u -b /usr/src/simplek8s/rootfs-skeleton The skeleton in -t is not properly setup: - /usr/bin should exist, be a directory, and not be a symlink - /usr/lib should exist, be a directory, and not be a symlink The skeleton in skeleton is not properly setup: - /usr/bin should exist, be a directory, and not be a symlink - /usr/lib should exist, be a directory, and not be a symlink [...] Commit 793ebd5d2809 (support/scripts/check-merged: use getopts instead of getopt) intoduced a flawed use of getopts: unlike getopt, getopts does not conume the positional arguments. This causes the check for directory validity to also check each option as if they were directories. For overlays, this is transparently ignored, because the checks are only lax for overlays (missing symlinks are OK). However, for skeletons, the checks are strict. Because of that, a missing symlink is considered an error, when it should be considered as being OK. The fix is to actually consume the positional args to only keep the list of directories to validate, like is done for example in support/download/dl-wrapper. Fixes: 793ebd5d28095c8df45a0d183d273d8a84b3f0a4 Reviewed-by: Yann E. MORIN Acked-by: Yann E. MORIN Cc: Edgar Bonet Signed-off-by: José Luis Salvador Rufo Signed-off-by: Peter Korsgaard --- support/scripts/check-merged | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/support/scripts/check-merged b/support/scripts/check-merged index 447abfd815..57db8abd21 100755 --- a/support/scripts/check-merged +++ b/support/scripts/check-merged @@ -47,6 +47,10 @@ while getopts "t:ub" OPT; do esac done +# Remove the options processed by getopts from $@, +# so that $@ now contains only the root directories to check. +shift $((OPTIND -1)) + if [ "${type}" = "skeleton" ]; then strict=true else