View Issue Details

IDProjectCategoryView StatusLast Update
0000029fileGeneralpublic2018-12-10 21:16
ReporterDave_Anderson Assigned Tochristos  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformMacOSMacOSOS Version10.13.6
Fixed in Version5.36 
Summary0000029: file command does not default to "don't follow symlinks" as claimed in --help
DescriptionNormally when I point the file command to a symlink I expect file output to indicate that I did so. Instead file tells me what it knows about the file that the the symlink is pointing to. Note that if I provide -h the behavior is as expected. Unfortunately the default acts as though I passed -L:

DAs-MacBook-Pro:~ DA$ file --version
file-5.31
DAs-MacBook-Pro:~ DA$ file --help
Usage: file [OPTION...] [FILE...]
Determine type of FILEs.

      --help display this help and exit
.
.
.
  -L, --dereference follow symlinks
  -h, --no-dereference don't follow symlinks (default)
 .
 .
 .
 DAs-MacBook-Pro:~ DA$ file `which python3`
/usr/local/bin/python3: Mach-O 64-bit executable x86_64
DAs-MacBook-Pro:~ DA$ file -L `which python3`
/usr/local/bin/python3: Mach-O 64-bit executable x86_64
DAs-MacBook-Pro:~ DA$ file -h `which python3`
/usr/local/bin/python3: symbolic link to ../Cellar/python/3.7.0/bin/python3
DAs-MacBook-Pro:~ DA$ which python3
/usr/local/bin/python3
DAs-MacBook-Pro:~ DA$ ls -l /usr/local/bin/python3
lrwxr-xr-x 1 DA admin 34 Aug 15 11:38 /usr/local/bin/python3 -> ../Cellar/python/3.7.0/bin/python3
DAs-MacBook-Pro:~ DA$ file /usr/local/bin/python3
/usr/local/bin/python3: Mach-O 64-bit executable x86_64
DAs-MacBook-Pro:~ DA$
Steps To ReproduceSee above. Simply run the following:

file <full pathname of symlink>

or

file <relative pathname of symlink>
TagsNo tags attached.

Activities

Dave_Anderson

2018-08-15 19:20

reporter   ~0000059

Unsure of this project's pri/sev definitions; please correct as needed.

christos

2018-08-20 16:07

manager   ~0000067

Unfortunately I fix vendor-provided versions...

MacOS/X:
[11:58am] 3248>file -v
file-5.31
magic file from /usr/share/file/magic
[11:58am] 3249>ln -s /dev/null fol
[11:58am] 3250>file fol
fol: character special (3/2)
[11:58am] 3251>uname -a
Darwin vpn1-1.astron.com 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
[11:58am] 3252>

NetBSD
[11:59am] 222>file -v
file-5.30
magic file from /usr/share/misc/magic
[11:59am] 223>ln -s /dev/null fol
[12:01pm] 224>file fol
fol: symbolic link to /dev/null
[12:02pm] 236>./file -v
file-5.34
magic file from /usr/local/share/misc/magic
[12:02pm] 237>./file ~/fol
/u/christos/fol: symbolic link to /dev/null
[12:02pm] 225>uname -a
NetBSD rebar.astron.com 7.99.59 NetBSD 7.99.59 (GENERIC) amd64


Dave_Anderson

2018-08-20 18:26

reporter   ~0000068

Not sure what that means.

What does vendor-provided mean? if file was provided by Apple(a vendor?) why would it be unfortunate that you will fix it?

christos

2018-08-23 09:45

manager   ~0000069

The version I supply works as advertised. The version Apple supplies works differently as we've found out. I don't know why Apple changed it. I don't control what Apple distributes (the note about should read I *cannot* fix vendor supplied versions).

Dave_Anderson

2018-08-23 18:25

reporter   ~0000070

Thanks. Workaround implemented as follows:

DAs-MacBook-Pro:~ DA$ cat ~/.bash_profile
...
alias file='file -h'
...

-L can override as intended:

DAs-MacBook-Pro:~ DA$ file `which python3`
/usr/local/bin/python3: symbolic link to ../Cellar/python/3.7.0/bin/python3
DAs-MacBook-Pro:~ DA$ file -L `which python3`
/usr/local/bin/python3: Mach-O 64-bit executable x86_64

christos

2018-12-10 21:16

manager   ~0000112

Requester has work-around.

Issue History

Date Modified Username Field Change
2018-08-15 19:18 Dave_Anderson New Issue
2018-08-15 19:20 Dave_Anderson Note Added: 0000059
2018-08-20 15:59 christos Assigned To => christos
2018-08-20 15:59 christos Status new => assigned
2018-08-20 16:07 christos Status assigned => feedback
2018-08-20 16:07 christos Note Added: 0000067
2018-08-20 18:26 Dave_Anderson Note Added: 0000068
2018-08-20 18:26 Dave_Anderson Status feedback => assigned
2018-08-23 09:45 christos Note Added: 0000069
2018-08-23 18:25 Dave_Anderson Note Added: 0000070
2018-12-10 21:16 christos Status assigned => resolved
2018-12-10 21:16 christos Resolution open => fixed
2018-12-10 21:16 christos Fixed in Version => 5.36
2018-12-10 21:16 christos Note Added: 0000112