Bug 200508 - poptPrintUsage() (e.g. rpm --usage) prints short options multiple times
Summary: poptPrintUsage() (e.g. rpm --usage) prints short options multiple times
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-28 09:52 UTC by Hans Ulrich Niedermann
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-08-05 08:24:12 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Hans Ulrich Niedermann 2006-07-28 09:52:31 UTC
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 16:25:16 UTC
Test case: http://es.lauft.net/popt-usage-test/

Comment 2 Jeff Johnson 2006-08-05 08:24:12 UTC
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.