All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Zielcke <fzielcke@z-51.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Grub2 cannot find LVM volume groups with a dash (-) in the name
Date: Tue, 02 Sep 2008 00:46:11 +0200	[thread overview]
Message-ID: <1220309171.4115.31.camel@fz.local> (raw)
In-Reply-To: <20080901221405.GA11511@thorin>

Am Dienstag, den 02.09.2008, 00:14 +0200 schrieb Robert Millan:
> On Mon, Aug 18, 2008 at 05:05:26PM +0200, Felix Zielcke wrote:
> > +	unsigned char i, j, k, l;
> 
> I think using unsigned chars to store "integers" is counter-intuitive, and in
> some cases possibly dangerous (overflow).

I should have probable even used grub_uintN_t types.
16bit should be enough for them I think
255 chars in /dev/mapper/filename could be maybe a problem if people do
such weird things :)


> > +	grub_dev = xmalloc (strlen (os_dev) - strlen ("/dev/mapper/") + 1);
> > +
> > +	j = sizeof ("/dev/mapper/") -1;
> 
>                                      ^
> 
> Missing space here :-)

Yep and I even corrected this already in my last patch
http://lists.gnu.org/archive/html/grub-devel/2008-08/msg00523.htmlhttp://lists.gnu.org/archive/html/grub-devel/2008-08/msg00523.html

I'm now not that sure if that #define k would be okay, seems like Vesa
isn't liking macros.
But I could just use const for that too.

> > +	for (i = 0, k = 0; i < l; i++)
> > +	  {
> > +	    grub_dev[k] = os_dev[j + i];
> > +	    k++;
> 
> i already counts from 0 and increments by-one.  Can it be used instead of k?

Oh I just noticed again that in my last patch it's now j
i is used as the source count and get's incremented twice for a dash so
one dash is skipped.
whereas k (new j) is used as the destination count so it's always only
incremented by one.

That's the whole problem, skip the next dash on a dash but don't skip a
single dash.
It's always
/dev/mapper/vg-lv
but if vg and lv part has a single dash then it's for example
v--g-l--v
for grub this has to be v-g-l-v

> The rest of the code I mostly don't understand well.  If you feel confident
> that it's right, I suggest you check it in unless someone else also wants to
> review it.
> 

Honestly I'm happy that the LVM part seems to work and didn't introduce
any problem.

I'm too lazy now to make a new patch and go sleeping now.
But the changes I do make tomorrow now on the last patch above is
making k a const instead of #define, i think it just looks better
and using grub_uint16_t for all 4 variables.

I hope that Marco could have a quick look over it especially the
changelog part :)

-- 
Felix Zielcke




  reply	other threads:[~2008-09-01 22:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080808202337.3440.57502.reportbug@sylvester.jejik.com.jejik.com>
2008-08-09 10:26 ` Bug#494383: grub-pc: Grub2 cannot find LVM volume groups with a dash (-) in the name Felix Zielcke
2008-08-09 12:55   ` Felix Zielcke
2008-08-10 13:19   ` Sander Marechal
2008-08-11 16:18     ` [PATCH] " Felix Zielcke
2008-08-11 21:48       ` Sander Marechal
2008-08-14 17:34       ` Felix Zielcke
2008-08-14 18:03         ` Robert Millan
2008-08-14 19:32           ` Felix Zielcke
2008-08-14 20:38             ` Robert Millan
2008-08-14 21:15               ` Felix Zielcke
2008-08-18 15:05                 ` Felix Zielcke
2008-08-18 15:16                   ` Felix Zielcke
2008-09-01  7:08                     ` Felix Zielcke
2008-09-01 22:14                   ` Robert Millan
2008-09-01 22:46                     ` Felix Zielcke [this message]
2008-09-02  8:28                       ` Felix Zielcke
2008-09-02 14:59                         ` Vesa Jääskeläinen
2008-09-02 15:59                           ` Felix Zielcke
2008-09-02 16:21                             ` Vesa Jääskeläinen
2008-09-04 19:56                             ` Felix Zielcke
2008-09-02 13:37                       ` 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=1220309171.4115.31.camel@fz.local \
    --to=fzielcke@z-51.de \
    --cc=grub-devel@gnu.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.