Bug 71147 - The flag POPT_ARGFLAG_OPTIONAL is not handled correctly
The flag POPT_ARGFLAG_OPTIONAL is not handled correctly
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
: Patch
Depends On:
  Show dependency treegraph
Reported: 2002-08-09 05:59 EDT by Wensong Zhang
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-02-12 15:55:07 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
A simple fix, hope that it doesn't break things. :) (793 bytes, patch)
2002-08-09 06:01 EDT, Wensong Zhang
no flags Details | Diff

  None (edit)
Description Wensong Zhang 2002-08-09 05:59:24 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020707

Description of problem:
When an option is specified with flag POPT_ARGFLAG_OPTIONAL, the argument will
be set if there is one, and the argumenet will be 
set NULL if there is no arg. However, the current popt will not
take the option as the argument, if there is an option following
the POPT_ARGFLAG_OPTIONAL option with no arg. This is not correct.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

Take the test1 progarm shipped inside the popt as example

[wensong@exchange popt]$ ./test1 --int 1 --optional
arg1: 0 arg2: (none) aInt: 1 oStr: (none)

This one is correct.

[wensong@exchange popt]$ ./test1 --optional --int 1
arg1: 0 arg2: (none) oStr: --int rest: 1

It takes "--int" as the argument of the --optional. It's wrong.

Additional info:
Comment 1 Wensong Zhang 2002-08-09 06:01:24 EDT
Created attachment 69704 [details]
A simple fix, hope that it doesn't break things. :)
Comment 2 Paul Nasrat 2005-06-07 17:00:44 EDT
Thanks for the patch, I've raised on rpm-devel list
Comment 3 Jeff Johnson 2006-02-12 15:55:07 EST
Patch checked in, should be in popt-1.10.5-0.11 when built.

Note You need to log in before you can comment on or make changes to this bug.