file-4.01 bug...

Kelledin kelledin+LFS at skarpsey.dyndns.org
Mon Mar 31 23:47:20 PST 2003


The behavior of file apparently changed somewhere between 3.41 
and 4.01 WRT the -L option:

1) Symlinks are now automatically followed, and I can find no way 
   to turn this off.  I gather from the man page that this wasn't 
   intended, and even if it was, it's bad behavior.

2) Symlink followage code seems to be b0rked.  Following a 
   symlink doesn't work for relative symlinks unless the file 
   pointed to by the symlink exists relative to the current 
   directory--i.e. if /usr/bin/purgestat is a symlink to 
   ../sbin/sendmail, file can follow the /usr/bin/purgestat 
   symlink only from an immediate subdirectory of /usr (such as 
   /usr/src or /usr/bin, but NOT /usr/local/bin).

A brief perusal of the code (mainly by grepping for lstat) 
suggests that a certain flag check got turned the wrong way.  I 
invert the comparison, and both problems go away.  w00t!

I've attached a patch for what I did...

-- 
Kelledin
"If a server crashes in a server farm and no one pings it, does 
it still cost four figures to fix?"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-4.01-lstat.patch
Type: text/x-diff
Size: 428 bytes
Desc: not available
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20030401/b6ebe4dd/attachment.patch>


More information about the lfs-dev mailing list