mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-12-01 00:48:18 +00:00
Fix error messages wrongly being printed when executing blscfg command
Resolves: rhbz#1699761 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
f52f8fe0ab
commit
4c3c0c390f
4 changed files with 79 additions and 1 deletions
|
@ -0,0 +1,27 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
Date: Tue, 14 May 2019 20:37:44 +0200
|
||||||
|
Subject: [PATCH] Remove bogus load_env after blscfg command in 10_linux
|
||||||
|
|
||||||
|
The grubenv is already loaded in the 00_header snippet, so there's
|
||||||
|
no need to load it anywhere else.
|
||||||
|
|
||||||
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
---
|
||||||
|
util/grub.d/10_linux.in | 3 ---
|
||||||
|
1 file changed, 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||||
|
index 8f7ecf65df9..350903fa5ab 100644
|
||||||
|
--- a/util/grub.d/10_linux.in
|
||||||
|
+++ b/util/grub.d/10_linux.in
|
||||||
|
@@ -162,9 +162,6 @@ set default_kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
||||||
|
|
||||||
|
insmod blscfg
|
||||||
|
blscfg
|
||||||
|
-if [ -s \$prefix/grubenv ]; then
|
||||||
|
- load_env
|
||||||
|
-fi
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
|
|
@ -0,0 +1,44 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
Date: Wed, 15 May 2019 01:46:00 +0200
|
||||||
|
Subject: [PATCH] blscfg: Don't leave grub_errno set to an error if the command
|
||||||
|
succeeded
|
||||||
|
|
||||||
|
After a command is executed, the function grub_print_error() is called to
|
||||||
|
print any active error messages if these exist.
|
||||||
|
|
||||||
|
The blscfg command calls to the grub_strtol() function to try to convert
|
||||||
|
the default entry string to a number, in case the default is an index.
|
||||||
|
|
||||||
|
If this function is not able to do the conversion, it sets the grub_errno
|
||||||
|
variable to GRUB_ERR_BAD_NUMBER. But the blscfg command wrongly left that
|
||||||
|
set and so the caller would be confused thinking that the command failed
|
||||||
|
and that an error message has to be printed.
|
||||||
|
|
||||||
|
This caused the first error in the stack to be printed, polluting the GRUB
|
||||||
|
output and preventing the menu to be hidden. So reset the grub_error var
|
||||||
|
to GRUB_ERR_NONE again if was set to GRUB_ERR_BAD_NUMBER by grub_strtol().
|
||||||
|
|
||||||
|
Resolves: rhbz#1699761
|
||||||
|
|
||||||
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
---
|
||||||
|
grub-core/commands/blscfg.c | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||||
|
index bd008b04bec..26dbe873fe4 100644
|
||||||
|
--- a/grub-core/commands/blscfg.c
|
||||||
|
+++ b/grub-core/commands/blscfg.c
|
||||||
|
@@ -999,8 +999,10 @@ is_default_entry(const char *def_entry, struct bls_entry *entry, int idx)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
def_idx = (int)grub_strtol(def_entry, NULL, 0);
|
||||||
|
- if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||||
|
+ if (grub_errno == GRUB_ERR_BAD_NUMBER) {
|
||||||
|
+ grub_errno = GRUB_ERR_NONE;
|
||||||
|
return false;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (def_idx == idx)
|
||||||
|
return true;
|
|
@ -290,3 +290,5 @@ Patch0289: 0289-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch
|
||||||
Patch0290: 0290-HTTP-boot-strncmp-returns-0-on-equal.patch
|
Patch0290: 0290-HTTP-boot-strncmp-returns-0-on-equal.patch
|
||||||
Patch0291: 0291-Add-10_reset_boot_success-to-Makefile.patch
|
Patch0291: 0291-Add-10_reset_boot_success-to-Makefile.patch
|
||||||
Patch0292: 0292-blscfg-remove-BLS-file-size-check.patch
|
Patch0292: 0292-blscfg-remove-BLS-file-size-check.patch
|
||||||
|
Patch0293: 0293-Remove-bogus-load_env-after-blscfg-command-in-10_lin.patch
|
||||||
|
Patch0294: 0294-blscfg-Don-t-leave-grub_errno-set-to-an-error-if-the.patch
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
Name: grub2
|
Name: grub2
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 2.02
|
Version: 2.02
|
||||||
Release: 79%{?dist}
|
Release: 80%{?dist}
|
||||||
Summary: Bootloader with support for Linux, Multiboot and more
|
Summary: Bootloader with support for Linux, Multiboot and more
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: http://www.gnu.org/software/grub/
|
URL: http://www.gnu.org/software/grub/
|
||||||
|
@ -476,6 +476,11 @@ rm -r /boot/grub2.tmp/ || :
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed May 15 2019 Javier Martinez Canillas <javierm@redhat.com> - 2.02-80
|
||||||
|
- Fix error messages wrongly being printed when executing blscfg command
|
||||||
|
Resolves: rhbz#1699761
|
||||||
|
- Remove bogus load_env after blscfg command in 10_linux
|
||||||
|
|
||||||
* Tue May 07 2019 Javier Martinez Canillas <javierm@redhat.com> - 2.02-79
|
* Tue May 07 2019 Javier Martinez Canillas <javierm@redhat.com> - 2.02-79
|
||||||
- Make blscfg module compatible at least up to the Fedora 19 GRUB core
|
- Make blscfg module compatible at least up to the Fedora 19 GRUB core
|
||||||
Related: rhbz#1652806
|
Related: rhbz#1652806
|
||||||
|
|
Loading…
Reference in a new issue