1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-31 14:50:15 +03:00

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.
This commit is contained in:
Maanya Goenka 2024-09-09 16:25:32 +00:00 committed by Lennart Poettering
parent 408ab988db
commit 25d1b96880

View File

@ -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();