public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14024] New: argp: mis-formatted --help output
@ 2012-04-26 17:12 mark-sourceware at glines dot org
  2012-04-26 17:14 ` [Bug libc/14024] " mark-sourceware at glines dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mark-sourceware at glines dot org @ 2012-04-26 17:12 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14024

             Bug #: 14024
           Summary: argp: mis-formatted --help output
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: mark-sourceware@glines.org
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


Apologies if this is logged against the wrong component, please reassign as
needed.

The argp feature can sometimes generate mis-formatted --help output.  I've
reproduced this in glibc 2.3.4 (RHEL), libc6 2.13-20 (Ubuntu), and in the git
master branch (as of 2012-04-26).  A combination of conditions seem to be
needed to trigger the problem:

* Manual line wrapping must occur due to the option description containing a
newline
* Automatic line wrapping of an option description must occur due to the
remaining text going past the right margin
* The argp_fmtstream_t buffer must be too small (or have too much preceding
text in it) for the new prefix whitespace to fit

I will attach a test program that triggers the issue.  I will also provide more
details of how it goes wrong - I've done some analysis of the problem but not
enough to know the best way to fix it.

The mis-formatted output looks like:

$ ./test
Usage: test [OPTION...] 
tttttttttttttttttt

      --a                    bbbbbbbbbbbbbbbbb
      --cc                             =d                 eeeeeeeeeeeeeeeee
  -f, --g                    hhhhhhhhhhhhhhhhhhhh
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
                             jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
  -?, --help                 Give this help list
      --usage                Give a short usage message


The expected output should be:

$ ./test
Usage: test [OPTION...] 
tttttttttttttttttt

      --a                    bbbbbbbbbbbbbbbbb
      --cc=d                 eeeeeeeeeeeeeeeee
  -f, --g                    hhhhhhhhhhhhhhhhhhhh
                             iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
                             jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
  -?, --help                 Give this help list
      --usage                Give a short usage message


When the problem occurs, the prefix whitespace for the "i" line has been moved
to appear between "--cc" and "=d".  Shortening any of the text strings causes
the correct output to be emitted.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-01 20:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-26 17:12 [Bug libc/14024] New: argp: mis-formatted --help output mark-sourceware at glines dot org
2012-04-26 17:14 ` [Bug libc/14024] " mark-sourceware at glines dot org
2012-04-26 17:17 ` mark-sourceware at glines dot org
2012-04-26 17:28 ` mark-sourceware at glines dot org
2014-06-25 11:11 ` fweimer at redhat dot com
2014-08-01 13:46 ` beaux_monde at tut dot by
2014-08-01 20:53 ` beaux_monde at tut dot by

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).