Bug 72758

Summary: "file" doesn't use getopt_long() though provided in source
Product: [Retired] Red Hat Raw Hide Reporter: Moritz Barsnick <moritz>
Component: fileAssignee: Trond Eivind Glomsrxd <teg>
Status: CLOSED WONTFIX QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: low    
Version: 1.0Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-08-27 14:33:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch against 3.38 to provide proper native and alternatively internal getopt_long() support; need to re-run auto{make,conf,header}!
none
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 none

Description Moritz Barsnick 2002-08-27 14:27:06 UTC
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 14:30:03 UTC
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 14:33:00 UTC
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 16:01:05 UTC
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 :)