From e3a408a5213b41654d0802bed80fb261d685d7de Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 13 Feb 2019 13:16:17 +0100 Subject: [PATCH] A couple of fixes Don't make grub_strtoull() print an error if no conversion is performed Resolves: rhbz#1674512 Set blsdir if the BLS directory path isn't one of the looked up by default Resolves: rhbz#1657240 Signed-off-by: Javier Martinez Canillas --- ...rt-for-prepend-early-initrds-to-the-.patch | 16 ++---- ...strtoull-print-an-error-if-no-conver.patch | 31 +++++++++++ ...e-BLS-directory-path-isn-t-one-of-th.patch | 51 +++++++++++++++++++ grub.patches | 2 + grub2.spec | 8 ++- 5 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 0281-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch create mode 100644 0282-Set-blsdir-if-the-BLS-directory-path-isn-t-one-of-th.patch diff --git a/0278-blscfg-add-support-for-prepend-early-initrds-to-the-.patch b/0278-blscfg-add-support-for-prepend-early-initrds-to-the-.patch index 77ea562..6d40390 100644 --- a/0278-blscfg-add-support-for-prepend-early-initrds-to-the-.patch +++ b/0278-blscfg-add-support-for-prepend-early-initrds-to-the-.patch @@ -14,13 +14,13 @@ and use that value to set the early_initrd var when running grub2-mkconfig. Signed-off-by: Javier Martinez Canillas --- - grub-core/commands/blscfg.c | 80 +++++++++++++++++++++++++++++++++++++++++++-- + grub-core/commands/blscfg.c | 79 +++++++++++++++++++++++++++++++++++++++++++-- util/grub.d/10_linux.in | 3 ++ util/grub.d/10_linux_bls.in | 3 ++ - 3 files changed, 84 insertions(+), 2 deletions(-) + 3 files changed, 83 insertions(+), 2 deletions(-) diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index aa5bf0d3220..5dcd68b401e 100644 +index aa5bf0d3220..1ef2ae06cff 100644 --- a/grub-core/commands/blscfg.c +++ b/grub-core/commands/blscfg.c @@ -660,6 +660,33 @@ static char *expand_val(char *value) @@ -116,7 +116,7 @@ index aa5bf0d3220..5dcd68b401e 100644 for (i = 0; initrds != NULL && initrds[i] != NULL; i++) initrd_size += sizeof (" " GRUB_BOOT_DEVICE) \ + grub_strlen (initrds[i]) + 1; -@@ -736,12 +800,22 @@ static void create_entry (struct bls_entry *entry) +@@ -736,7 +800,16 @@ static void create_entry (struct bls_entry *entry) } @@ -134,13 +134,7 @@ index aa5bf0d3220..5dcd68b401e 100644 for (i = 0; initrds != NULL && initrds[i] != NULL; i++) { grub_dprintf ("blscfg", "adding initrd %s\n", initrds[i]); - tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); - tmp = grub_stpcpy (tmp, initrds[i]); -+ grub_free(initrds[i]); - } - tmp = grub_stpcpy (tmp, "\n"); - } -@@ -759,6 +833,8 @@ static void create_entry (struct bls_entry *entry) +@@ -759,6 +832,8 @@ static void create_entry (struct bls_entry *entry) finish: grub_free (initrd); diff --git a/0281-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch b/0281-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch new file mode 100644 index 0000000..0dc6a97 --- /dev/null +++ b/0281-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 11 Feb 2019 15:14:10 +0100 +Subject: [PATCH] Don't make grub_strtoull() print an error if no conversion is + performed + +Callers can check if grub_errno was set to GRUB_ERR_BAD_NUMBER, so there's +no need to print an error if a conversion couldn't be performed. This just +pollutes the output with noisy error messages. + +Resolves: rhbz#1674512 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/kern/misc.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index f6eaa7b4df8..2477eb609ba 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -473,8 +473,7 @@ grub_strtoull (const char *str, const char ** const end, int base) + + if (! found) + { +- grub_error (GRUB_ERR_BAD_NUMBER, +- N_("unrecognized number")); ++ grub_errno = GRUB_ERR_BAD_NUMBER; + return 0; + } + diff --git a/0282-Set-blsdir-if-the-BLS-directory-path-isn-t-one-of-th.patch b/0282-Set-blsdir-if-the-BLS-directory-path-isn-t-one-of-th.patch new file mode 100644 index 0000000..4082a1c --- /dev/null +++ b/0282-Set-blsdir-if-the-BLS-directory-path-isn-t-one-of-th.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 12 Feb 2019 00:57:34 +0100 +Subject: [PATCH] Set blsdir if the BLS directory path isn't one of the looked + up by default + +The blscfg command searches for BLS snippets in the /loader/entries and the +/boot/loader/entries directories. If the /boot/loader/entries dir real path +isn't one of these (i.e: if is in a btrfs subvolme), set the blsdir grubenv +variable so the blscfg command will be able to find the BLS config snippets. + +Resolves: rhbz#1657240 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 5 +++++ + util/grub.d/10_linux_bls.in | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 9c240f92625..7e80245a151 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -166,6 +166,11 @@ fi + EOF + + if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then ++ blsdir=$(make_system_path_relative_to_its_root "/boot/loader/entries") ++ if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then ++ ${grub_editenv} - set blsdir="${blsdir}" ++ fi ++ + ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}" + if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then + ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" +diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in +index b14951daf82..f0ad9a3da25 100644 +--- a/util/grub.d/10_linux_bls.in ++++ b/util/grub.d/10_linux_bls.in +@@ -226,6 +226,11 @@ linux_entry () + populate_menu + + if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then ++ blsdir=$(make_system_path_relative_to_its_root "/boot/loader/entries") ++ if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then ++ ${grub_editenv} - set blsdir="${blsdir}" ++ fi ++ + ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}" + if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then + ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" diff --git a/grub.patches b/grub.patches index 801c422..52b3136 100644 --- a/grub.patches +++ b/grub.patches @@ -278,3 +278,5 @@ Patch0277: 0277-blscfg-add-more-options-to-blscfg-command-to-make-it.patch Patch0278: 0278-blscfg-add-support-for-prepend-early-initrds-to-the-.patch Patch0279: 0279-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch Patch0280: 0280-Try-to-set-fPIE-and-friends-on-libgnu.a.patch +Patch0281: 0281-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch +Patch0282: 0282-Set-blsdir-if-the-BLS-directory-path-isn-t-one-of-th.patch diff --git a/grub2.spec b/grub2.spec index 9b243bb..039246f 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 68%{?dist} +Release: 69%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -473,6 +473,12 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Wed Feb 13 2019 Javier Martinez Canillas - 2.02-69 +- Don't make grub_strtoull() print an error if no conversion is performed + Resolves: rhbz#1674512 +- Set blsdir if the BLS directory path isn't one of the looked up by default + Resolves: rhbz#1657240 + * Mon Feb 04 2019 Javier Martinez Canillas - 2.02-68 - Don't build the grub2-efi-ia32-* packages on i686 (pjones) - Add efi-export-env and efi-load-env commands (pjones)