hemprasad / gflags

Automatically exported from code.google.com/p/gflags
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Long doc strings show up garbled with --help #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Define command line flags with a long doc string (at least 200 chars)
2. Compile and run the binary with --help or --helpshort
3. Notice how the doc strings come up garbled

What is the expected output? What do you see instead?

The doc strings should not be garbled. 

What version of the product are you using? On what operating system?

gflags-1.6. Ubuntu 10.10, x86_64 platform.

Please provide any additional information below.

I'm attaching a .cc file that demonstrates the problem. Here is the output when 
I compile this file with gflags-1.6 and run it with argument --helpshort:

  Flags from /home/aron/gflags_bug.cc:
    -bar (This is the first line of the bar command line argument. This is the
      second line of the bar command line argument. Th    -foo (This is the first line of the foo command line argument. This is the
      second line of the foo command line argument. Th

I'd like to add that the bug didn't exist in gflags-1.2. Here's the output when 
the same file is linked against gflags-1.2 and then compiled and run with 
--helpshort:

  Flags from gflags_bug.cc:
    -bar (This is the first line of the bar command line argument. This is the
      second line of the bar command line argument. This is the third line of
      the bar command line argument. ) type: int32 default: 1
    -foo (This is the first line of the foo command line argument. This is the
      second line of the foo command line argument. This is the third line of
      the foo command line argument. ) type: int32 default: 1

Original issue reported on code.google.com by aron.sus...@nutanix.com on 3 Aug 2011 at 7:13

Attachments:

GoogleCodeExporter commented 9 years ago

I replaced the implementation of method DescribeOneFlag() in file 
gflags_reporting.cc in gflags-1.6 with that in gflags-1.2 and the issue was 
fixed.

Original comment by aron.sus...@nutanix.com on 3 Aug 2011 at 7:30

GoogleCodeExporter commented 9 years ago

The version of DescribeOneFlag() in gflags-1.5 is also good. So the bug seems 
to have been introduced in gflags-1.6.

Original comment by aron.sus...@nutanix.com on 3 Aug 2011 at 7:51

GoogleCodeExporter commented 9 years ago

The problem is in InternalStringPrintf in util.h. The second call to 
output->append() takes 'space' as the first argument. Instead, needs to take 
'buf' as the first argument.

Original comment by aron.sus...@nutanix.com on 3 Aug 2011 at 8:24

GoogleCodeExporter commented 9 years ago
Thanks for tracking this down!  I'll get a fix checked in.

Original comment by csilv...@gmail.com on 3 Aug 2011 at 10:51

GoogleCodeExporter commented 9 years ago

Original comment by csilv...@gmail.com on 3 Aug 2011 at 10:51

GoogleCodeExporter commented 9 years ago
Fixed in r59

Original comment by csilv...@gmail.com on 4 Aug 2011 at 12:03

GoogleCodeExporter commented 9 years ago
Issue 48 has been merged into this issue.

Original comment by csilv...@gmail.com on 16 Aug 2011 at 7:03