public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mark-sourceware at glines dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/14024] New: argp: mis-formatted --help output
Date: Thu, 26 Apr 2012 17:12:00 -0000	[thread overview]
Message-ID: <bug-14024-131@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-04-26 17:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 17:12 mark-sourceware at glines dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14024-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).