portable: honor --force for directory extensions
Pass relax_extension_release_check through the directory extraction
path instead of hardcoding false. Directory extensions now honor the
same --force relaxation as dissected images.
Reproducer:
cp -a /tmp/app0 /tmp/app10
sudo portablectl attach --force --runtime \
--extension /tmp/app10 /tmp/rootdir app0
Before:
directory image extraction always used strict extension-release name
checks. --force relaxed other extension paths but still rejected a
renamed directory extension with matching metadata.
Follow-up: 06768b90a3
This commit is contained in:
@@ -541,7 +541,7 @@ static int portable_extract_by_path(
|
||||
matches,
|
||||
image_name,
|
||||
path_is_extension,
|
||||
/* relax_extension_release_check= */ false,
|
||||
relax_extension_release_check,
|
||||
seq[1],
|
||||
/* ret_os_release= */ NULL,
|
||||
/* ret_unit_files= */ NULL);
|
||||
@@ -571,7 +571,7 @@ static int portable_extract_by_path(
|
||||
matches,
|
||||
image_name,
|
||||
path_is_extension,
|
||||
/* relax_extension_release_check= */ false,
|
||||
relax_extension_release_check,
|
||||
/* socket_fd= */ -EBADF,
|
||||
&os_release,
|
||||
&unit_files);
|
||||
|
||||
@@ -157,6 +157,13 @@ grep -q -F "ExtensionDirectories=" /run/systemd/system.attached/app0.service.d/2
|
||||
|
||||
portablectl detach --now --runtime --extension /tmp/app0 /tmp/rootdir app0
|
||||
|
||||
rm -rf /tmp/app10
|
||||
cp -a /tmp/app0 /tmp/app10
|
||||
portablectl "${ARGS[@]}" attach --force --copy=symlink --runtime --extension /tmp/app10 /tmp/rootdir app0
|
||||
portablectl inspect --force --cat --extension /tmp/app10 /tmp/rootdir app0 | grep -f /tmp/app10/usr/lib/extension-release.d/extension-release.app0 >/dev/null
|
||||
portablectl detach --runtime --extension /tmp/app10 /tmp/rootdir app0
|
||||
rm -rf /tmp/app10
|
||||
|
||||
# Attempt to disable the app unit during detaching. Requires --copy=symlink to reproduce.
|
||||
# Provides coverage for https://github.com/systemd/systemd/issues/23481
|
||||
portablectl "${ARGS[@]}" attach --copy=symlink --now --runtime /tmp/rootdir minimal-app0
|
||||
|
||||
Reference in New Issue
Block a user