Skip to content

Commit 9a6ec1c

Browse files
committed
grub-mkstandalone: reduce sharp edges
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 <[email protected]>
1 parent fa0875a commit 9a6ec1c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

util/grub-mkstandalone.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
112112

113113
struct argp argp = {
114114
options, argp_parser, N_("[OPTION] SOURCE..."),
115-
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"),
115+
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."),
116116
NULL, help_filter, NULL
117117
};
118118

@@ -189,8 +189,10 @@ add_tar_file (const char *from,
189189

190190
COMPILE_TIME_ASSERT (sizeof (hd) == 512);
191191

192-
if (grub_util_is_special_file (from))
193-
return;
192+
if (grub_util_is_special_file (from)) {
193+
grub_util_warn (_("skip: %s is not a regular file"), from);
194+
return;
195+
}
194196

195197
mtime = grub_util_get_mtime (from);
196198

@@ -273,7 +275,7 @@ add_tar_file (const char *from,
273275
compute_checksum (&hd);
274276

275277
fwrite (&hd, 1, sizeof (hd), memdisk);
276-
278+
277279
while (1)
278280
{
279281
r = grub_util_fd_read (in, grub_install_copy_buffer, GRUB_INSTALL_COPY_BUFFER_SIZE);

0 commit comments

Comments
 (0)