Bug 706605 - Please fix and improve "od --help"/"man od" wrt -w and -S options
Summary: Please fix and improve "od --help"/"man od" wrt -w and -S options
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 23
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-05-21 14:38 UTC by Denys Vlasenko
Modified: 2016-03-17 12:52 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-17 12:52:30 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Denys Vlasenko 2011-05-21 14:38:33 UTC
od --help says about these options:

  -S, --strings[=BYTES]       output strings of at least BYTES graphic chars
  -w, --width[=BYTES]         output BYTES bytes per output line

man od says:

       -S, --strings[=BYTES]
              output strings of at least BYTES graphic chars
       -w, --width[=BYTES]
              output BYTES bytes per output line

First, both are wrong about -S option parameter: it is not optional. That is, they should show --strings=BYTES, not --strings[=BYTES].

Second, what option -S actually does? I Its "description" is not clear at all, so I resorted to experimenting: I tried feeding it various files. On text files, it prints nothing - ??! On binary files (such as executables), it starts showing some strings >BYTES long, but it also skips a lot of other strings which are clearly longer than BYTES... In any case, description needs expanding.

Third, please document what is the default value for -w WIDTH.

Comment 1 Denys Vlasenko 2011-05-21 14:42:15 UTC
Regarding mysterious workings of od -S N:

$ for i in 1 3 5 7 9 11 13; do { j=i; while test $((j--)) != 0; do echo -n $i; done; echo; } done
1
333
55555
7777777
999999999
1111111111111111111111
13131313131313131313131313

$ for i in 1 3 5 7 9 11 13; do { j=i; while test $((j--)) != 0; do echo -n $i; done; echo; } done | od -S9 

Why od doesn't output, say, string 1111111111111111111111? it isn't longer than 9 chars??

Comment 2 Ondrej Vasik 2011-05-21 18:25:45 UTC
First of all, Hi Denys, thanks for report.
Second, --strings is supposed to have BYTES as optional(if optarg is NULL, default value 3 is used).
Third, all default values are documented in od info documentation, which is the recommended source of information. 

For details about --strings option, please check "info coreutils 'od invocation'" which is recommended in manual page. If you already did so, feel free to come up with some suggestion, what should be improved/added to info documentation. I doubt man/help will get extended (other than default values, that probably makes sense).

I'll check the rest on Monday... feel free to discuss that with me in the office ;).

Comment 3 Denys Vlasenko 2011-05-24 14:43:34 UTC
(In reply to comment #2)
> First of all, Hi Denys, thanks for report.
> Second, --strings is supposed to have BYTES as optional(if optarg is NULL,
> default value 3 is used).

Yes. The problem is with short forms.

-S WIDTH, WIDTH is not optional:

$ od -S
od: option requires an argument -- 'S'
Try `od --help' for more information.

whereas for -w it is optional:

$ od -w
<waits for input>
^C

$ od -w 123
od: 123: No such file or directory

The last command failed because for opts with optional args, "-wN" and "-w N" mean different things. In this particular case, "-w 123" means "option -w without parameter, followed by argument 123 (filename)".


As it stands now, --help is not merely incomplete, it does not match reality:

"All arguments to long options are mandatory for short options.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not true for -w
  -A, --address-radix=RADIX   decide how file offsets are printed
  -j, --skip-bytes=BYTES      skip BYTES input bytes first
  -N, --read-bytes=BYTES      limit dump to BYTES input bytes
  -S, --strings[=BYTES]       output strings of at least BYTES graphic chars
  -t, --format=TYPE           select output format or formats
  -v, --output-duplicates     do not use * to mark line suppression
  -w, --width[=BYTES]         output BYTES bytes per output line
"

Comment 4 Ondrej Vasik 2011-05-24 15:40:46 UTC
Ok, for -w is --help not correct. It is probably worth of some wording correction. Even in short option format is the value optional. However - in info documentation are all these things sane.

Comment 5 Fedora End Of Life 2013-04-03 20:11:43 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 6 Jan Kurik 2015-07-15 15:16:03 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 7 Jakub Martisko 2016-03-17 12:52:30 UTC
Doing cleanup, this seems to be fixed by upstream commit http://git.savannah.gnu.org/cgit/coreutils.git/commit/src/od.c?id=850aa613e6b040784a9cc1c661bc59d91c315305. Closing CURRENTRELEASE.


Note You need to log in before you can comment on or make changes to this bug.