From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1W4Xod-0006lz-Og for mharc-grub-devel@gnu.org; Sat, 18 Jan 2014 10:28:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4XoT-0006ky-PE for grub-devel@gnu.org; Sat, 18 Jan 2014 10:28:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W4XoI-0005Ht-Eb for grub-devel@gnu.org; Sat, 18 Jan 2014 10:27:57 -0500 Received: from mail-ea0-x22f.google.com ([2a00:1450:4013:c01::22f]:60226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4XoI-0005Hm-7Q for grub-devel@gnu.org; Sat, 18 Jan 2014 10:27:46 -0500 Received: by mail-ea0-f175.google.com with SMTP id z10so2247552ead.6 for ; Sat, 18 Jan 2014 07:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=JI2xR8PnD5s9zTK1FDNo7oizzmA9WwkAZniSJClk3+s=; b=hbEQKXouw/M35hT5f7AvT72JjO8JIDTuNp85vpaJa85+Ee5j8VlQ68C97dJTSXmxnO T481OnT6nKZLYYb06V4/r3hKMYKws3pF4vzA1dulUreLjFIJ8cLo3MDjHbwFcfw+XJhK xIZJz7GnEvr/NYr3oWXD/g//NMp3OmK1tpYFcUxz0zJfE4kyIiremVcJ83qWHaSwyd6N hFw4mQ6Lb3Nk4FfCJlb0lOcWzFGhYrWk9EWbOdkUqtktES5CSKt5RrfLTZ0B7XoFuxfi jbM7Iu03NVwvPnuBZSWhd6egWeL4J3t6U8NeCqw580goVxz96iHoKFn+LapA1w2+yx1u wXFg== X-Received: by 10.14.111.73 with SMTP id v49mr201294eeg.94.1390058442832; Sat, 18 Jan 2014 07:20:42 -0800 (PST) Received: from [192.168.1.16] (85-188.196-178.cust.bluewin.ch. [178.196.188.85]) by mx.google.com with ESMTPSA id 4sm36009342eed.14.2014.01.18.07.20.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 18 Jan 2014 07:20:41 -0800 (PST) Message-ID: <52DA9BC1.1030604@gmail.com> Date: Sat, 18 Jan 2014 16:20:33 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.2.0 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH] Ignore EPERM when modifying kern.geom.debugflags References: <20140117025505.GQ5883@riva.ucam.org> In-Reply-To: <20140117025505.GQ5883@riva.ucam.org> X-Enigmail-Version: 1.6 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bAgaxIklVSMRSRdcC4Qc0U4ahnqkfNLpF" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22f X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 15:28:06 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --bAgaxIklVSMRSRdcC4Qc0U4ahnqkfNLpF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable go ahead On 17.01.2014 03:55, Colin Watson wrote: > Many tests fail when run as a non-root user on FreeBSD. The failures > all amount to an inability to open files using grub_util_fd_open, > because we cannot set the kern.geom.debugflags sysctl. This sysctl is > indeed important to allow us to do such things as installing GRUB to th= e > MBR, but if we need to do that and can't then we will get an error > later. Enforcing it here is unnecessary and prevents otherwise > perfectly reasonable operations. > --- > grub-core/osdep/freebsd/hostdisk.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) >=20 > diff --git a/grub-core/osdep/freebsd/hostdisk.c b/grub-core/osdep/freeb= sd/hostdisk.c > index eb202dc..6145d07 100644 > --- a/grub-core/osdep/freebsd/hostdisk.c > +++ b/grub-core/osdep/freebsd/hostdisk.c > @@ -102,8 +102,16 @@ grub_util_fd_open (const char *os_dev, int flags) > if (! (sysctl_oldflags & 0x10) > && sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_flags= , sysctl_size)) > { > - grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl ker= n.geom.debugflags"); > - return GRUB_UTIL_FD_INVALID; > + if (errno =3D=3D EPERM) > + /* Running as an unprivileged user; don't worry about restoring > + flags, although if we try to write to anything interesting such > + as the MBR then we may fail later. */ > + sysctl_oldflags =3D 0x10; > + else > + { > + grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl kern.g= eom.debugflags"); > + return GRUB_UTIL_FD_INVALID; > + } > } > =20 > ret =3D open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);= >=20 --bAgaxIklVSMRSRdcC4Qc0U4ahnqkfNLpF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlLam8gACgkQmBXlbbo5nOsbcQD/f0yAUXLS3MDU/qrrXjPvTLM1 1hMSvjd2bWUls6KC9i8A/3F0/AqVLoVpChPQbM5QVlTc5IYoh28Ox/yOZ361guk/ =hwcK -----END PGP SIGNATURE----- --bAgaxIklVSMRSRdcC4Qc0U4ahnqkfNLpF--