From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1S5eOH-00043X-SF for mharc-grub-devel@gnu.org; Thu, 08 Mar 2012 09:32:25 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5eOB-000434-Vi for grub-devel@gnu.org; Thu, 08 Mar 2012 09:32:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5eO5-0003za-LT for grub-devel@gnu.org; Thu, 08 Mar 2012 09:32:19 -0500 Received: from mail-ee0-f41.google.com ([74.125.83.41]:38413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5eO5-0003zM-CQ for grub-devel@gnu.org; Thu, 08 Mar 2012 09:32:13 -0500 Received: by eeke53 with SMTP id e53so178040eek.0 for ; Thu, 08 Mar 2012 06:32:11 -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=grICbEUJCZPMTLi1Cq+8SIGXr36zUXWQW488AYsiXfQ=; b=u8iDDf+aa6OfjvTnb+NVgdesh+2krqddda9mee1R7rifW+TGJ3Agm5G5AkyTHhdw16 /9op/bRO3WbLSAN4Hzq7qx5paWDVbhddx5SgDGqUujDn/Qm0O27tu5XPbJxMJgOZdV45 WSIaLw1GGRn3BlqQfG1wHxOltT92dJYUX+d0zJ5R8IFkjhqX7hk81ZCt4uoH/xpwS9fe M4BPq4gUsagAY+XzAvCt3X2OLHbd2ZTNqnJgJXhBU847WELmKufdC9srOaufGAsOFFPD eKGSF6iK2tnVJUY/aeKGpIK3JO7AKtTBBqyI6DIksc05f4/Y3+rM00wlxNXYpqv09aiC kDtA== Received: by 10.213.19.196 with SMTP id c4mr1240309ebb.96.1331217131175; Thu, 08 Mar 2012 06:32:11 -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 y11sm6710591eem.3.2012.03.08.06.32.09 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Mar 2012 06:32:10 -0800 (PST) Message-ID: <4F58C2E7.6080000@gmail.com> Date: Thu, 08 Mar 2012 15:32:07 +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> <4F58BEE8.3050006@gmail.com> In-Reply-To: <4F58BEE8.3050006@gmail.com> 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:32:24 -0000 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