From: Jan Janssen Date: Sat, 3 Sep 2022 21:07:44 +0000 (+0200) Subject: bootctl: Also display the root for entry paths X-Git-Tag: v253-rc1~518^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7851732262ec94f50598c4a289589a6ddb97ebfd;p=thirdparty%2Fsystemd.git bootctl: Also display the root for entry paths People apparently expect the bootloader to magically know the userspace filesystem tree and get confused when boot files aren't found because of this. Printing the root of entry paths will hopefully make it easier for people to understand a bad configuration. To hopefully make it clear that the prefix should not be used inside of a config snipped, it is greyed out and uses an extra path separator: /root//boot/loader/path --- diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 6a34b10c044..b88d42fdc18 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -726,7 +726,7 @@ static int boot_entry_load_unified( if (!tmp.root) return log_oom(); - tmp.kernel = strdup(skip_leading_chars(k, "/")); + tmp.kernel = path_make_absolute(k, "/"); if (!tmp.kernel) return log_oom(); @@ -1278,7 +1278,11 @@ static void boot_entry_file_list( int status = chase_symlinks_and_access(p, root, CHASE_PREFIX_ROOT, F_OK, NULL, NULL); - printf("%13s%s ", strempty(field), field ? ":" : " "); + /* Note that this shows two '/' between the root and the file. This is intentional to highlight (in + * the abscence of color support) to the user that the boot loader is only interested in the second + * part of the file. */ + printf("%13s%s %s%s/%s", strempty(field), field ? ":" : " ", ansi_grey(), root, ansi_normal()); + if (status < 0) { errno = -status; printf("%s%s%s (%m)\n", ansi_highlight_red(), p, ansi_normal());