Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 992a2e98add398e4c081489d747cd62332ed7e2b Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi@microsoft.com>
Date: Fri, 4 Oct 2019 14:45:41 +0100
Subject: [PATCH] portabled: allow to detach an image with a unit in
linked-runtime state

This is necessary when a directory was attached with
--copy=symlink, otherwise detach will always fail.

Fixed #13725

(cherry picked from commit c3d809ef72db616391a1a2b738eae137f9024e3f)
---
src/portable/portable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/portable/portable.c b/src/portable/portable.c
index eb5daf3b0e..5fd14c70b6 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -1185,7 +1185,7 @@ int portable_detach(
r = unit_file_lookup_state(UNIT_FILE_SYSTEM, &paths, de->d_name, &state);
if (r < 0)
return log_debug_errno(r, "Failed to determine unit file state of '%s': %m", de->d_name);
- if (!IN_SET(state, UNIT_FILE_STATIC, UNIT_FILE_DISABLED, UNIT_FILE_LINKED, UNIT_FILE_RUNTIME))
+ if (!IN_SET(state, UNIT_FILE_STATIC, UNIT_FILE_DISABLED, UNIT_FILE_LINKED, UNIT_FILE_RUNTIME, UNIT_FILE_LINKED_RUNTIME))
return sd_bus_error_setf(error, BUS_ERROR_UNIT_EXISTS, "Unit file '%s' is in state '%s', can't detach.", de->d_name, unit_file_state_to_string(state));

r = unit_file_is_active(bus, de->d_name, error);
--
2.20.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From 1d2d0c4bece89adbbc32abb2f38c0efd9080e1d7 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi@microsoft.com>
Date: Wed, 22 Jan 2020 15:56:24 +0000
Subject: [PATCH] Portabled: fix inspect on image attached as directory

When a portable image is attached as a directory, inspect will fail
as the directory will be symlinked under [/run|/etc]/portables and
chase_symlinks will try to open the resolved link to the full
absolute path of the image under [/run|/etc]/portables/<name>.

(eg: /run/portables/test/home/user/test/etc/os-release)

Resolve the symlink beforehand to fix the issue.

Fixes #14634

(cherry picked from commit a409d1f5c6ba21ce9f7b113da69b98072f77ca16)
---
src/portable/portable.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/portable/portable.c b/src/portable/portable.c
index 3491723aa1..ea6dc51a30 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -373,8 +373,14 @@ static int portable_extract_by_path(
if (r == -EISDIR) {
/* We can't turn this into a loop-back block device, and this returns EISDIR? Then this is a directory
* tree and not a raw device. It's easy then. */
+ /* Resolve the link to the directory tree. If it's a symlink, chase_symlink of path + "/etc/os-release"
+ * as called by open_os_release will fail (see: #14634). */
+ _cleanup_free_ char *path_resolve = NULL;

- r = extract_now(path, matches, -1, &os_release, &unit_files);
+ r = chase_symlinks(path, "/", CHASE_PREFIX_ROOT, &path_resolve);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to resolve image directory path %s: %m", path);
+ r = extract_now(path_resolve, matches, -1, &os_release, &unit_files);
if (r < 0)
return r;

--
2.20.1

Loading