Date: 2014-05-21 09:42 pm (UTC)
From: (Anonymous)
> it requires correct file extensions to show file contents while Linux examines the file contents directly only using the extension as a hint.

I've seen this comment several times in relation to this article.

First, this is simply not correct. OS X uses UTIs (and prior to that, and in Classic, used creator codes). OS X infers UTIs from extensions - and this is the most common source for UTIs for filenames - but they can also be set in other ways and are used by "filename-less" things like the clipboard. Think of a UTI like a tagged union of possible MIME types and filename extensions. https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-CHDHIJDE

And this is the right way to do it. Looking at the file contents without the extension simply doesn't work. If I name a file with .oga I want it to open in an audio player; .ogv, a video player. But these can have the same MIME type, and neither is trivially identifiable from the contents. Or any of the thousand formats that are just a zip file. You _need_ filename extensions to make the right choice; I don't want to extract cbz files and I don't want to open source archives in my comic reader, and _nothing_ about the contents of the file will tell you which it is.

"Using the extension as a hint" is meaningless. Either you're using the extension, and you should follow it even if the file doesn't "look right" because why should there be a tool that knows how to parse literally every kind of file to make sure it "looks right"? Or you're not and that's terrible because now someone tricked the user into running trojan.jpg as a script.

It's something of a shame that file extensions are part of the file name. But it's not a shame that there's a visible, default, user-editable, otherwise vapid tag on every file that determine what application it will open with.

This kind of user-hostile focus on shallow and actually totally arbitrary "technical correctness" is one of the things that actually makes the GNU/Linux desktop inhospitable. Glyf outlined other good ones.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

Matthew Garrett

About Matthew

Power management, mobile and firmware developer on Linux. Security developer at Aurora. Ex-biologist. [personal profile] mjg59 on Twitter. Content here should not be interpreted as the opinion of my employer. Also on Mastodon.

Expand Cut Tags

No cut tags