From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YRn9E-0000ca-NR for mharc-grub-devel@gnu.org; Sat, 28 Feb 2015 14:34:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRn9B-0000bT-Jl for grub-devel@gnu.org; Sat, 28 Feb 2015 14:33:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRn98-0007kP-4o for grub-devel@gnu.org; Sat, 28 Feb 2015 14:33:57 -0500 Received: from mail-lb0-x22c.google.com ([2a00:1450:4010:c04::22c]:33075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRn97-0007kL-Sk for grub-devel@gnu.org; Sat, 28 Feb 2015 14:33:54 -0500 Received: by lbdu14 with SMTP id u14so2110712lbd.0 for ; Sat, 28 Feb 2015 11:33:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=OTUNCtRcLmh/zszuO1idX/A6885zEMycvGOzGjvqbVE=; b=oMCoDVgs+doh8CdYwhgETIir9HjDp9XMAGAzPmMV0AvHXtRJPv96T2YPhk2voGn4d/ QlTbMj0A4A08cPPJ3Q8HBA6Zs6xQOSN5VHt73eVDGuuMxrU4KFCLCu3CCezFagGApohH +6UodkP1RvxDWZtCKCogtqfrf+PesHxIwhG4L3hV8yw6IcRN9WNZpsrAEBEwYeil7T7z gTQjMHY+gpIxKev6m1HPwxItUpnhPT4C303ylYk8Ovqr5kuffv7aRX7NwuumweYf2qfL scgVyZiHZsYJjE1rY5bl7GLlSNySzYaIujzi5hbdxypk4shw4tbxYraTfB3gYUbM/CnU r1lQ== X-Received: by 10.152.45.37 with SMTP id j5mr18234549lam.31.1425152033151; Sat, 28 Feb 2015 11:33:53 -0800 (PST) Received: from opensuse.site (ppp91-76-14-38.pppoe.mtu-net.ru. [91.76.14.38]) by mx.google.com with ESMTPSA id bj2sm1596198lbc.43.2015.02.28.11.33.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Feb 2015 11:33:52 -0800 (PST) Date: Sat, 28 Feb 2015 22:33:51 +0300 From: Andrei Borzenkov To: "Vladimir 'phcoder' Serbinenko" Subject: Re: normal does not load if there was an error processing embedded config Message-ID: <20150228223351.09c01ade@opensuse.site> In-Reply-To: References: <20150228204536.2e6b197f@opensuse.site> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.25; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22c 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: Sat, 28 Feb 2015 19:33:58 -0000 =D0=92 Sat, 28 Feb 2015 19:11:51 +0100 "Vladimir 'phcoder' Serbinenko" =D0=BF=D0=B8=D1=88=D0= =B5=D1=82: > 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 :) 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) =20 if (load_config) grub_parser_execute (load_config); + /* Reset error, otherwise loading of normal.mod fails */ + grub_errno =3D GRUB_ERR_NONE; =20 grub_boot_time ("After execution of embedded config. Attempt to go to no= rmal mode"); =20 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; =20 + grub_errno =3D 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 (); } =20 return grub_errno; --=20 tg: (018f79d..) u/reset-error-before-normal (depends on: master)