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