]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: do not fail if ignorable img.v/ vpick dir is missing
authorLuca Boccassi <luca.boccassi@gmail.com>
Tue, 15 Oct 2024 13:05:50 +0000 (14:05 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 15 Oct 2024 16:17:25 +0000 (18:17 +0200)
Do not fail if the directory is missing entirely, other than just empty

Follow-up for 00f546e25e8
Follow-up for 5e79dd96a88
Follow-up for 622efc544dc

src/core/namespace.c
test/units/TEST-50-DISSECT.dissect.sh

index d13d57f11aa3fb8cd1c6c068e5f4ccdad4e55747..e1a88f2455efeee73218a822da52bd892e7f2aa6 100644 (file)
@@ -526,6 +526,8 @@ static int append_extensions(
                               &pick_filter_image_raw,
                               PICK_ARCHITECTURE|PICK_TRIES,
                               &result);
+                if (r == -ENOENT && m->ignore_enoent)
+                        continue;
                 if (r < 0)
                         return r;
                 if (!result.path) {
@@ -594,6 +596,8 @@ static int append_extensions(
                               &pick_filter_image_dir,
                               PICK_ARCHITECTURE|PICK_TRIES,
                               &result);
+                if (r == -ENOENT && ignore_enoent)
+                        continue;
                 if (r < 0)
                         return r;
                 if (!result.path) {
index 306ea1f504e851ed00c726f2ac2c001107c3df73..6cf12135517f38c8799c4baade93ab89de4da81e 100755 (executable)
@@ -428,12 +428,13 @@ systemctl is-active testservice-50e.service
 VBASE="vtest$RANDOM"
 VDIR="/tmp/$VBASE.v"
 EMPTY_VDIR="/tmp/$VBASE-empty.v"
+NONEXISTENT_VDIR="/tmp/$VBASE-nonexistent.v"
 mkdir "$VDIR" "$EMPTY_VDIR"
 
 ln -s /tmp/app0.raw "$VDIR/${VBASE}_0.raw"
 ln -s /tmp/app1.raw "$VDIR/${VBASE}_1.raw"
 
-systemd-run -P -p ExtensionImages="$VDIR -$EMPTY_VDIR" bash -c '/opt/script1.sh | grep ID'
+systemd-run -P -p ExtensionImages="$VDIR -$EMPTY_VDIR -$NONEXISTENT_VDIR" bash -c '/opt/script1.sh | grep ID'
 
 rm -rf "$VDIR" "$EMPTY_VDIR"
 
@@ -504,12 +505,13 @@ systemctl is-active testservice-50f.service
 VBASE="vtest$RANDOM"
 VDIR="/tmp/$VBASE.v"
 EMPTY_VDIR="/tmp/$VBASE-empty.v"
+NONEXISTENT_VDIR="/tmp/$VBASE-nonexistent.v"
 mkdir "$VDIR" "$EMPTY_VDIR"
 
 ln -s "$IMAGE_DIR/app0" "$VDIR/${VBASE}_0"
 ln -s "$IMAGE_DIR/app1" "$VDIR/${VBASE}_1"
 
-systemd-run -P --property ExtensionDirectories="$VDIR -$EMPTY_VDIR" cat /opt/script1.sh | grep -q -F "extension-release.app2"
+systemd-run -P --property ExtensionDirectories="$VDIR -$EMPTY_VDIR -$NONEXISTENT_VDIR" cat /opt/script1.sh | grep -q -F "extension-release.app2"
 
 rm -rf "$VDIR" "$EMPTY_VDIR"