All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: Fabian Greffrath <greffrath@leat.rub.de>
Cc: The development of GRUB 2 <grub-devel@gnu.org>,
	462218@bugs.debian.org, Otavio Salvador <otavio@debian.org>
Subject: Re: Bug#461442: detection of other OSes in update-grub
Date: Mon, 4 Feb 2008 15:18:37 +0100	[thread overview]
Message-ID: <20080204141837.GB7432@thorin> (raw)
In-Reply-To: <47A6D04E.4070106@leat.rub.de>

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.
> # <insert copyright and license blurb here>

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

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



  reply	other threads:[~2008-02-04 14:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4790C888.6040007@leat.rub.de>
     [not found] ` <87sl0v6iod.fsf@ossystems.com.br>
     [not found]   ` <20080119114939.GB10722@thorin>
     [not found]     ` <479450A9.90601@leat.rub.de>
     [not found]       ` <20080121112448.GD7378@thorin>
     [not found]         ` <47948422.8000208@leat.rub.de>
     [not found]           ` <20080121121828.GA9244@thorin>
     [not found]             ` <4795B435.20102@leat.rub.de>
     [not found]               ` <20080122124642.GC2017@thorin>
2008-01-22 13:14                 ` Bug#461442: detection of other OSes in update-grub Fabian Greffrath
2008-01-22 16:56                   ` Robert Millan
2008-01-30 10:41                   ` Fabian Greffrath
2008-01-30 19:48                     ` Robert Millan
2008-01-31  8:31                       ` Fabian Greffrath
2008-01-31 10:10                         ` Otavio Salvador
2008-01-31 11:58                         ` Robert Millan
2008-01-31 14:26                           ` Fabian Greffrath
2008-01-31 14:39                             ` Robert Millan
2008-02-04  8:43                           ` Fabian Greffrath
2008-02-04 14:18                             ` Robert Millan [this message]
2008-02-04 14:47                               ` Fabian Greffrath
2008-02-04 15:04                                 ` Robert Millan
2008-02-04 15:27                             ` Marco Gerards
2008-02-06 10:12 Fabian Greffrath
2008-02-06 12:02 ` Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080204141837.GB7432@thorin \
    --to=rmh@aybabtu.com \
    --cc=462218@bugs.debian.org \
    --cc=greffrath@leat.rub.de \
    --cc=grub-devel@gnu.org \
    --cc=otavio@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.