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] argp: mis-formatted --help output Date: Thu, 26 Apr 2012 17:28:00 -0000 [thread overview] Message-ID: <bug-14024-131-ThLOasUZQk@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-14024-131@http.sourceware.org/bugzilla/> http://sourceware.org/bugzilla/show_bug.cgi?id=14024 --- Comment #3 from Mark Glines <mark-sourceware at glines dot org> 2012-04-26 17:28:13 UTC --- I've done some preliminary analysis of this issue. It appears that __argp_fmtstream_update attempts to insert leading whitespace to indent the remainder of an option's description (argp/argp-fmtstream.c:131). However, when the buffer does not have enough space for the additional whitespace, the whitespace is instead printed directly to the output stream (argp/argp-fmtstream.c:144). When the buffer contained previous data that had not been written to the output stream yet, this results in the output being printed out of order, appearing mis-formatted to the user. It's not immediately clear how to solve this. The issue seems to be that __argp_fmtstream_update can insert data into the buffer, but has no means to grow the buffer if necessary. The normal means of growing the buffer (__argp_fmtstream_ensure) is a caller of __argp_fmtstream_update. One option to fix this would be to flush the formatted output from the buffer (if any), and then try again. A second option would be to allocate a larger buffer, either duplicating the buffer-expansion code in __argp_fmtstream_ensure, or splitting it out into a third function which both can use. A third option would be to change __argp_fmtstream_update to return an int (currently it returns void), and have it return the amount of formatted text in this case, so that __argp_fmtstream_ensure can only write the formatted subset of the data in the buffer. This option seems like it would have a higher impact, as __argp_fmtstream_update has multiple callers. File names and line numbers in the above text are referring to the argp code as it was in today's git, revision 0ac229c819afd15ba323838ba72d0a409f16acc4. -- 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.
next prev parent reply other threads:[~2012-04-26 17:28 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-04-26 17:12 [Bug libc/14024] New: " 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 [this message] 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-ThLOasUZQk@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: linkBe 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).