summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaanya Goenka <maanyagoenka@microsoft.com>2024-09-09 18:25:32 +0200
committerLennart Poettering <lennart@poettering.net>2024-09-11 06:44:38 +0200
commit25d1b968802fa181c4f1a37c69e27090cf6b60ad (patch)
tree516a341093fcbe965493fd6730dcbbf320426519 /src
parenttmpfiles: add separate fragment for stuff we copy from .extra/ into /run/systemd (diff)
downloadsystemd-25d1b968802fa181c4f1a37c69e27090cf6b60ad.tar.xz
systemd-25d1b968802fa181c4f1a37c69e27090cf6b60ad.zip
src/sysext: Use versioned names when logging extensions used for merge operation
If this is not done, and there are two images, image_1.raw and image_2.raw under an image.raw.v folder, then the log will say "Using extensions image" instead of using "Using extensions image_2.raw" which is the desired behavior for v-picked extensions.
Diffstat (limited to 'src')
-rw-r--r--src/sysext/sysext.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c
index c696daad0d..b40f5b7b47 100644
--- a/src/sysext/sysext.c
+++ b/src/sysext/sysext.c
@@ -1476,8 +1476,8 @@ static int merge_subprocess(
Hashmap *images,
const char *workspace) {
- _cleanup_free_ char *host_os_release_id = NULL, *host_os_release_version_id = NULL, *host_os_release_api_level = NULL, *buf = NULL;
- _cleanup_strv_free_ char **extensions = NULL, **paths = NULL;
+ _cleanup_free_ char *host_os_release_id = NULL, *host_os_release_version_id = NULL, *host_os_release_api_level = NULL, *buf = NULL, *filename = NULL;
+ _cleanup_strv_free_ char **extensions = NULL, **extensions_v = NULL, **paths = NULL;
size_t n_extensions = 0;
unsigned n_ignored = 0;
Image *img;
@@ -1658,6 +1658,17 @@ static int merge_subprocess(
if (r < 0)
return log_oom();
+ /* Also get the absolute file name with version info for logging. */
+ r = path_extract_filename(img->path, &filename);
+ if (r == -ENOMEM)
+ return log_oom();
+ if (r < 0)
+ return log_error_errno(r, "Failed to extract filename from '%s': %m", img->path);
+
+ r = strv_extend(&extensions_v, filename);
+ if (r < 0)
+ return log_oom();
+
n_extensions++;
}
@@ -1672,8 +1683,9 @@ static int merge_subprocess(
/* Order by version sort with strverscmp_improved() */
typesafe_qsort(extensions, n_extensions, strverscmp_improvedp);
+ typesafe_qsort(extensions_v, n_extensions, strverscmp_improvedp);
- buf = strv_join(extensions, "', '");
+ buf = strv_join(extensions_v, "', '");
if (!buf)
return log_oom();