nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0260-grub_fs_probe-dprint-errors-from-filesystems.patch

b35c50
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b35c50
From: Robbie Harwood <rharwood@redhat.com>
b35c50
Date: Fri, 15 Jul 2022 15:39:41 -0400
b35c50
Subject: [PATCH] grub_fs_probe(): dprint errors from filesystems
b35c50
b35c50
When filesystem detection fails, all that's currently debug-logged is a
b35c50
series of messages like:
b35c50
b35c50
    grub-core/kern/fs.c:56:fs: Detecting ntfs...
b35c50
    grub-core/kern/fs.c:76:fs: ntfs detection failed.
b35c50
b35c50
repeated for each filesystem.  Any messages provided to grub_error() by
b35c50
the filesystem are lost, and one has to break out gdb to figure out what
b35c50
went wrong.
b35c50
b35c50
With this change, one instead sees:
b35c50
b35c50
    grub-core/kern/fs.c:56:fs: Detecting fat...
b35c50
    grub-core/osdep/hostdisk.c:357:hostdisk: reusing open device
b35c50
    `/path/to/device'
b35c50
    grub-core/kern/fs.c:77:fs: error: invalid modification timestamp for /.
b35c50
    grub-core/kern/fs.c:79:fs: fat detection failed.
b35c50
b35c50
in the debug prints.
b35c50
b35c50
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
b35c50
(cherry picked from commit 838c79d658797d0662ee7f9e033e38ee88059e02)
b35c50
---
b35c50
 grub-core/kern/fs.c | 1 +
b35c50
 1 file changed, 1 insertion(+)
b35c50
b35c50
diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c
b35c50
index c698295bcb..b58e2ae1d2 100644
b35c50
--- a/grub-core/kern/fs.c
b35c50
+++ b/grub-core/kern/fs.c
b35c50
@@ -74,6 +74,7 @@ grub_fs_probe (grub_device_t device)
b35c50
 	  if (grub_errno == GRUB_ERR_NONE)
b35c50
 	    return p;
b35c50
 
b35c50
+	  grub_dprintf ("fs", _("error: %s.\n"), grub_errmsg);
b35c50
 	  grub_error_push ();
b35c50
 	  grub_dprintf ("fs", "%s detection failed.\n", p->name);
b35c50
 	  grub_error_pop ();