summaryrefslogtreecommitdiff
path: root/test/units/testsuite-29.sh
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2022-01-27 14:10:34 +0000
committerLuca Boccassi <luca.boccassi@microsoft.com>2022-01-28 00:54:10 +0000
commit3fa80e5e75a98ef6f9a84b01770b71a1774478dc (patch)
tree52fcb950118bde2160cd1e51219ee8aa056db592 /test/units/testsuite-29.sh
parent6d7c999ab5958d6f1f192e7d0a63b8c330a077cb (diff)
downloadsystemd-3fa80e5e75a98ef6f9a84b01770b71a1774478dc.tar.gz
core: do not attempt to add 'private' symlinks when RootImage/RootDirectory are used
A bind mount is added directly from private on the host to the actual destination directory, no need for the symlinks (which cannot be created as the bind mount happens first and creates the target as an actual directory) Fixes https://github.com/systemd/systemd/issues/22264
Diffstat (limited to 'test/units/testsuite-29.sh')
-rwxr-xr-xtest/units/testsuite-29.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/units/testsuite-29.sh b/test/units/testsuite-29.sh
index 4dbb3a0752..1b927a8305 100755
--- a/test/units/testsuite-29.sh
+++ b/test/units/testsuite-29.sh
@@ -6,10 +6,13 @@ set -eux
set -o pipefail
ARGS=()
+state_directory=/var/lib/private/
if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then
# If we're running under sanitizers, we need to use a less restrictive
# profile, otherwise LSan syscall would get blocked by seccomp
ARGS+=(--profile=trusted)
+ # With the trusted profile DynamicUser is disabled, so the storage is not in private/
+ state_directory=/var/lib/
fi
systemd-dissect --no-pager /usr/share/minimal_0.raw | grep -q '✓ portable service'
@@ -109,6 +112,12 @@ status="$(portablectl is-attached --extension app1 minimal_1)"
portablectl detach --now --runtime --extension /usr/share/app1.raw /usr/share/minimal_1.raw app1
+# Ensure that the combination of read-only images, state directory and dynamic user works, and that
+# state is retained. Check after detaching, as on slow systems (eg: sanitizers) it might take a while
+# after the service is attached before the file appears.
+grep -q -F bar "${state_directory}/app0/foo"
+grep -q -F baz "${state_directory}/app1/foo"
+
# portablectl also works with directory paths rather than images
mkdir /tmp/rootdir /tmp/app0 /tmp/app1 /tmp/overlay /tmp/os-release-fix /tmp/os-release-fix/etc