This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"file" command missing magic file (problem and solution)


I encountered the following problem with command "file" in CYGWIN_NT-5.1 v1.7.7 on a PC running Windows XP Professional. It took me half an hour to figure out what the issue was so I thought I will share this and hopefully spare others from having to go through the same. I have done a quick check on the mailing list archive and could not locate similar reports but I have to admit that I did not look very deep as the keyword "file" got tons of irrelevant hits. So I apologize if this has already been reported.

The CYGWIN v1.7.7 distribution includes the command "file" (not part of the default core installation, you have to select it separately) and the version of "file" in this distribution is 5.04. The binary installation completed without any issue but when I tried to recreate the magic file "magic.mgc" (I need to add custom strings to it) using command "file -C", "file" came back with an error that it could not find any magic file. I rolled back one version to 5.00 and got the same error. I have three other machines running older distributions of CYGWIN (2004/2005) which have "file" versions 4.16 and 4.20, both contained the file /usr/share/file/magic in the binary distribution. I copied the "magic" file from version 4.16 to the 5.04 installation and still got the same error. I even downloaded the source to rebuild the binaries hoping it will regenerate the magic file but it didn't. I finally discovered the root cause after taking a closer look at the source documentation.

Apparently, somewhere between version 4.xx and 5.xx, the magic file which used to be /usr/share/file/magic (all my Unix life I knew magic as an ASCII text file), has now become a directory /usr/share/misc/magic/ with many small files for ease of maintenance. It also happens that this directory "magic" is NOT part of the binary distribution (you only get /usr/bin/file.exe, man page and /usr/share/misc/magic.mgc). After I copied the entire magic directory from the source distribution to /use/share/misc, "file -C" works fine and recreated magic.mgc no problem.

It would be nice if future binaries distribution of CYGWIN will include the directory /usr/share/misc/magic and all the files within it.

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]