mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-12-01 08:49:52 +00:00
e1531466e1
This change updates grub to the 2.04 release. The new release changed how grub is built, so the bootstrap and bootstrap.conf files have to be added to the dist-git. Also, the gitignore file changed so it has to be updated. Since the patches have been forward ported to 2.04, there's no need for a logic to maintain a patch with the delta between the release and the grub master branch. So the release-to-master.patch is dropped and no longer is updated by the do-rebase script. Also since gnulib isn't part of the grub repository anymore and cloned by the boostrap tool, a gnulib tarball is included as other source file and copied before calling the bootstrap tool. That way grub can be built even in builders that only have access to the sources lookaside cache. Resolves: rhbz#1727279 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
98 lines
3.2 KiB
Diff
98 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Peter Jones <pjones@redhat.com>
|
|
Date: Mon, 27 Aug 2018 13:14:06 -0400
|
|
Subject: [PATCH] Make grub_error() more verbose
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
---
|
|
grub-core/kern/efi/mm.c | 17 ++++++++++++++---
|
|
grub-core/kern/err.c | 13 +++++++++++--
|
|
include/grub/err.h | 5 ++++-
|
|
3 files changed, 29 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
|
|
index a9e37108c6d..15595a46e23 100644
|
|
--- a/grub-core/kern/efi/mm.c
|
|
+++ b/grub-core/kern/efi/mm.c
|
|
@@ -157,12 +157,20 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
|
|
|
|
/* Limit the memory access to less than 4GB for 32-bit platforms. */
|
|
if (address > GRUB_EFI_MAX_USABLE_ADDRESS)
|
|
- return 0;
|
|
+ {
|
|
+ grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
+ N_("invalid memory address (0x%llx > 0x%llx)"),
|
|
+ address, GRUB_EFI_MAX_USABLE_ADDRESS);
|
|
+ return NULL;
|
|
+ }
|
|
|
|
b = grub_efi_system_table->boot_services;
|
|
status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address);
|
|
if (status != GRUB_EFI_SUCCESS)
|
|
- return 0;
|
|
+ {
|
|
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
|
+ return NULL;
|
|
+ }
|
|
|
|
if (address == 0)
|
|
{
|
|
@@ -172,7 +180,10 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
|
|
status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address);
|
|
grub_efi_free_pages (0, pages);
|
|
if (status != GRUB_EFI_SUCCESS)
|
|
- return 0;
|
|
+ {
|
|
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
|
+ return NULL;
|
|
+ }
|
|
}
|
|
|
|
grub_efi_store_alloc (address, pages);
|
|
diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c
|
|
index 53c734de70e..aebfe0cf839 100644
|
|
--- a/grub-core/kern/err.c
|
|
+++ b/grub-core/kern/err.c
|
|
@@ -33,15 +33,24 @@ static struct grub_error_saved grub_error_stack_items[GRUB_ERROR_STACK_SIZE];
|
|
static int grub_error_stack_pos;
|
|
static int grub_error_stack_assert;
|
|
|
|
+#ifdef grub_error
|
|
+#undef grub_error
|
|
+#endif
|
|
+
|
|
grub_err_t
|
|
-grub_error (grub_err_t n, const char *fmt, ...)
|
|
+grub_error (grub_err_t n, const char *file, const int line, const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
+ int m;
|
|
|
|
grub_errno = n;
|
|
|
|
+ m = grub_snprintf (grub_errmsg, sizeof (grub_errmsg), "%s:%d:", file, line);
|
|
+ if (m < 0)
|
|
+ m = 0;
|
|
+
|
|
va_start (ap, fmt);
|
|
- grub_vsnprintf (grub_errmsg, sizeof (grub_errmsg), _(fmt), ap);
|
|
+ grub_vsnprintf (grub_errmsg + m, sizeof (grub_errmsg) - m, _(fmt), ap);
|
|
va_end (ap);
|
|
|
|
return n;
|
|
diff --git a/include/grub/err.h b/include/grub/err.h
|
|
index 24ba9f5f592..b68bbec3c72 100644
|
|
--- a/include/grub/err.h
|
|
+++ b/include/grub/err.h
|
|
@@ -85,7 +85,10 @@ struct grub_error_saved
|
|
extern grub_err_t EXPORT_VAR(grub_errno);
|
|
extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
|
|
|
|
-grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...);
|
|
+grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const int line, const char *fmt, ...);
|
|
+
|
|
+#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
|
|
+
|
|
void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
|
|
void EXPORT_FUNC(grub_error_push) (void);
|
|
int EXPORT_FUNC(grub_error_pop) (void);
|