1
0
mirror of https://github.com/systemd/systemd synced 2026-03-26 08:44:55 +01:00

Compare commits

..

No commits in common. "af80c9c22459b5051072e5b81cd7db7f4ca4290e" and "9b42cc3b12c17a4b02d713b2ad499a74acecea1f" have entirely different histories.

11 changed files with 35 additions and 87 deletions

View File

@ -659,6 +659,10 @@ foreach prog : progs
conf.set_quoted(name, path) conf.set_quoted(name, path)
endforeach endforeach
if run_command(ln, '--relative', '--help', check : false).returncode() != 0
error('ln does not support --relative (added in coreutils 8.16)')
endif
##################################################################### #####################################################################
gperf_test_format = ''' gperf_test_format = '''
@ -775,13 +779,7 @@ if time_epoch <= 0
if time_epoch == '' if time_epoch == ''
NEWS = files('NEWS') NEWS = files('NEWS')
time_epoch = run_command(stat, '-c', '%Y', NEWS, time_epoch = run_command(stat, '-c', '%Y', NEWS,
check : false) check : true).stdout()
if time_epoch.returncode() != 0
# If the above fails, maybe the stat(1) uses BSD-style syntax
time_epoch = run_command(stat, '-f', '%m', NEWS,
check : true)
endif
time_epoch = time_epoch.stdout()
endif endif
time_epoch = time_epoch.strip().to_int() time_epoch = time_epoch.strip().to_int()
endif endif
@ -3028,12 +3026,8 @@ if conf.get('ENABLE_HWDB') == 1
alias_target('hwdb', auto_suspend_rules, executables_by_name.get('systemd-hwdb'), hwdb_units) alias_target('hwdb', auto_suspend_rules, executables_by_name.get('systemd-hwdb'), hwdb_units)
endif endif
alt_time_epoch = run_command('date', '-Is', '-u', '-d', f'@@time_epoch@', check : false) alt_time_epoch = run_command('date', '-Is', '-u', '-d', f'@@time_epoch@',
if alt_time_epoch.returncode() != 0 check : true).stdout().strip()
# If the above fails, maybe the date(1) uses BSD-style syntax
alt_time_epoch = run_command('date', '-Iseconds', '-u', '-r', f'@time_epoch@', check : true)
endif
alt_time_epoch = alt_time_epoch.stdout().strip()
summary({ summary({
'split bin-sbin' : split_bin, 'split bin-sbin' : split_bin,

View File

@ -91,7 +91,7 @@ _portablectl() {
elif __contains_word "$verb" ${VERBS[STANDALONE]}; then elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
comps='' comps=''
elif __contains_word "$verb" ${VERBS[IMAGE]}; then elif __contains_word "$verb" ${VERBS[IMAGE]}; then
if [[ $n == 1 ]] || [[ "$prev" = -* ]] || __contains_word "${COMP_WORDS[COMP_CWORD-2]}" ${OPTS[ARG]}; then if [[ $n == 1 ]]; then
comps=$( compgen -A file -- "$cur" ) comps=$( compgen -A file -- "$cur" )
compopt -o filenames compopt -o filenames
else else
@ -101,10 +101,10 @@ _portablectl() {
comps=$( compgen -A file -- "$cur" ) comps=$( compgen -A file -- "$cur" )
compopt -o filenames compopt -o filenames
elif __contains_word "$verb" ${VERBS[IMAGE_WITH_BOOL]}; then elif __contains_word "$verb" ${VERBS[IMAGE_WITH_BOOL]}; then
if [[ $n == 1 ]] || [[ "$prev" = -* ]] || __contains_word "${COMP_WORDS[COMP_CWORD-2]}" ${OPTS[ARG]}; then if [[ $n == 1 ]]; then
comps=$( compgen -A file -- "$cur" ) comps=$( compgen -A file -- "$cur" )
compopt -o filenames compopt -o filenames
elif ! __contains_word "$prev" "yes" "no" && { [[ $n == 2 ]] || [[ "$prev" != -* ]]; }; then elif [[ $n == 2 ]]; then
comps='yes no' comps='yes no'
else else
comps='' comps=''

View File

@ -49,26 +49,14 @@
send_interface="org.freedesktop.portable1.Manager" send_interface="org.freedesktop.portable1.Manager"
send_member="GetImageMetadata"/> send_member="GetImageMetadata"/>
<allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Manager"
send_member="GetImageMetadataWithExtensions"/>
<allow send_destination="org.freedesktop.portable1" <allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Manager" send_interface="org.freedesktop.portable1.Manager"
send_member="GetImageState"/> send_member="GetImageState"/>
<allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Manager"
send_member="GetImageStateWithExtensions"/>
<allow send_destination="org.freedesktop.portable1" <allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Manager" send_interface="org.freedesktop.portable1.Manager"
send_member="AttachImage"/> send_member="AttachImage"/>
<allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Manager"
send_member="AttachImageWithExtensions"/>
<allow send_destination="org.freedesktop.portable1" <allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Manager" send_interface="org.freedesktop.portable1.Manager"
send_member="DetachImage"/> send_member="DetachImage"/>
@ -77,10 +65,6 @@
send_interface="org.freedesktop.portable1.Manager" send_interface="org.freedesktop.portable1.Manager"
send_member="ReattachImage"/> send_member="ReattachImage"/>
<allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Manager"
send_member="ReattachImageWithExtensions"/>
<allow send_destination="org.freedesktop.portable1" <allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Manager" send_interface="org.freedesktop.portable1.Manager"
send_member="RemoveImage"/> send_member="RemoveImage"/>
@ -107,42 +91,22 @@
send_interface="org.freedesktop.portable1.Image" send_interface="org.freedesktop.portable1.Image"
send_member="GetMetadata"/> send_member="GetMetadata"/>
<allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image"
send_member="GetMetadataWithExtensions"/>
<allow send_destination="org.freedesktop.portable1" <allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image" send_interface="org.freedesktop.portable1.Image"
send_member="GetState"/> send_member="GetState"/>
<allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image"
send_member="GetStateWithExtensions"/>
<allow send_destination="org.freedesktop.portable1" <allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image" send_interface="org.freedesktop.portable1.Image"
send_member="Attach"/> send_member="Attach"/>
<allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image"
send_member="AttachWithExtensions"/>
<allow send_destination="org.freedesktop.portable1" <allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image" send_interface="org.freedesktop.portable1.Image"
send_member="Detach"/> send_member="Detach"/>
<allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image"
send_member="DetachWithExtensions"/>
<allow send_destination="org.freedesktop.portable1" <allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image" send_interface="org.freedesktop.portable1.Image"
send_member="Reattach"/> send_member="Reattach"/>
<allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image"
send_member="ReattachWithExtensions"/>
<allow send_destination="org.freedesktop.portable1" <allow send_destination="org.freedesktop.portable1"
send_interface="org.freedesktop.portable1.Image" send_interface="org.freedesktop.portable1.Image"
send_member="Remove"/> send_member="Remove"/>

View File

@ -283,7 +283,7 @@ static int verify_fsroot_dir(
r = path_extract_filename(path, &f); r = path_extract_filename(path, &f);
if (r < 0 && r != -EADDRNOTAVAIL) if (r < 0 && r != -EADDRNOTAVAIL)
return log_error_errno(r, "Failed to extract filename of \"%s\": %m", path); return log_error_errno(r, "Failed to extract filename of %s: %m", path);
if (statx(dir_fd, strempty(f), if (statx(dir_fd, strempty(f),
AT_SYMLINK_NOFOLLOW|(isempty(f) ? AT_EMPTY_PATH : 0), AT_SYMLINK_NOFOLLOW|(isempty(f) ? AT_EMPTY_PATH : 0),
@ -292,8 +292,7 @@ static int verify_fsroot_dir(
(unprivileged_mode && ERRNO_IS_PRIVILEGE(errno)) ? LOG_DEBUG : LOG_ERR, errno, (unprivileged_mode && ERRNO_IS_PRIVILEGE(errno)) ? LOG_DEBUG : LOG_ERR, errno,
"Failed to determine block device node of \"%s\": %m", path); "Failed to determine block device node of \"%s\": %m", path);
if (!S_ISDIR(sxa.stx_mode)) assert(S_ISDIR(sxa.stx_mode)); /* We used O_DIRECTORY above, when opening, so this must hold */
return log_error_errno(SYNTHETIC_ERRNO(ENOTDIR), "Path \"%s\" is not a directory", path);
if (FLAGS_SET(sxa.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT)) { if (FLAGS_SET(sxa.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT)) {
@ -376,13 +375,13 @@ static int verify_esp(
r = path_extract_filename(p, &f); r = path_extract_filename(p, &f);
if (r < 0 && r != -EADDRNOTAVAIL) if (r < 0 && r != -EADDRNOTAVAIL)
return log_error_errno(r, "Failed to extract filename of \"%s\": %m", p); return log_error_errno(r, "Failed to extract filename of %s: %m", p);
/* Trigger any automounts so that xstatfsat() operates on the mount instead of the mountpoint /* Trigger any automounts so that xstatfsat() operates on the mount instead of the mountpoint
* directory. */ * directory. */
r = trigger_automount_at(pfd, f); r = trigger_automount_at(pfd, f);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to trigger automount at \"%s\": %m", p); return log_error_errno(r, "Failed to trigger automount at %s: %m", p);
r = xstatfsat(pfd, strempty(f), &sfs); r = xstatfsat(pfd, strempty(f), &sfs);
if (r < 0) if (r < 0)
@ -482,12 +481,12 @@ int find_esp_and_warn_at(
if (!path_is_valid(path) || !path_is_absolute(path)) if (!path_is_valid(path) || !path_is_absolute(path))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"$SYSTEMD_ESP_PATH does not refer to an absolute path, refusing to use it: \"%s\"", "$SYSTEMD_ESP_PATH does not refer to an absolute path, refusing to use it: %s",
path); path);
r = chaseat(rfd, path, CHASE_AT_RESOLVE_IN_ROOT|CHASE_TRIGGER_AUTOFS, &p, &fd); r = chaseat(rfd, path, CHASE_AT_RESOLVE_IN_ROOT|CHASE_TRIGGER_AUTOFS, &p, &fd);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to resolve path \"%s\": %m", path); return log_error_errno(r, "Failed to resolve path %s: %m", path);
/* Note: when the user explicitly configured things with an env var we won't validate the /* Note: when the user explicitly configured things with an env var we won't validate the
* path beyond checking it refers to a directory. After all we want this to be useful for * path beyond checking it refers to a directory. After all we want this to be useful for
@ -834,12 +833,12 @@ int find_xbootldr_and_warn_at(
if (!path_is_valid(path) || !path_is_absolute(path)) if (!path_is_valid(path) || !path_is_absolute(path))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"$SYSTEMD_XBOOTLDR_PATH does not refer to an absolute path, refusing to use it: \"%s\"", "$SYSTEMD_XBOOTLDR_PATH does not refer to an absolute path, refusing to use it: %s",
path); path);
r = chaseat(rfd, path, CHASE_AT_RESOLVE_IN_ROOT|CHASE_TRIGGER_AUTOFS, &p, &fd); r = chaseat(rfd, path, CHASE_AT_RESOLVE_IN_ROOT|CHASE_TRIGGER_AUTOFS, &p, &fd);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to resolve path \"%s\": %m", p); return log_error_errno(r, "Failed to resolve path %s: %m", p);
if (fstat(fd, &st) < 0) if (fstat(fd, &st) < 0)
return log_error_errno(errno, "Failed to stat '%s': %m", p); return log_error_errno(errno, "Failed to stat '%s': %m", p);

View File

@ -198,11 +198,6 @@ def get_zboot_kernel(f: IO[bytes]) -> bytes:
elif comp_type.startswith(b'xzkern'): elif comp_type.startswith(b'xzkern'):
raise NotImplementedError('xzkern decompression not implemented') raise NotImplementedError('xzkern decompression not implemented')
elif comp_type.startswith(b'zstd'): elif comp_type.startswith(b'zstd'):
try:
zstd = try_import('compression.zstd')
data = f.read(size)
return cast(bytes, zstd.zstd.ZstdDecompressor().decompress(data))
except ValueError:
zstd = try_import('zstandard') zstd = try_import('zstandard')
data = f.read(size) data = f.read(size)
return cast(bytes, zstd.ZstdDecompressor().stream_reader(data).read()) return cast(bytes, zstd.ZstdDecompressor().stream_reader(data).read())
@ -235,10 +230,6 @@ def maybe_decompress(filename: Union[str, Path]) -> bytes:
return cast(bytes, gzip.open(f).read()) return cast(bytes, gzip.open(f).read())
if start.startswith(b'\x28\xb5\x2f\xfd'): if start.startswith(b'\x28\xb5\x2f\xfd'):
try:
zstd = try_import('compression.zstd')
return cast(bytes, zstd.zstd.ZstdDecompressor().decompress(f.read()))
except ValueError:
zstd = try_import('zstandard') zstd = try_import('zstandard')
return cast(bytes, zstd.ZstdDecompressor().stream_reader(f.read()).read()) return cast(bytes, zstd.ZstdDecompressor().stream_reader(f.read()).read())

View File

@ -70,7 +70,7 @@ testcase_user_manager() {
} }
testcase_multiple_features() { testcase_multiple_features() {
unsquashfs -force -no-xattrs -d /tmp/TEST-07-PID1-delegate-namespaces-root /usr/share/minimal_0.raw unsquashfs -no-xattrs -d /tmp/TEST-07-PID1-delegate-namespaces-root /usr/share/minimal_0.raw
systemd-run \ systemd-run \
-p PrivatePIDs=yes \ -p PrivatePIDs=yes \

View File

@ -90,7 +90,7 @@ EOF
} }
testcase_multiple_features() { testcase_multiple_features() {
unsquashfs -force -no-xattrs -d /tmp/TEST-07-PID1-private-pids-root /usr/share/minimal_0.raw unsquashfs -no-xattrs -d /tmp/TEST-07-PID1-private-pids-root /usr/share/minimal_0.raw
systemd-run \ systemd-run \
-p PrivatePIDs=yes \ -p PrivatePIDs=yes \

View File

@ -17,8 +17,8 @@ if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then
ARGS+=(--profile=trusted) ARGS+=(--profile=trusted)
fi fi
unsquashfs -force -no-xattrs -d /tmp/minimal_0 /usr/share/minimal_0.raw unsquashfs -no-xattrs -d /tmp/minimal_0 /usr/share/minimal_0.raw
unsquashfs -force -no-xattrs -d /tmp/minimal_1 /usr/share/minimal_1.raw unsquashfs -no-xattrs -d /tmp/minimal_1 /usr/share/minimal_1.raw
portablectl "${ARGS[@]}" attach --copy=symlink --now --runtime /tmp/minimal_0 minimal-app0 portablectl "${ARGS[@]}" attach --copy=symlink --now --runtime /tmp/minimal_0 minimal-app0

View File

@ -113,7 +113,7 @@ if sysctl kernel.dmesg_restrict=0; then
dmesg) dmesg)
fi fi
unsquashfs -force -no-xattrs -d /tmp/img /usr/share/minimal_0.raw unsquashfs -no-xattrs -d /tmp/img /usr/share/minimal_0.raw
runas testuser systemd-run --wait --user --unit=test-root-dir \ runas testuser systemd-run --wait --user --unit=test-root-dir \
-p RootDirectory=/tmp/img \ -p RootDirectory=/tmp/img \
grep MARKER=1 /etc/os-release grep MARKER=1 /etc/os-release
@ -128,7 +128,7 @@ umount /tmp/img_bind
# Unprivileged overlayfs was added to Linux 5.11, so try to detect it first # Unprivileged overlayfs was added to Linux 5.11, so try to detect it first
mkdir -p /tmp/a /tmp/b /tmp/c mkdir -p /tmp/a /tmp/b /tmp/c
if unshare --mount --user --map-root-user mount -t overlay overlay /tmp/c -o lowerdir=/tmp/a:/tmp/b; then if unshare --mount --user --map-root-user mount -t overlay overlay /tmp/c -o lowerdir=/tmp/a:/tmp/b; then
unsquashfs -force -no-xattrs -d /tmp/app2 /tmp/app1.raw unsquashfs -no-xattrs -d /tmp/app2 /tmp/app1.raw
runas testuser systemd-run --wait --user --unit=test-extension-dir \ runas testuser systemd-run --wait --user --unit=test-extension-dir \
-p ExtensionDirectories=/tmp/app2 \ -p ExtensionDirectories=/tmp/app2 \
-p TemporaryFileSystem=/run -p RootDirectory=/tmp/img \ -p TemporaryFileSystem=/run -p RootDirectory=/tmp/img \

View File

@ -704,7 +704,7 @@ grep -q -F "MARKER=1" /tmp/markers/50i
systemctl stop testservice-50i.service systemctl stop testservice-50i.service
rm -f /run/systemd/system/testservice-50i.service rm -f /run/systemd/system/testservice-50i.service
unsquashfs -force -no-xattrs -d /tmp/vpickminimg "$MINIMAL_IMAGE.raw" unsquashfs -no-xattrs -d /tmp/vpickminimg "$MINIMAL_IMAGE.raw"
cat >/run/systemd/system/testservice-50j.service <<EOF cat >/run/systemd/system/testservice-50j.service <<EOF
[Service] [Service]
Type=notify-reload Type=notify-reload
@ -903,7 +903,7 @@ systemd-confext status
systemd-confext unmerge systemd-confext unmerge
rm -rf /run/confexts/ rm -rf /run/confexts/
unsquashfs -force -no-xattrs -d /tmp/img "$MINIMAL_IMAGE.raw" unsquashfs -no-xattrs -d /tmp/img "$MINIMAL_IMAGE.raw"
systemd-run --unit=test-root-ephemeral \ systemd-run --unit=test-root-ephemeral \
-p RootDirectory=/tmp/img \ -p RootDirectory=/tmp/img \
-p RootEphemeral=yes \ -p RootEphemeral=yes \
@ -935,7 +935,7 @@ echo "ARCHITECTURE=_any" >>testkit/usr/lib/extension-release.d/extension-release
echo "MARKER_SYSEXT_123" >testkit/usr/lib/testfile echo "MARKER_SYSEXT_123" >testkit/usr/lib/testfile
mksquashfs testkit/ testkit.raw -noappend mksquashfs testkit/ testkit.raw -noappend
cp testkit.raw /run/extensions/ cp testkit.raw /run/extensions/
unsquashfs -force -l /run/extensions/testkit.raw unsquashfs -l /run/extensions/testkit.raw
systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for portable service' systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for portable service'
systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for system' systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for system'
systemd-sysext merge systemd-sysext merge
@ -951,7 +951,7 @@ echo "ARCHITECTURE=_any" >>testjob/etc/extension-release.d/extension-release.tes
echo "MARKER_CONFEXT_123" >testjob/etc/testfile echo "MARKER_CONFEXT_123" >testjob/etc/testfile
mksquashfs testjob/ testjob.raw -noappend mksquashfs testjob/ testjob.raw -noappend
cp testjob.raw /run/confexts/ cp testjob.raw /run/confexts/
unsquashfs -force -l /run/confexts/testjob.raw unsquashfs -l /run/confexts/testjob.raw
systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for system' systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for system'
systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for portable service' systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for portable service'
systemd-confext merge systemd-confext merge

View File

@ -8,7 +8,7 @@ ENABLED="$3"
if ! ((ENABLED)) || ! [[ -d .git ]] || ! command -v git >/dev/null || git describe --tags --exact-match &>/dev/null if ! ((ENABLED)) || ! [[ -d .git ]] || ! command -v git >/dev/null || git describe --tags --exact-match &>/dev/null
then then
sed -e "s/@VCS_TAG@//" "$INPUT" sed "$INPUT" -e "s/@VCS_TAG@//"
exit 0 exit 0
fi fi
@ -20,4 +20,4 @@ fi
TAG="-g$(git describe --abbrev=7 --match="" --always $DIRTY)" TAG="-g$(git describe --abbrev=7 --match="" --always $DIRTY)"
sed -e "s/@VCS_TAG@/$TAG/" "$INPUT" sed "$INPUT" -e "s/@VCS_TAG@/$TAG/"