From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1S5e7v-0006qK-Ip for mharc-grub-devel@gnu.org; Thu, 08 Mar 2012 09:15:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5e7k-0006p5-2A for grub-devel@gnu.org; Thu, 08 Mar 2012 09:15:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5e7a-0000mO-4B for grub-devel@gnu.org; Thu, 08 Mar 2012 09:15:19 -0500 Received: from mail-ee0-f41.google.com ([74.125.83.41]:48713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5e7Z-0000lu-Ri for grub-devel@gnu.org; Thu, 08 Mar 2012 09:15:10 -0500 Received: by eeke53 with SMTP id e53so172068eek.0 for ; Thu, 08 Mar 2012 06:15:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=wdToPCEPhH+yUgJjprGbXOLGtLMqH5GCNwZPBQxGArQ=; b=W4OD9xnZ0o2uReUsopqOrNWlNOmMUBNaihdc7bK6Dt9RRYUTlq4c6mOsR94oVH0jSd yiX3DqzZjsj/IFUrBm6U4I57vUDXbwGDSqKTrWGzKeqT8ckGX0miqiCv5F8TWnDWJByZ 9TSwfnrEvj6cXiycNoRgiT+5X1rbQbA94rbbgGp0ZB4hV4T5IRX6Bqy9rVyQHihnVdxg hnE8InwgmeBDpjNYyBnqXTZZr7bLtQiYkzp/T8BYSOmlMkrlqGkI8RbuBJXhP4zX3NWM cT/gROdHFjlnjov56riAcnBrYk/SwWP4bV8bd2LkN5mP3CNWhIXCp+hMNPGxcXQYM/57 h05w== Received: by 10.14.32.139 with SMTP id o11mr2408607eea.10.1331216107927; Thu, 08 Mar 2012 06:15:07 -0800 (PST) Received: from debian.x201.phnet (91-233.197-178.cust.bluewin.ch. [178.197.233.91]) by mx.google.com with ESMTPS id z47sm6538308een.5.2012.03.08.06.15.05 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Mar 2012 06:15:06 -0800 (PST) Message-ID: <4F58BEE8.3050006@gmail.com> Date: Thu, 08 Mar 2012 15:15:04 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0 MIME-Version: 1.0 To: Andreas Vogel Subject: Re: [BUG] GRUBs option parsing needs fixing References: <4F541349.7070704@anvo-it.de> <4F541723.6030105@gmail.com> <4F54A094.1000000@anvo-it.de> <4F54B78B.9010707@gmail.com> <4F54DF19.7000804@anvo-it.de> <4F58B03E.2050908@anvo-it.de> In-Reply-To: <4F58B03E.2050908@anvo-it.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.83.41 Cc: The development of GNU GRUB X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2012 14:15:29 -0000 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. -- Regards Vladimir 'φ-coder/phcoder' Serbinenko