[plug] MIME Types by file contents
Bernd Felsche
bernie at innovative.iinet.net.au
Sat Jul 3 10:52:54 WST 2004
On Saturday 03 July 2004 05:37, Onno Benschop wrote:
> On Fri, 2004-07-02 at 22:55, Bernd Felsche wrote:
> > Using "file -bi ~/* | sort -u"
> Note of caution. I once had the same problem, but in PHP. My
> solution was also to use the file command, but it wasn't working
> in Solaris. Then I found out that there are multiple version of
> file.
Of course.
[snip]
> All I'm saying is that while I also used file as a solution, it's
> evil, bad, subject to breaking and cause for palpitations.
It's somewhat less evil than relying on filename extension.
And much less evil than simply assuming a file type.
Unless one carries reliable, "out-of-band" file-type identification,
any method will be less than perfect. Even then; an application
fault may cause file content type to be mis-identified.
The consequences of mis-identification can be so trivial as not to
be noticeable; or can be catastrophic (vis Windows worms). It really
depends on the sensitivity of the use of the type identification.
--
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ / ASCII ribbon campaign | I'm a .signature virus!
X against HTML mail | Copy me into your ~/.signature
/ \ and postings | to help me spread!
More information about the plug
mailing list