From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1a9H50-0004bb-Up for mharc-grub-devel@gnu.org; Wed, 16 Dec 2015 13:45:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9H4y-0004Zf-3h for grub-devel@gnu.org; Wed, 16 Dec 2015 13:45:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9H4s-0000Nu-T2 for grub-devel@gnu.org; Wed, 16 Dec 2015 13:45:36 -0500 Received: from mail-lb0-x234.google.com ([2a00:1450:4010:c04::234]:35376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9H4s-0000NF-FG for grub-devel@gnu.org; Wed, 16 Dec 2015 13:45:30 -0500 Received: by mail-lb0-x234.google.com with SMTP id u9so31181273lbp.2 for ; Wed, 16 Dec 2015 10:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=+JBQwHWFG/koLi01pO7qL5AWO5MItaclgsTbW9UrCgM=; b=uBgaXmsOtVPF2PNkksivkeEHXL6i18ID3hXtkMER7umHc5bt2UEFVylMJXPvMN4d7x MrR+rH/EhCZLjAUr2lyWWX9WEb5hw0jWdJYOjhsMz37sDIPV3pboY3kc/VZAhYGpvcB1 xs8KDeI60CzGYS+biFrJWaPBBz71BiKsSCxHMQmucGZm2jodArPIxZaudtB/WbjRmrqM jOXnFp8dqOcBM70d84E1UDrXCaOyVeSt+ST5ATW6hoS5iifTvwScrgbgyjuBkvC3772O njfZ9mBocOwe9NXRl+A+f+C+6xt8+f1xf9HxHzRzJP6gp/PaXKwlPnWtK5N9GEC4z0Xu ylkg== X-Received: by 10.112.205.10 with SMTP id lc10mr18804549lbc.31.1450291529358; Wed, 16 Dec 2015 10:45:29 -0800 (PST) Received: from [192.168.1.41] (ppp91-76-25-247.pppoe.mtu-net.ru. [91.76.25.247]) by smtp.gmail.com with ESMTPSA id sv10sm1230869lbb.46.2015.12.16.10.45.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Dec 2015 10:45:28 -0800 (PST) Subject: Re: normal does not load if there was an error processing embedded config To: Vladimir 'phcoder' Serbinenko References: <20150228204536.2e6b197f@opensuse.site> <20150228223351.09c01ade@opensuse.site> From: Andrei Borzenkov Message-ID: <5671B147.7030107@gmail.com> Date: Wed, 16 Dec 2015 21:45:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20150228223351.09c01ade@opensuse.site> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c04::234 Cc: The development of GRUB 2 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: Wed, 16 Dec 2015 18:45:37 -0000 28.02.2015 22:33, Andrei Borzenkov пишет: > В Sat, 28 Feb 2015 19:11:51 +0100 > "Vladimir 'phcoder' Serbinenko" пишет: > >> Could you use grub-print-error rather than just resetting error? And we >> should do it after every command in embedded config > > > Like below? Note that if loading of normal.mod succeeds these errors are > lost anyway. There was at least one report where skipping loading in > this case would actually make diagnostic easier (signed EFI image with > missing filesystem driver for /boot). But I'm not sure if anyone > depends on current behavior. grub-mkrescue definitely does :) > I committed simplified version (caused also failure in embedded config processing itself). Before embedded config the only error we can get is OOM. Not sure if we need extra code for this corner case. > From: Andrei Borzenkov > Subject: [PATCH] kernel: reset grub_errno before loading normal > > If last command in embedded config set grub_errno, loading of > normal fails. As we do not really check for any errors during > processing of embedded config and cannot handle error that happened > in the middle of it, just ignore error and hope for the best. > > Add also printing of errors during embedded config processing to > facilitate diagnostic as suggested by Vladimir. > > --- > grub-core/kern/main.c | 2 ++ > grub-core/kern/parser.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c > index 9cad0c4..22483b6 100644 > --- a/grub-core/kern/main.c > +++ b/grub-core/kern/main.c > @@ -304,6 +304,8 @@ grub_main (void) > > if (load_config) > grub_parser_execute (load_config); > + /* Reset error, otherwise loading of normal.mod fails */ > + grub_errno = GRUB_ERR_NONE; > > grub_boot_time ("After execution of embedded config. Attempt to go to normal mode"); > > diff --git a/grub-core/kern/parser.c b/grub-core/kern/parser.c > index b9bd123..13acb6c 100644 > --- a/grub-core/kern/parser.c > +++ b/grub-core/kern/parser.c > @@ -265,9 +265,11 @@ grub_parser_execute (char *source) > { > char *line; > > + grub_errno = GRUB_ERR_NONE; > grub_parser_execute_getline (&line, 0, &source); > grub_rescue_parse_line (line, grub_parser_execute_getline, &source); > grub_free (line); > + grub_print_error (); > } > > return grub_errno; >