From e38cd466c7ca9e29777eef6bee0c4d126c90d5ff Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Mon, 1 Sep 2025 11:01:21 +0200 Subject: [PATCH] support/scripts: reject skeletons or overlays that are unexpectedly merged Currently, we partially accept that a skeleton or a rootfs overlay be merged: - for unmerged, we accept all kind of situations: unmerged, partially merged, badly merged, merged-usr or merged-bin, arbitrary relative or absolute symlinks, and whatnots; - for merged-usr, we strictly require a properly set up merged-usr, and we refuse a merged-bin; - for merged-bin, we stricty require a properly set up merged-bin. The unmerged case is inconsistent with the other cases, especially it allows for arbitrary symlinks that may point to arbitrary locations that may even not belong to $(TARGET_DIR) at all... We fix that by ensuring that the skeleton and overlays strictly adhere to the merge-level of the configuration; i.e. for an unmerged config, we require that the skeleton and overlays be strictly unmerged, that is, /bin, /lib, and /sbin, and their counterparts in /usr, are actual directories. Thus, for all three types of merge level, the skeleton and overlays must match the configured merge level. Signed-off-by: Yann E. MORIN Signed-off-by: Romain Naour --- support/scripts/check-merged | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/support/scripts/check-merged b/support/scripts/check-merged index fbda49f1c0..bff6ae2b7b 100755 --- a/support/scripts/check-merged +++ b/support/scripts/check-merged @@ -3,16 +3,21 @@ # Check if a given custom skeleton or overlay complies to the merged # requirements: # -# - for merged-usr: -# /bin missing, or a relative symlink to usr/bin -# /lib missing, or a relative symlink to usr/lib -# /sbin missing, or a relative symlink to usr/sbin +# - for unmerged: +# /bin missing*, or an existing directory; not a symlink +# /lib missing*, or an existing directory; not a symlink +# /sbin missing*, or an existing directory; not a symlink # /usr/bin/ missing*, or an existing directory; not a symlink # /usr/lib/ missing*, or an existing directory; not a symlink # /usr/sbin/ missing*, or an existing directory; not a symlink # # *: must be present for skeletons, can be missing for overlays # +# - for merged-usr: all of the above, except: +# /bin missing, or a relative symlink to usr/bin +# /lib missing, or a relative symlink to usr/lib +# /sbin missing, or a relative symlink to usr/sbin +# # - for merged-bin: all of the above, except: # /usr/sbin missing, or a relative symlink to bin (thus points # to /usr/bin) @@ -119,9 +124,9 @@ test_dir() { is_success=true for root; do first=true + test_dir "${type}" "${root}" "/" "usr/bin" + test_dir "${type}" "${root}" "/" "usr/lib" if ${merged_usr}; then - test_dir "${type}" "${root}" "/" "usr/bin" - test_dir "${type}" "${root}" "/" "usr/lib" test_merged "${type}" "${root}" "/" "bin" "usr/bin" test_merged "${type}" "${root}" "/" "lib" "usr/lib" test_merged "${type}" "${root}" "/" "sbin" "usr/sbin" @@ -130,6 +135,11 @@ for root; do else test_dir "${type}" "${root}" "/" "usr/sbin" fi + else + test_dir "${type}" "${root}" "/" "bin" + test_dir "${type}" "${root}" "/" "lib" + test_dir "${type}" "${root}" "/" "sbin" + test_dir "${type}" "${root}" "/" "usr/sbin" fi done