|
|
a85e8e |
From 82366b73d1430f2ff2086401e09c88be1f170bd5 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: Colin Watson <cjwatson@ubuntu.com>
|
|
|
a85e8e |
Date: Fri, 17 Jan 2014 02:28:46 +0000
|
|
|
a85e8e |
Subject: [PATCH 035/260] Ignore EPERM when modifying kern.geom.debugflags
|
|
|
a85e8e |
|
|
|
a85e8e |
Many tests fail when run as a non-root user on FreeBSD. The failures
|
|
|
a85e8e |
all amount to an inability to open files using grub_util_fd_open,
|
|
|
a85e8e |
because we cannot set the kern.geom.debugflags sysctl. This sysctl is
|
|
|
a85e8e |
indeed important to allow us to do such things as installing GRUB to the
|
|
|
a85e8e |
MBR, but if we need to do that and can't then we will get an error
|
|
|
a85e8e |
later. Enforcing it here is unnecessary and prevents otherwise
|
|
|
a85e8e |
perfectly reasonable operations.
|
|
|
a85e8e |
---
|
|
|
a85e8e |
ChangeLog | 7 +++++++
|
|
|
a85e8e |
grub-core/osdep/freebsd/hostdisk.c | 12 ++++++++++--
|
|
|
a85e8e |
2 files changed, 17 insertions(+), 2 deletions(-)
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/ChangeLog b/ChangeLog
|
|
|
a85e8e |
index 4688ff4e6..10abfe28f 100644
|
|
|
a85e8e |
--- a/ChangeLog
|
|
|
a85e8e |
+++ b/ChangeLog
|
|
|
a85e8e |
@@ -1,3 +1,10 @@
|
|
|
a85e8e |
+2014-01-19 Colin Watson <cjwatson@ubuntu.com>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Ignore
|
|
|
a85e8e |
+ EPERM when modifying kern.geom.debugflags. It is only a problem for
|
|
|
a85e8e |
+ such things as installing GRUB to the MBR, in which case there'll be
|
|
|
a85e8e |
+ an error later anyway, not for opening files during tests.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com>
|
|
|
a85e8e |
|
|
|
a85e8e |
* grub-core/Makefile.am: Build grub_emu_init.[ch] from MODULE_FILES
|
|
|
a85e8e |
diff --git a/grub-core/osdep/freebsd/hostdisk.c b/grub-core/osdep/freebsd/hostdisk.c
|
|
|
a85e8e |
index eb202dcc8..6145d0735 100644
|
|
|
a85e8e |
--- a/grub-core/osdep/freebsd/hostdisk.c
|
|
|
a85e8e |
+++ b/grub-core/osdep/freebsd/hostdisk.c
|
|
|
a85e8e |
@@ -102,8 +102,16 @@ grub_util_fd_open (const char *os_dev, int flags)
|
|
|
a85e8e |
if (! (sysctl_oldflags & 0x10)
|
|
|
a85e8e |
&& sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_flags, sysctl_size))
|
|
|
a85e8e |
{
|
|
|
a85e8e |
- grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl kern.geom.debugflags");
|
|
|
a85e8e |
- return GRUB_UTIL_FD_INVALID;
|
|
|
a85e8e |
+ if (errno == EPERM)
|
|
|
a85e8e |
+ /* Running as an unprivileged user; don't worry about restoring
|
|
|
a85e8e |
+ flags, although if we try to write to anything interesting such
|
|
|
a85e8e |
+ as the MBR then we may fail later. */
|
|
|
a85e8e |
+ sysctl_oldflags = 0x10;
|
|
|
a85e8e |
+ else
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl kern.geom.debugflags");
|
|
|
a85e8e |
+ return GRUB_UTIL_FD_INVALID;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
}
|
|
|
a85e8e |
|
|
|
a85e8e |
ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
|
|
|
a85e8e |
--
|
|
|
a85e8e |
2.13.0
|
|
|
a85e8e |
|