Bug 72758 - "file" doesn't use getopt_long() though provided in source
"file" doesn't use getopt_long() though provided in source
Status: CLOSED WONTFIX
Product: Red Hat Raw Hide
Classification: Retired
Component: file (Show other bugs)
1.0
All Linux
low Severity medium
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
Mike McLean
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-08-27 10:27 EDT by Moritz Barsnick
Modified: 2007-03-26 23:56 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-08-27 10:33:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch against 3.38 to provide proper native and alternatively internal getopt_long() support; need to re-run auto{make,conf,header}! (44.93 KB, patch)
2002-08-27 10:30 EDT, Moritz Barsnick
no flags Details | Diff
patch against 3.38 to provide proper native and alternatively internal getopt_long() support; configure.in and Makefile.in have already been updated in this patc, alas using automake 1.4-p2 and autoconf 2.13h (68.78 KB, patch)
2002-08-27 10:33 EDT, Moritz Barsnick
no flags Details | Diff

  None (edit)
Description Moritz Barsnick 2002-08-27 10:27:06 EDT
Description of Problem:

The essential "file" command has support for long options
in its source, e.g. line 185 of file.c in file-3.39. Yet both
on platforms with (e.g. Linux/glibc) or without ;-) getopt_long(),
this support isn't used.

Version-Release number of selected component (if applicable):

file-3.37-8 and all earlier versions, presumably.

How Reproducible:

Running RedHat's precompiled "file": Always
Building "file": Always, at least on Linux/RedHat 7.2 and Solaris

Steps to Reproduce:
1. run "file"
2. 
3. 

Actual Results:

barsnick@serv002:~/soft > file --help
file: invalid option -- -
file: invalid option -- h
file: invalid option -- e
file: invalid option -- l
file: invalid option -- p
Usage: file [-bciknvzL] [-f namefile] [-m magicfiles] file...


Expected Results:

barsnick@serv002:~/soft > file --help
Usage: file [OPTION]... [FILE]...
Determine file type of FILEs.

  -m, --magic-file LIST      use LIST as a colon-separated list of magic
                               number files
  -z, --uncompress           try to look inside compressed files
  -b, --brief                do not prepend filenames to output lines
  -c, --checking-printout    print the parsed form of the magic file, use in
                               conjunction with -m to debug a new magic file
                               before installing it
  -f, --files-from FILE      read the filenames to be examined from FILE
  -i, --mime                 output mime type strings
  -k, --keep-going           don't stop at the first match
  -L, --dereference          causes symlinks to be followed
  -n, --no-buffer            do not buffer output
  -s, --special-files        treat special (block/char devices) files as
                             ordinary ones
      --help                 display this help and exit
      --version              output version information and exit


Additional Information:
	
I noticed this on a platform with getopt() yet without getopt_long(),
where this result is okay. I patched getopt_long() support into "file"
according to the instructions in the "gengetopt" package. (The license
is okay [file <-> getopt*.{c,h}], IMHO. Please check, IINAL.) That
worked fine. Checked on Linux, noticed the long options where missing
as well, although there's a check for HAVE_GETOPT_H, which is not
only insufficient (IMHO, again), but obviously also wrong. My patch
for non-getopt_long() platforms works fine on Linux/RedHat though.
:-) I had submitted my patch vs. 3.38 to the author on May 24th, 2002,
but it didn't get integrated into 3.39. Hope it'll make it into
RedHat now. :)

BTW, RedHat is still distributing 3.37, but 3.39 is current.

Patches will follow in a moment (one without a re-run of the auto*
chain, one with a re-run, which is obviously essential, but which you
should do with your current auto* chain or integrate into the spec
file's %build section).

Thanks for listening,
Moritz
Comment 1 Moritz Barsnick 2002-08-27 10:30:03 EDT
Created attachment 73344 [details]
patch against 3.38 to provide proper native and alternatively internal getopt_long() support; need to re-run auto{make,conf,header}!
Comment 2 Moritz Barsnick 2002-08-27 10:33:00 EDT
Created attachment 73345 [details]
patch against 3.38 to provide proper native and alternatively internal getopt_long() support; configure.in and Makefile.in have already been updated in this patc, alas using automake 1.4-p2 and autoconf 2.13h
Comment 3 Trond Eivind Glomsrxd 2002-08-28 12:01:05 EDT
long options aren't mentioned in the man page either... think it's best to leave
it off for now. Lobby the upstream author, I'm sure he'd love your patch :)

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