Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Mn7CI-0004TM-92 for mharc-grub-devel@gnu.org; Mon, 14 Sep 2009 04:46:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mn7CF-0004RB-TL for grub-devel@gnu.org; Mon, 14 Sep 2009 04:46:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mn7CA-0004OO-Fm for grub-devel@gnu.org; Mon, 14 Sep 2009 04:46:02 -0400 Received: from [199.232.76.173] (port=35271 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mn7CA-0004OJ-8Q for grub-devel@gnu.org; Mon, 14 Sep 2009 04:45:58 -0400 Received: from smarthost03.mail.zen.net.uk ([212.23.3.142]:60230) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mn7C9-00021e-A1 for grub-devel@gnu.org; Mon, 14 Sep 2009 04:45:57 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost03.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1Mn7C5-0006Tb-KX for grub-devel@gnu.org; Mon, 14 Sep 2009 08:45:55 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1Mn7Bu-0008Fl-00; Mon, 14 Sep 2009 09:45:42 +0100 Date: Mon, 14 Sep 2009 09:45:42 +0100 From: Colin Watson To: The development of GRUB 2 Message-ID: <20090914084542.GK13423@riva.ucam.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost03-IP: [82.69.40.219] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: testing a loopback device without filesystem causes a crash 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: Mon, 14 Sep 2009 08:46:04 -0000 On Sun, Sep 13, 2009 at 07:58:56PM +0100, ago wrote: > On fezie's request I am reporting a possible bug that I experienced > when running the following: > > loopback loop0 /path/to/myfile > if [ -e (loop0)/some/file ]; then > echo ok > fi > > If /path/to/myfile does not contain a filesystem, grub2 crashes (there > is a sudden restart) when I run the test. The following patch fixes this. OK to commit? 2009-09-14 Colin Watson * commands/test.c (get_fileinfo): Return immediately if grub_fs_probe fails. Index: commands/test.c =================================================================== --- commands/test.c (revision 2593) +++ commands/test.c (working copy) @@ -88,6 +88,13 @@ test_parse (char **args, int *argn, int argc) } fs = grub_fs_probe (dev); + if (! fs) + { + grub_free (device_name); + grub_device_close (dev); + return; + } + pathname = grub_strchr (path, ')'); if (! pathname) pathname = path; -- Colin Watson [cjwatson@ubuntu.com]