[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] GRUBs option parsing needs fixing
From: |
Lennart Sorensen |
Subject: |
Re: [BUG] GRUBs option parsing needs fixing |
Date: |
Thu, 8 Mar 2012 10:24:31 -0500 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Thu, Mar 08, 2012 at 02:12:30PM +0100, Andreas Vogel wrote:
> I start a new thread with this mail in order to have a thread on its own
> for this subject.
Actually you did not, you hijacked an existing thread by replying to it
and changing the subject. Anyone with a threaded mail client now sees
your messages attached to the thread you hijacked.
> 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.
>
> Problem:
> POSIX (and GNU too) recommends (see
> http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html):
>
> "An option and its argument may or may not appear as separate tokens.
> (In other words, the whitespace separating them is optional.) Thus, ‘-o
> foo’ and ‘-ofoo’ are equivalent."
>
> This is doesn't hold for GRUB.
> When I try
> load_env -fenv
> an error message
> error: unknown argument '-e'.
> is returned.
>
> Solution:
> The GRUB argument parser needs to be fixed so that short options are
> parsed according to POSIX/GNU standards.
>
> 2) Optional option argument is not handled correctly (and not according
> to POSIX/GNU standard)
>
> Problem:
> Right now the GRUB argument parser doesn't handle optional arguments
> properly and it doesn't comply to POSIX/GNU standards.
>
> For short options parsing fails for the reason described above and
> because the parser allows that the option and its (optional) argument
> might be separated with whitespace.
>
> For long options parsing fails too because the parser allows that the
> option and its (optional) argument might be separated with whitespace.
> Example:
> OK: search --file --set --nofloppy /boot/grub/grub.cfg
> OK: search --file --set -- /boot/grub/grub.cfg
> ERROR: search --file --set /boot/grub/grub.cfg
>
> Solution:
> This solution follows just the POSIX/GNU standards for argument syntax
> as stated in the above mentioned HTML document.
> In order to be able to handle optional arguments for options the GRUB
> argument parser needs to implement parsing according to the following
> syntax:
>
> a) Short option: e.g. option name 'x' taking an optional argument '<arg>'
> Possible options: "-x" or "-x<arg>"
>
> b) Long option: e.g. option name 'xlong' taking an optional argument '<arg>'
> Possible options: "--xlong" or "--xlong=<arg>" or "--xlong="
> For the third form the upcoming implementation is somehow free to
> decide how to interpret that option. Regarding to GNUs getopt() man
> page, this form will be interpreted by getopt() as if the option isn't
> specified at all (due to a bug). Because that interpretation is based on
> a bug and because it might make more sense the third form could/should
> be interpreted as if "--xlong" has been specified (meaning: options is
> present but without value).
>
> So for both, short and long options taking an optional value, no
> whitespace between option and its value (if the value is present) is
> allowed.
>
> IMHO the option parsing code in GRUB2 should be fixed as soon as
> possible. The later it will be done the more we'll have to fight with
> compatibility issues.
>
> Any comments?
Well as a user I had never noticed. I suppose I am used to many programs
requireing spaces around arguments, so I consider those that don't odd,
and those that don't allow spaces to be annoying.
Doesn't mean it wouldn't be nice if grub was consistent with other
GNU things.
--
Len Sorensen
- Re: [BUG] GRUBs option parsing needs fixing, (continued)
- Re: [BUG] GRUBs option parsing needs fixing, Andreas Vogel, 2012/03/08
- Re: [BUG] GRUBs option parsing needs fixing, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/03/10
- Re: [BUG] GRUBs option parsing needs fixing, Andreas Vogel, 2012/03/10
- Re: [BUG] GRUBs option parsing needs fixing, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/03/10
- Re: [BUG] GRUBs option parsing needs fixing, Andreas Vogel, 2012/03/10
- Re: [BUG] GRUBs option parsing needs fixing, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/03/10
- Re: [BUG] GRUBs option parsing needs fixing, Lennart Sorensen, 2012/03/08
- Re: [BUG] GRUBs option parsing needs fixing, Andreas Vogel, 2012/03/08
- Re: [BUG] GRUBs option parsing needs fixing,
Lennart Sorensen <=
- Re: Ideas for the future, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/03/08
- Re: Ideas for the future, Andreas Vogel, 2012/03/08
- Re: Ideas for the future, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/03/08
- Re: Ideas for the future, Andreas Vogel, 2012/03/05
- Re: Ideas for the future, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/03/08