grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/2] grub-fstest: Show error message if command causes grub_errno


From: Thomas Schmitt
Subject: [PATCH 0/2] grub-fstest: Show error message if command causes grub_errno
Date: Thu, 20 Jun 2024 22:05:02 +0200

Most return values of function execute_command() are ignored in
util/grub-fstest.c. Only one of two "loopback" occasions and the command
"cryptomount" care. They perform grub_util_error() if the return value
is non-zero.
So there seems to be a general lack of handling of problems found in the
drivers or command implementations.

On the other hand, all tests which use grub-fstest are accustomed to this
silence about problems. Internal processing of grub-fstest does possibly
important things after an error occurs and before the program ends. It
seems inappropriate to immediately bail out when execute_command()
encounters grub_errno != GRUB_ERROR_NONE.

So i propose a patch which just counts the occurences of grub_errno in
execute_command(), reports grub_errmsg, and resets grub_errno.
Processing goes on as is tradition. But at the end of the program, a
non-zero error count causes a non-zero exit value.
Example:
  $ gunzip <tests/iso9660_ce_loop2.iso.gz >/tmp/iso9660_ce_loop2.iso
  $ ./grub-fstest /tmp/iso9660_ce_loop2.iso ls /
  ls : GRUB error 9 with message 'suspecting endless CE loop'
  ./grub-fstest: error: encountered 1 error during command execution.
  $ echo $?
  1

(I will submit an addon patch which changes the grub_errno display to
  ls : GRUB_ERR_BAD_FS with message 'suspecting endless CE loop'
by adding a new function grub_errno_to_name() to err.[ch].)

A new program option -E re-activates the current behavior.
I.e. it disables counting, reporting, and non-zero exit caused by
grub_errno.

After installing help2man and running ./configure i get from "make" a file
grub-fstest.1 which mentions the new option. (I fail to find file
grub-fstest.info which is promised by the text in grub-fstest.1.
Package texinfo is installed.)

I duely checked the impact of this change on "make check:

Installed are the Debian 12 packages which INSTALL prescribes.
"make check" was run as superuser with the old and the new version of
grub-fstest. Then i compared the outputs about PASS and FAIL.

The only test which newly failed is iso9660_ce_loop in
tests/iso9660_test.in because it takes non-zero exit as indication of
timeout, but will now regularly receive non-zero because
iso9660_ce_loop.iso is intentionally bad.
So patch 2/2 adds -E to the run of grub-fstest with iso9660_ce_loop.
This makes tests/iso9660_test PASS again.

4 tests yielded SKIP due to my platform "efi" and target "x86_64":
  tests/fddboot_test.in
  tests/netboot_test.in
  tests/pseries_test.in
  tests/core_compress_test.in
They are small and i can see no reference to grub-fstest in them.

6 tests yielded FAIL with both versions of grub-fstest. They seem
unrelated to grub-fstest:

- erofs_test says:
    mkfs.erofs -Eforce-inode-compact -L g;/éт 莭😁 /tmp/grub-fs-tester.2024062018
0702880665192.erofs_compact.XeJ/erofs_compact_512_4096_1_0.img 
/tmp/grub-fs-tester.20240620180702880665192.erofs_compact.XeJ/master
    mkfs.erofs: invalid option -- 'L'
  The test seems to expect something other than erofs-utils_1.5-1_amd64.deb
  of Debian 12.

- exfat_test shows the help text of mkfs.exfat. In grub-fs-tester i see
    x"exfat")
        "mkfs.$fs" -s $((BLKSIZE/512)) -n "$FSLABEL" "${MOUNTDEVICE}"
  But mkfs.exfat has neither option -s nor -n in help text or man page.
  mkexfatfs offers: -n volume-name -s sectors-per-cluster

- hfs_test says:
    LABEL FAIL
    Device loop0: Filesystem type hfs - Label `untitled' ...
  grub-fs-tester does:
    FSLABEL="grub_t;/estéàèèéie fiucnree";;
    "mkfs.hfs" -b $BLKSIZE -v "`echo $FSLABEL |recode utf8..macroman`" -h 
"${MOUNTDEVICE}"
  man mkfs.hfs shows man newfs_hfs, where -v is mentioned as:
    -v volume-name
           Volume name (file system name) in ascii or UTF-8 format.
  (Was already so in Debian 11.)
  So the recode filter seems unneeded and unhelpful.

- luks1_test says:
    ./grub-probe: error: disk 
`lvm/grub-fs-tester.20230401111443076506440.luks1.PDo' not found.
    UUID FAIL
    96efa19ce89c41279912b6a3b26a99d3

- luks2_test says:
    ./grub-probe: error: disk 
`lvm/grub-fs-tester.20230401111450278223161.luks2.NWP' not found.
    UUID FAIL
    8a1f1e83695d4dd1b6b73fcb542b73da

- grub_func_test reports checksum problems
    tests/video_checksum.c:checksum:615: assert failed: 0 Checksum 
cmdline_cat_2560x1440xrgba8888:44 failed: 0x62031fea vs 0x8071678a

-----------------------------------------------------------------------

Thomas Schmitt (2):
  grub-fstest: Show error message if command causes grub_errno
  tests: Use new grub-fstest option -E with iso9660_ce_loop test

 tests/iso9660_test.in |  2 +-
 util/grub-fstest.c    | 30 +++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

--
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]