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