From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JNYj9-00014X-FB for mharc-grub-devel@gnu.org; Fri, 08 Feb 2008 14:17:35 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JNYj7-00013I-LP for grub-devel@gnu.org; Fri, 08 Feb 2008 14:17:33 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JNYj6-000112-6c for grub-devel@gnu.org; Fri, 08 Feb 2008 14:17:33 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JNYj6-00010z-2E for grub-devel@gnu.org; Fri, 08 Feb 2008 14:17:32 -0500 Received: from aybabtu.com ([69.60.117.155]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JNYj5-0001dO-P2 for grub-devel@gnu.org; Fri, 08 Feb 2008 14:17:31 -0500 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1JNYj3-0007KD-Im for grub-devel@gnu.org; Fri, 08 Feb 2008 20:17:30 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1JNYhH-0006Tx-7I for grub-devel@gnu.org; Fri, 08 Feb 2008 20:15:39 +0100 Date: Fri, 8 Feb 2008 20:15:39 +0100 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080208191539.GA24599@thorin> References: <1202409267.5010.2.camel@xerces> <20080208011029.GA4418@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] tell the user why they are in rescue mode X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2008 19:17:33 -0000 --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Fri, Feb 08, 2008 at 06:44:26PM +0000, Sam Morris wrote: > > While that works, the output looks like this: > > Entering rescue mode... > error: out of disk > > _ > > Which does not present the information in the clearest possible way: it > looks like the error happened in the rescue mode code, instead of the > normal mode code. > > Also, the error message could be lost if any of the code between the > start of grub_enter_rescue_mode and its call to grub_print_error itself > triggers an error. > > For these reasons I think it's better to call grub_print_error from > within grub_load_normal. Agreed. See attached patch. Does this work as expected ? -- Robert Millan I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.) --9jxsPFA5p3P2qPhR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="rescue_mode.diff" 2008-02-08 Robert Millan * kern/main.c (grub_load_normal_mode): Do not reset `grub_errno'. Call grub_print_error() instead. This will let user know why we're entering rescue mode. Based on suggestions from Sam Morris. diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp -N ../grub2/kern/main.c ./kern/main.c --- ../grub2/kern/main.c 2008-01-05 13:04:35.000000000 +0100 +++ ./kern/main.c 2008-02-08 20:11:52.000000000 +0100 @@ -102,8 +102,8 @@ grub_load_normal_mode (void) /* Load the module. */ grub_dl_load ("normal"); - /* Ignore any error, because we have the rescue mode anyway. */ - grub_errno = GRUB_ERR_NONE; + /* Something went wrong. Print errors here to let user know why we're entering rescue mode. */ + grub_print_error (); } /* The main routine. */ --9jxsPFA5p3P2qPhR--