Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ega4D-00012d-3d for mharc-grub-devel@gnu.org; Tue, 30 Jan 2018 12:51:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ega49-0000zj-Rh for grub-devel@gnu.org; Tue, 30 Jan 2018 12:51:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ega45-0000sg-OY for grub-devel@gnu.org; Tue, 30 Jan 2018 12:51:29 -0500 Received: from boksu.net-space.pl ([185.15.1.105]:54500) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.71) (envelope-from ) id 1ega45-0000o0-Cf for grub-devel@gnu.org; Tue, 30 Jan 2018 12:51:25 -0500 Received: (from localhost user: 'dkiper' uid#4000 fake: STDIN (dkiper@boksu.net-space.pl)) by router-fw-old.local.net-space.pl id S1825321AbeA3RoF (ORCPT ); Tue, 30 Jan 2018 18:44:05 +0100 Date: Tue, 30 Jan 2018 18:44:05 +0100 From: Daniel Kiper To: Steve McIntyre Cc: Daniel Kiper , The development of GNU GRUB , Steve McIntyre <93sam@debian.org> Subject: Re: [PATCH] Make grub-install check for errors from efibootmgr Message-ID: <20180130174405.GA11729@router-fw-old.local.net-space.pl> References: <20180129181626.eaprvd3pfbevjwvq@tack.einval.com> <20180129185423.29681-1-steve@einval.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180129185423.29681-1-steve@einval.com> User-Agent: Mutt/1.3.28i X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.15.1.105 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 17:51:31 -0000 On Mon, Jan 29, 2018 at 06:54:23PM +0000, Steve McIntyre wrote: > Code is currently ignoring errors from efibootmgr, giving users > clearly bogus output like: > > Setting up grub-efi-amd64 (2.02~beta3-4) ... > Installing for x86_64-efi platform. > Could not delete variable: No space left on device > Could not prepare Boot variable: No space left on device > Installation finished. No error reported. > > and then potentially unbootable systems. If efibootmgr fails, > grub-install should know that and report it! > > We've been using this patch in Debian now for some time, with no ill > effects. > > Signed-off-by: Steve McIntyre <93sam@debian.org> > --- > grub-core/osdep/unix/platform.c | 25 +++++++++++++++---------- > include/grub/util/install.h | 2 +- > util/grub-install.c | 18 +++++++++++++----- > 3 files changed, 29 insertions(+), 16 deletions(-) > > diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c > index a3fcfcaca..b3a617e44 100644 > --- a/grub-core/osdep/unix/platform.c > +++ b/grub-core/osdep/unix/platform.c > @@ -78,19 +78,20 @@ get_ofpathname (const char *dev) > dev); > } > > -static void > +static int > grub_install_remove_efi_entries_by_distributor (const char *efi_distributor) > { > int fd; > pid_t pid = grub_util_exec_pipe ((const char * []){ "efibootmgr", NULL }, &fd); > char *line = NULL; > size_t len = 0; > + int ret; > > if (!pid) > { > grub_util_warn (_("Unable to open stream from %s: %s"), > "efibootmgr", strerror (errno)); > - return; > + return errno; > } > > FILE *fp = fdopen (fd, "r"); > @@ -98,14 +99,13 @@ grub_install_remove_efi_entries_by_distributor (const char *efi_distributor) > { > grub_util_warn (_("Unable to open stream from %s: %s"), > "efibootmgr", strerror (errno)); > - return; > + return errno; > } > > line = xmalloc (80); > len = 80; > while (1) > { > - int ret; Oh, no, please do not do that here. If my first proposal conflicts with existing variables use second one. If second is bad please choose third. The rest of the patch LGTM. Daniel