Bug#864701: grub-common: grub-mkrescue does nothing, successfully

Thomas Schmitt scdbackup at gmx.net
Tue Jun 13 17:15:14 UTC 2017


Hi,

> grub-mkrescue -o asdf asdf
> asdf does not exist

I assume this yields a xorriso error message
  xorriso : FAILURE : Cannot determine attributes of source file '.../asdf' : No such file or directory
  ...
  xorriso : aborting : -abort_on 'FAILURE' encountered 'FAILURE'

(at least for me it does).

A xorriso run which aborts due to missing input file is supposed to exit
with value 5:
  $ xorriso -as mkisofs -o output.iso asdf
  ...
  xorriso : FAILURE : Cannot determine attributes of source file '/home/thomas/test_dir/asdf' : No such file or directory
  xorriso : aborting : -abort_on 'FAILURE' encountered 'FAILURE'
  $ echo $?
  5
  $

So grub-mkrescue seems to drop the exit value when it runs xorriso
  https://sources.debian.net/src/grub2/2.02%7Ebeta3-5/util/grub-mkrescue.c/#L965

  grub_util_exec ((const char *const *)xorriso_argv);

I understand that function grub_util_exec() is implementied by
grub_util_exec_redirect_all() in
  https://sources.debian.net/src/grub2/2.02%7Ebeta3-5/grub-core/osdep/unix/exec.c/#L37
It looks like this function returns the xorriso exit value
    return WEXITSTATUS (status);
But the return value of grub_util_exec() is ignored in grub-mkrescue.c

Let's have a look at the old shell script
  http://git.savannah.gnu.org/cgit/grub.git/tree/util/grub-mkrescue.in?h=2.00#n371
has
  "${xorriso}" -as mkisofs ... ${source}
  ...
  exit 0
which is supposed to emit exit value 0 unconditionally.

So the problem seems old and not to be a regression by the rewrite of
grub-mkrescue in C.
I guess one would have to discuss on grub-devel mailing list
whether grub-mkrescue shall forward a non-zero exit value of xorriso.

Have a nice day :)

Thomas



More information about the Pkg-grub-devel mailing list