[Magic-dev] ~/.magic breaks UNIX 'file' command on OS X

Jeff Sondeen sondeen at ISI.EDU
Thu May 19 13:01:29 EDT 2005



i'll add 2 cents to show that fedora3 /usr/ucb/file first looks at
~/.magic then the other locations...

% strace file somefile
...
stat64("/nfs/div1/sondeen/.magic", 0xbfffd7b0) = -1 ENOENT (No such file or directory)
open("/usr/share/magic.mgc", O_RDONLY|O_LARGEFILE) = 3


/jeff

Spaceborne Calin writes:
 > --- David Fang <fang at csl.cornell.edu> a écrit :
 > 
 > > Hi all,
 > > 	I've discovered that a .magic file sitting in one's home directory
 > > can break the UNIX 'file' command which is frequently used to check
 > > the
 > > contents of libraries during compiles/builds.  (Incidentally, this
 > > isn't
 > > mentioned in the FILES section of the 'file' man pages I've checked.)
 > > Those of you who use fink (http://fink.sourceforge.net/) on OS X may
 > > encounter problems building packages with shared libraries because
 > > the
 > > builds depend on a working 'file' command, somewhere during linking.
 > > (You'll see a verbose warning about libraries missing functionality,
 > > and
 > > only static libraries being generated -- then later, death when it
 > > can't
 > > mv a missing .dylib.)
 > > 	I suspect that this may affect other variants of 'file' on other
 > > *nix,*BSD platforms, but I haven't confirmed.  If your 'file' command
 > > returns:
 > >
 > 
 > This is the first time i hear about it. Since is not documented in file
 > man
 >  page on OSX it's a bug in file on OSX.
 > 
 > On linux I never had that problem. I checked on internet for other
 > systems 
 > and at least OpenBSD, HP-UX, IRIX, Solaris  don't have the problem that
 > 
 > you describe.
 > 
 >  
 > > 	% file
 > > 	file: could not find any magic files!
 > > 
 > 
 > This is a bug. file on unix systems reads /etc/magic not ~/.magic
 > 
 > > then you have a problem.  The obvious workaround of course, is to
 > > move
 > > .magic out of the way during such compiles.  Has this been a known
 > > problem?  Perhaps someone with more knowledge on the subject could
 > > offer a
 > > better solution?
 > > 
 > 
 > This has never been a problem. I know magic from about 5 years and
 > never 
 > heard of such a problem.
 > 
 > Sidenote: maybe it's an undocumented behaviour if it doesn't have a 
 > /etc/magic file to look in home directory for a ~/.magic file.
 > Do you have a /etc/magic file ?
 > 
 > Calin
 > 
 > 
 > 	
 > 
 > 	
 > 		
 > _____________________________________________________________________________ 
 > Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos mails, photos et vidéos ! 
 > Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com
 > _______________________________________________
 > magic-dev mailing list
 > magic-dev at vlsi.cornell.edu
 > http://vlsi.csl.cornell.edu/mailman/listinfo/magic-dev



More information about the magic-dev mailing list