Accepting request 1080039 from Base:System

OBS-URL: https://build.opensuse.org/request/show/1080039
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=292
This commit is contained in:
Dominique Leuenberger 2023-04-20 13:13:28 +00:00 committed by Git OBS Bridge
commit 99756a291a
5 changed files with 36 additions and 18 deletions

View File

@ -20,13 +20,14 @@ To fix this issue, we have updated the regular expression to properly
handle the encoded comma in the Open Firmware device specifier, ensuring handle the encoded comma in the Open Firmware device specifier, ensuring
that the correct boot device is identified and used. that the correct boot device is identified and used.
v2:
Fix the issue of freeing an uninitialized pointer in early_prep_loadenv.
Signed-off-by: Michael Chang <mchang@suse.com> Signed-off-by: Michael Chang <mchang@suse.com>
--- ---
grub-core/commands/prep_loadenv.c | 108 ++++++++++++++++++++++-------- grub-core/commands/prep_loadenv.c | 108 ++++++++++++++++++++++--------
1 file changed, 79 insertions(+), 29 deletions(-) 1 file changed, 79 insertions(+), 29 deletions(-)
diff --git a/grub-core/commands/prep_loadenv.c b/grub-core/commands/prep_loadenv.c
index de1b95689..c9797c50a 100644
--- a/grub-core/commands/prep_loadenv.c --- a/grub-core/commands/prep_loadenv.c
+++ b/grub-core/commands/prep_loadenv.c +++ b/grub-core/commands/prep_loadenv.c
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
@ -38,7 +39,7 @@ index de1b95689..c9797c50a 100644
{ {
if (match->rm_so != -1) if (match->rm_so != -1)
{ {
@@ -185,24 +185,18 @@ prep_partname (const char *devname, char **prep) @@ -185,24 +185,18 @@
return err; return err;
} }
@ -67,7 +68,7 @@ index de1b95689..c9797c50a 100644
if (ret) if (ret)
goto fail; goto fail;
@@ -210,22 +204,11 @@ boot_disk_prep_partname (char **name) @@ -210,22 +204,11 @@
if (! matches) if (! matches)
goto fail; goto fail;
@ -94,7 +95,7 @@ index de1b95689..c9797c50a 100644
} }
fail: fail:
@@ -235,13 +218,58 @@ boot_disk_prep_partname (char **name) @@ -235,13 +218,60 @@
if (!comperr) if (!comperr)
{ {
regfree (&regex); regfree (&regex);
@ -117,6 +118,8 @@ index de1b95689..c9797c50a 100644
+ grub_size_t nmatch; + grub_size_t nmatch;
+ char *devname = NULL; + char *devname = NULL;
+ +
+ *name = NULL;
+
+ if (varname) + if (varname)
+ cmdpath = grub_env_get (varname); + cmdpath = grub_env_get (varname);
+ else + else
@ -155,7 +158,7 @@ index de1b95689..c9797c50a 100644
} }
static grub_err_t static grub_err_t
@@ -274,13 +302,31 @@ grub_cmd_prep_loadenv (grub_command_t cmd __attribute__ ((unused)), @@ -274,13 +304,31 @@
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
@ -181,24 +184,22 @@ index de1b95689..c9797c50a 100644
early_prep_loadenv (void) early_prep_loadenv (void)
{ {
grub_err_t err; grub_err_t err;
char *prep; - char *prep;
+ char *prep = NULL;
- err = boot_disk_prep_partname (&prep); - err = boot_disk_prep_partname (&prep);
+ err = boot_disk_prep_partname (NULL, &prep); + err = boot_disk_prep_partname (NULL, &prep);
if (err == GRUB_ERR_NONE && prep) if (err == GRUB_ERR_NONE && prep)
err = prep_read_envblk (prep); err = prep_read_envblk (prep);
if (err == GRUB_ERR_BAD_FILE_TYPE || err == GRUB_ERR_FILE_NOT_FOUND) if (err == GRUB_ERR_BAD_FILE_TYPE || err == GRUB_ERR_FILE_NOT_FOUND)
@@ -295,6 +341,10 @@ static grub_command_t cmd_prep_load; @@ -296,6 +344,10 @@
GRUB_MOD_INIT(prep_loadenv)
{ {
early_env_hook = early_prep_loadenv; early_env_hook = early_prep_loadenv;
+ cmd_prep_load = cmd_prep_load =
+ grub_register_command("prep_partname", grub_cmd_prep_partname, + grub_register_command("prep_partname", grub_cmd_prep_partname,
+ "VARNAME", + "VARNAME",
+ N_("Get partition name of PReP.")); + N_("Get partition name of PReP."));
cmd_prep_load = + cmd_prep_load =
grub_register_command("prep_load_env", grub_cmd_prep_loadenv, grub_register_command("prep_load_env", grub_cmd_prep_loadenv,
"DEVICE", "DEVICE",
-- N_("Load variables from environment block file."));
2.39.2

View File

@ -15,6 +15,9 @@ v2:
To avoid disrupting the boot process with errors, it's important to log To avoid disrupting the boot process with errors, it's important to log
any errors that may occur and always return GRUB_ERR_NONE. any errors that may occur and always return GRUB_ERR_NONE.
v3:
Making the new module powerpc_ieee1275 specific.
Signed-off-by: Michael Chang <mchang@suse.com> Signed-off-by: Michael Chang <mchang@suse.com>
--- ---
grub-core/Makefile.core.def | 5 + grub-core/Makefile.core.def | 5 +
@ -24,7 +27,7 @@ Signed-off-by: Michael Chang <mchang@suse.com>
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -2624,3 +2624,8 @@ @@ -2624,3 +2624,9 @@
common = lib/libtasn1_wrap/tests/Test_strings.c; common = lib/libtasn1_wrap/tests/Test_strings.c;
common = lib/libtasn1_wrap/wrap_tests.c; common = lib/libtasn1_wrap/wrap_tests.c;
}; };
@ -32,6 +35,7 @@ Signed-off-by: Michael Chang <mchang@suse.com>
+module = { +module = {
+ name = prep_loadenv; + name = prep_loadenv;
+ common = commands/prep_loadenv.c; + common = commands/prep_loadenv.c;
+ enable = powerpc_ieee1275;
+}; +};
--- /dev/null --- /dev/null
+++ b/grub-core/commands/prep_loadenv.c +++ b/grub-core/commands/prep_loadenv.c

View File

@ -19,12 +19,13 @@ Signed-off-by: Michael Chang <mchang@suse.com>
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -2617,4 +2617,6 @@ @@ -2628,5 +2628,7 @@
module = { module = {
name = prep_loadenv; name = prep_loadenv;
common = commands/prep_loadenv.c; common = commands/prep_loadenv.c;
+ cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; + cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
+ cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; + cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
enable = powerpc_ieee1275;
}; };
--- a/grub-core/commands/prep_loadenv.c --- a/grub-core/commands/prep_loadenv.c
+++ b/grub-core/commands/prep_loadenv.c +++ b/grub-core/commands/prep_loadenv.c

View File

@ -31,9 +31,9 @@ Signed-off-by: Michael Chang <mchang@suse.com>
--- a/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def
@@ -2643,3 +2643,8 @@ @@ -2633,3 +2633,8 @@
cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
enable = powerpc_ieee1275;
}; };
+ +
+module = { +module = {

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Tue Apr 18 02:42:23 UTC 2023 - Michael Chang <mchang@suse.com>
- Fix no prep partition error on non-PReP architectures by making the
prep_loadenv module exclusive to powerpc_ieee1275 platform (bsc#1210489)
* 0004-Introduce-prep_load_env-command.patch
- Fix the issue of freeing an uninitialized pointer
* 0002-prep_loadenv-Fix-regex-for-Open-Firmware-device-spec.patch
- Rediff
* 0005-export-environment-at-start-up.patch
* 0009-Add-crypttab_entry-to-obviate-the-need-to-input-pass.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Apr 11 11:13:26 UTC 2023 - Michael Chang <mchang@suse.com> Tue Apr 11 11:13:26 UTC 2023 - Michael Chang <mchang@suse.com>