Skip to content

Commit

Permalink
grub-mkstandalone: reduce sharp edges
Browse files Browse the repository at this point in the history
It is a major foot gun that grub-mkstandalone silently drops files.
As a first step, we can improve documentation and add warn messages.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
  • Loading branch information
phip1611 committed Nov 29, 2023
1 parent fa0875a commit 0c0c9d7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions util/grub-mkstandalone.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ argp_parser (int key, char *arg, struct argp_state *state)

struct argp argp = {
options, argp_parser, N_("[OPTION] SOURCE..."),
N_("Generate a standalone image (containing all modules) in the selected format")"\v"N_("Graft point syntax (E.g. /boot/grub/grub.cfg=./grub.cfg) is accepted"),
N_("Generate a standalone image (containing all modules) in the selected format")"\v"N_("Graft point syntax (E.g. /boot/grub/grub.cfg=./grub.cfg) is accepted. The path on the right must point to a regular file."),
NULL, help_filter, NULL
};

Expand Down Expand Up @@ -189,8 +189,10 @@ add_tar_file (const char *from,

COMPILE_TIME_ASSERT (sizeof (hd) == 512);

if (grub_util_is_special_file (from))
return;
if (grub_util_is_special_file (from)) {
grub_util_warn (_("skip: %s is not a regular file"), from);
return;
}

mtime = grub_util_get_mtime (from);

Expand Down Expand Up @@ -273,7 +275,7 @@ add_tar_file (const char *from,
compute_checksum (&hd);

fwrite (&hd, 1, sizeof (hd), memdisk);

while (1)
{
r = grub_util_fd_read (in, grub_install_copy_buffer, GRUB_INSTALL_COPY_BUFFER_SIZE);
Expand Down

0 comments on commit 0c0c9d7

Please sign in to comment.