All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: Andreas Vogel <Andreas.Vogel@anvo-it.de>
Cc: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [BUG] GRUBs option parsing needs fixing
Date: Thu, 08 Mar 2012 15:32:07 +0100	[thread overview]
Message-ID: <4F58C2E7.6080000@gmail.com> (raw)
In-Reply-To: <4F58BEE8.3050006@gmail.com>

On 08.03.2012 15:15, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 08.03.2012 14:12, Andreas Vogel wrote:
>> Hi all,
>>
>> I start a new thread with this mail in order to have a thread on its own
>> for this subject.
> Please don't CC Colin Watson (or me for that matter) for everything, 
> it's bad tone.
>> In another thread we've already had some discussion about GRUBs option
>> parsing. I wanna summarize and describe here about the issue.
>>
>> Right now I see 2 problems with GRUBs argument parsing:
>>
>> 1) GRUBs argument parsing is not POSIX compliant.
> We don't follow POSIX.
>>
>> 2) Optional option argument is not handled correctly (and not according
>> to POSIX/GNU standard)
> Well it's possible to do something like
>
> === modified file 'grub-core/lib/arg.c'
> --- grub-core/lib/arg.c    2012-02-08 18:26:01 +0000
> +++ grub-core/lib/arg.c    2012-03-08 14:13:21 +0000
> @@ -294,7 +291,8 @@
>          }
>            else
>          {
> -          if (opt->type != ARG_TYPE_NONE)
> +          if (opt->type != ARG_TYPE_NONE
> + && !(opt->flags & GRUB_ARG_OPTION_OPTIONAL))
>              {
>                if (curarg + 1 < argc)
>              {
> @@ -333,7 +331,8 @@
>        opt = find_long (cmd->options, arg + 2, arglen);
>
>        if (!option && argv[curarg + 1] && argv[curarg + 1][0] != '-'
> - && opt && opt->type != ARG_TYPE_NONE)
> + && opt && opt->type != ARG_TYPE_NONE
> + && !(opt->flags & GRUB_ARG_OPTION_OPTIONAL))
>          option = argv[++curarg];
>
>        if (!opt && (cmd->cmd->flags & GRUB_COMMAND_ACCEPT_DASH))
>
> But it would break configurations like -h com0 or -s root.
>
A possible compromise would be to change the behaviour of long options only.

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



  reply	other threads:[~2012-03-08 14:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05  1:13 Ideas for the future Andreas Vogel
2012-03-05  1:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-05  1:35   ` Samuel Thibault
2012-03-05  1:40     ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-05  9:23       ` Samuel Thibault
2012-03-05 11:16   ` Andreas Vogel
2012-03-05 12:54     ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-05 15:43       ` Andreas Vogel
2012-03-08 13:12         ` [BUG] GRUBs option parsing needs fixing Andreas Vogel
2012-03-08 14:15           ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-08 14:32             ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2012-03-08 15:03               ` Andreas Vogel
2012-03-08 15:18                 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-08 15:28                   ` Lennart Sorensen
2012-03-08 15:37                     ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-08 16:11                       ` Andreas Vogel
2012-03-08 15:45                   ` Andreas Vogel
2012-03-10 19:50                     ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-11  0:08                       ` Andreas Vogel
2012-03-11  1:01                         ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-11  1:59                           ` Andreas Vogel
2012-03-11  2:15                             ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-08 15:25                 ` Lennart Sorensen
2012-03-08 15:58                   ` Andreas Vogel
2012-03-08 15:24           ` Lennart Sorensen
2012-03-08 14:11         ` Ideas for the future Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-08 15:14           ` Andreas Vogel
2012-03-08 15:18             ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-05 16:33       ` Andreas Vogel
2012-03-08 14:23     ` Vladimir 'φ-coder/phcoder' Serbinenko

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=4F58C2E7.6080000@gmail.com \
    --to=phcoder@gmail.com \
    --cc=Andreas.Vogel@anvo-it.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.