Bug 200508 - poptPrintUsage() (e.g. rpm --usage) prints short options multiple times
poptPrintUsage() (e.g. rpm --usage) prints short options multiple times
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-28 05:52 EDT by Hans Ulrich Niedermann
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-05 04:24:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hans Ulrich Niedermann 2006-07-28 05:52:31 EDT
Description of problem:

  poptPrintUsage() prints the short options multiple times if the options table
uses POPT_ARG_INCLUDE_TABLE.

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

  rpm-4.4.2-15.2

How reproducible:

  Every time.

Steps to Reproduce:

1. rpm --usage | head -n1
  
Actual results:

Usage: rpm [-aKfgpWHqV] [-aKfgpWHqVcdils] [-aKfgpWHqVcdilsaKfgpWHqV]
[-aKfgpWHqVcdilsaKfgpWHqV] [-aKfgpWHqVcdilsaKfgpWHqV]
[-aKfgpWHqVcdilsaKfgpWHqVK] [-aKfgpWHqVcdilsaKfgpWHqVK]
[-aKfgpWHqVcdilsaKfgpWHqVKi] [-aKfgpWHqVcdilsaKfgpWHqVKiv]
[-aKfgpWHqVcdilsaKfgpWHqVKiv] [-aKfgpWHqVcdilsaKfgpWHqVKiv?] [-a|--all]
[-f|--file] [-g|--group]

Expected results:

Usage: rpm [-aKfgpWHqVcdilsaKfgpWHqVKiv?] [-a|--all] [-f|--file] [-g|--group]

Additional info:

  Every option table included into the main table via POPT_ARG_INCLUDE_TABLE
causes another [-asdfljl] string to be printed with all the short options
defined so far. This behaviour is not restricted to rpm on Fedora, it has also
been confirmed on rpm on Suse and the new gphoto2 code in SVN.
Comment 1 Hans Ulrich Niedermann 2006-07-28 12:25:16 EDT
Test case: http://es.lauft.net/popt-usage-test/
Comment 2 Jeff Johnson 2006-08-05 04:24:12 EDT
Fixed in CVS, will be in popt-1.10.7 when released.
@@ -775,7 +775,7 @@ static int showShortOptions(const struct
 /*@=boundswrite@*/
 
     /* On return to top level, print the short options, return print length. */
-    if (s == str && *s != '\0') {
+    if (s != str && *s != '\0') {
        fprintf(fp, " [-%s]", s);
        len = strlen(s) + sizeof(" [-]")-1;
     }

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