mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03:00
portable: reject root directories without an ID field in os-release
We always require at least ID to be set in os-release, reject and propagate error to the caller instead of asserting later
This commit is contained in:
parent
a2cf73f0b6
commit
7b2e763242
@ -582,6 +582,8 @@ static int extract_image_and_extensions(
|
||||
"PORTABLE_PREFIXES", &prefixes);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (isempty(id))
|
||||
return sd_bus_error_set_errnof(error, SYNTHETIC_ERRNO(ESTALE), "Image %s os-release metadata lacks the ID field", name_or_path);
|
||||
|
||||
if (prefixes) {
|
||||
valid_prefixes = strv_split(prefixes, WHITESPACE);
|
||||
|
@ -152,6 +152,16 @@ umount /tmp/rootdir
|
||||
umount /tmp/app0
|
||||
umount /tmp/app1
|
||||
|
||||
# Lack of ID field in os-release should be rejected, but it caused a crash in the past instead
|
||||
mkdir -p /tmp/emptyroot/usr/lib
|
||||
mkdir -p /tmp/emptyext/usr/lib/extension-release.d
|
||||
touch /tmp/emptyroot/usr/lib/os-release
|
||||
touch /tmp/emptyext/usr/lib/extension-release.d/extension-release.emptyext
|
||||
|
||||
# Remote peer disconnected -> portabled crashed
|
||||
res="$(! portablectl attach --extension /tmp/emptyext /tmp/emptyroot 2> >(grep "Remote peer disconnected"))"
|
||||
test -z "${res}"
|
||||
|
||||
echo OK >/testok
|
||||
|
||||
exit 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user