Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JM2Bm-0000YK-IQ for mharc-grub-devel@gnu.org; Mon, 04 Feb 2008 09:20:50 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JM2Bl-0000Wv-HV for grub-devel@gnu.org; Mon, 04 Feb 2008 09:20:49 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JM2Bk-0000TE-0P for grub-devel@gnu.org; Mon, 04 Feb 2008 09:20:49 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JM2Bj-0000Sk-Ow for grub-devel@gnu.org; Mon, 04 Feb 2008 09:20:47 -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 1JM2Bj-0003Fb-RV for grub-devel@gnu.org; Mon, 04 Feb 2008 09:20:47 -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 1JM2Bb-0005qc-96; Mon, 04 Feb 2008 15:20:45 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1JM29d-00025R-7y; Mon, 04 Feb 2008 15:18:37 +0100 Date: Mon, 4 Feb 2008 15:18:37 +0100 From: Robert Millan To: Fabian Greffrath Message-ID: <20080204141837.GB7432@thorin> References: <47948422.8000208@leat.rub.de> <20080121121828.GA9244@thorin> <4795B435.20102@leat.rub.de> <20080122124642.GC2017@thorin> <4795EC4D.5020207@leat.rub.de> <47A05477.5030300@leat.rub.de> <20080130194854.GA2143@thorin> <47A1877D.7020009@leat.rub.de> <20080131115855.GA13960@thorin> <47A6D04E.4070106@leat.rub.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <47A6D04E.4070106@leat.rub.de> 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. Cc: The development of GRUB 2 , 462218@bugs.debian.org, Otavio Salvador Subject: Re: Bug#461442: detection of other OSes in update-grub 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, 04 Feb 2008 14:20:49 -0000 On Mon, Feb 04, 2008 at 09:43:58AM +0100, Fabian Greffrath wrote: > the given argument if it is a block device and returns NULL else. This > was necessary, because else you could force grub-probe to print 'foobar' > if run as 'grub-probe --target=device --device foobar'. Why is that a problem? > --- grub2-1.95+20080201~/util/getroot.c 2008-01-12 16:11:56.000000000 +0100 > +++ grub2-1.95+20080201/util/getroot.c 2008-02-03 21:56:29.000000000 +0100 > @@ -327,3 +327,17 @@ > > return grub_dev; > } > + > +char * > +grub_util_check_block_device (const char *blk_dev) > +{ > + struct stat st; > + > + if (stat (blk_dev, &st) < 0) > + grub_util_error ("Cannot stat `%s'", blk_dev); > + > + if (S_ISBLK (st.st_mode)) > + return strdup(blk_dev); Missing space here. ^ > + else > + return 0; > +} I think this function could be called from the other part of this file which performs similar checks (if this functionality is to be kept, that is). > diff -urNad grub2-1.95+20080201~/util/grub-probe.c grub2-1.95+20080201/util/grub-probe.c > --- grub2-1.95+20080201~/util/grub-probe.c 2008-01-25 23:33:57.000000000 +0100 > +++ grub2-1.95+20080201/util/grub-probe.c 2008-02-03 19:30:50.000000000 +0100 > @@ -50,6 +50,7 @@ > }; > > int print = PRINT_FS; > +unsigned int argument_is_device = 0; I know that the call to probe() is not supposed to be reentrant, but I'd prefer not to break reentrancy if it can be easily avoided; it is possible that probe() needs to recurse onto itself in the future (because of RAID/LVM). > #! /bin/sh -e > > # update-grub helper script. > # Please remember to fix that in later versions of the patch ;-) > linux) > if [ -x "`which linux-boot-prober 2>/dev/null`" ] ; then > LINUXPROBED="`linux-boot-prober ${DEVICE} | tr ' ' '|' | paste -s -d ' '`" > fi Is it possible to share code with 10_linux.in here? > if [ -n "${LINUXPROBED}" ] ; then > for LINUX in ${LINUXPROBED} ; do > LROOT="`echo ${LINUX} | cut -d ':' -f 1`" > LBOOT="`echo ${LINUX} | cut -d ':' -f 2`" > LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '|' ' '`" > LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`" > LINITRD="`echo ${LINUX} | cut -d ':' -f 5`" > LPARAMS="`echo ${LINUX} | cut -d ':' -f 6 | tr '|' ' '`" Maybe this can be simplified with "echo something | read a b c d" feature? -- 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 /.)