15 ms·
Who invented file extensions in file names?
- owlstuffing 3y agoThis is also sort of a flame war topic for some. Divided primarily by those who believe the file’s content should contain the type (or be sampled to infer it) and those who prefer that the file’s name contain the type. More or less.
- netsharc 3y agoI'm already tempted to throw in my arguments. Is it a flame war or a religious debate? E.g. vi vs emacs
- gustavus 3y agoFor those embroiled in this holy war there has come a mediator that has quelled the discord and brough harmony and his name is Doom, Doom Emacs (Seriously if you've been a vimmer for a while and wanted to give emacs a go give Doom Emacs a try and drop hlissner a couple of bucks it's definitly worth it)
- alexvitkov 3y agoYeah, except one side is obviously correct. Not knowing what program will open up when they click a file is insane.
- __MatrixMan__ 3y agoHaving files double as a launcher for some program was a mistake, the result of which is that we not how have to sit through those awful trainings about not clicking untrusted files. Just open the program first. People should fear untrusted programs, but should be at ease viewing data through programs that they trust.
- gmac 3y ago(1) I would find this very annoying. (2) I suspect for lots of files, lots of users wouldn't know which program to open.
- __MatrixMan__ 3y agoI guess I'm not in a good position to judge how annoying it would be for others. I can't remember the last time I let the OS decide how to handle a file type. As for (2)... good. Asking your computer to perform actions that you understand so poorly that you can't figure out what program is going to run is a recipe for disaster. That's the behavior we should be training people to avoid, not merely engaging with suspicious data but doing so recklessly.
- mminer237 3y agoI understand computers plenty well, but I can't envision any scenario where not knowing the default program for a file type would bring disaster. No one should have to memorize what program opens every file, and there's no good way to even learn that information easily. I want to open a photo. Why would I care whether this system uses Shotwell or GNOME Photos or what have you? How would I even learn what's possible? Especially with Linux, there's so much fragmentation that just trying to open the file manager feels like a guessing game of going through all the ones I've heard of to see which works until I finally break down and Google what fork this distro uses. That change would make computers completely unusable beyond Chrome and maybe Office for 99% of people.
- alexvitkov 3y agoYou certainly will care if you double click a .png and suddenly WinRAR opens up, because that .png is actually an ACE archive (application/x-ace-compressed), and guess what ACE stands for - arbitrary code execution! Probably not, but they've had one for 20-ish years: [1] I find that insane, and that's basically what happens on Linux today. [1] https://www.theverge.com/2019/2/21/18234448/winrar-winace-19-year-old-vulnerability-patched-version-5-70-beta-1 https://www.theverge.com/2019/2/21/18234448/winrar-winace-19...
- michaelcampbell 3y agoYou don't REALLY know NOW. You rely on the assumption that the extension->application maps in a given machine are sane.
- alexvitkov 3y agoA string->string table is not that difficult to get right, I've never been surprised by what happens when I open a file in Windows. I could write 10 paragraphs on the thought process which my Linux install goes through as it decides that when I click a .zip file the correct behavior is to open it in Chromium and immediately download it to ~/Downloads.
- mauvia 3y agoI've had this exact kind of problem where windows decides to open picture files in edge because the image preview program doesn't understand it.
- michaelcampbell 3y ago> A string->string table is not that difficult to get right You're correct, which makes it doubly confusing as to why Windows doesn't do it.
- veidr 3y agoNo, just an explicitly-defined metadata field. Inference would be worse than filename extensions (which are awful). I think the original Mac OS fucked us all by implementing this pretty much perfectly in the 1980s, but using their weird HFS "resource forks" to do it so that it not only couldn't be implemented on other platforms, but also lent credence to the "ugh fuck it lets just mangle the file name... and then hide it~!!! wooo000!~!" argument.. ¯\_(ಠ_ಠ)_/¯ UPDATE: My memory was faulty; the "what kind of file is this?" metadata was actually stored as per-file metadata, the "type" and "creator" fields in the HFS(+) filesystem.
- pavlov 3y agoFrustratingly NTFS has had proper metadata support for 30 years but FAT32 was a bag of rotten hacks, so Microsoft couldn’t fix this either even though their forward-looking OS had everything needed.
- veidr 3y agoI know. I'm getting close to 50 years old, and I have lots of *COMPLAINTS!!!* about how various tech (Atari 2600 ~ iPhone 15 Pro Max) worked out. But filesystems seem like the biggest species-level fuckup. Windows had their shit, Mac had HFS then "HFS+" until... tbh, quite breathtakingly, like five minutes ago, When they finally introduced APFS. But like... no checksumming, just Mötley Crüe data integrity, it's all good, iCloud backups FTW amirite!?! ZFS is good; I use it. But it didn't pan out, because a humanity-saving filesystem has to work on the systems humans actually use... (T_T)
- babypuncher 3y agoApple considered using ZFS but decided to build their own because Oracle. I do not blame them one bit.
- veidr 3y agoI don't, either; that Oracle submarine pervert is the worst-remaining tech villain. Nevertheless, Apple built something objectively worse (T_T)
- gus_massa 3y agoFor extra confussion, most files have the info in a header at the begining, but zip files have the info at the end, so someone made a file that is at the same time a valid .pdf and a valivalid .zip. (I can't find the link now.)
- frabert 3y agohttps://www.sultanik.com/cv https://www.sultanik.com/cv
- capableweb 3y agoPOC||GTFO does this with their releases, where the file released usually doubles as multiple file formats, and contains a ton of hidden messages all over the place. https://pocorgtfo.hacke.rs/ https://pocorgtfo.hacke.rs/ From the latest edition (#21): > Technical Note: The electronic edition of this magazine is valid as both PDF and ZIP. Thanks to Ange Albertini, it is also a PCAP-NG packet capture of an experiment by Yannay Livneh. See page 7. Edit: Ah, and of course, Cosmopolitan (by @jart) that produces an amalgamation of formats bundled into one file (including ZIP) that runs across a bunch of OSes https://news.ycombinator.com/item?id=38101613 https://news.ycombinator.com/item?id=38101613
- BobaFloutist 3y agoThat's actually a very fun idea.
- saghm 3y agoThere also used to be an exploit where you could make a file both a valid .jar Java executable and a valid .gif, which back in the days of Java applets would potentially let you execute code when someone loaded your image (e.g. if you uploaded it as your profile picture): https://en.wikipedia.org/wiki/Polyglot_%28computing%29#GIFAR_attack https://en.wikipedia.org/wiki/Polyglot_%28computing%29#GIFAR...
- 13of40 3y agoMy favorite is storing a batch file uncompressed as the first entry in the ZIP archive, because you can rename it with .BAT or .CMD and run it. Sprinkle in some PowerShell and you can make a self extracting archive/installer.
- deleted 3y ago[deleted]
- dylan604 3y agoFilenames are the worst place to store metadata. Even a file's specific metadata fields are not always trust worthy. In the realm of media assets, relying on the file's metadata is a giant footgun. I'm not even talking about anything malicious, as that's designed to attempt to fool people. I'm referring to simple mistakes which would cause incorrect processing down the line if solely depending on metadata. For example, marking the video field dominance as progressive when the content is truly interlaced or vice versa. Even in the world of image uploading via browser, just checking extensions is discouraged. If the feature is that humans can be allowed to manipulate it, it must be sanitized/verified before accepting. This isn't just for text heading for a database.
- pbhjpbhj 3y ago>Filenames are the worst place to store metadata. Where's the best place? It seems like being able to send a file handle to an app without having to open the file nor read a sidecar/db could be quite convenient?
- dylan604 3y agothe problem with depending on metadata alone is just an error prone concept. this could matter more or less depending on the use case. telling a text editor that a plain text file is rich text is much less problematic than telling a video app that a file is 16x9 when it is actually 4x3. saving a tab delimited file as CSV is also going to cause issues if only the extension is used. i'm not saying throw away extensions, as they are great hints, but trust without verifying is not just for politics.
- babypuncher 3y agoThe problem with declaring a file's type in the content itself is that you end up rendering all prior file formats obsolete because they lack this information. The better solution I've seen proposed is to store file type information as metadata in the filesystem itself, but this would lead to compatibility problems with archiving tools and any other scenario where a file is moved between differing file systems. File extensions are the best way to make determining a file type easy without parsing the whole thing while also maintaining cross and backwards compatibility.
- morsch 3y agoIt's getting less relevant as regular users stop using the filesystem directly and instead rely on proprietary services for their data. Google Drive doesn't rely on file extensions. Though for all I know, Microsoft's web stuff does... What's the web equivalent of using a floppy disk to move data between Mac, OS and Windows, I wonder. Downloading to the local computer and uploading, presumably. I guess that is pretty equivalent. Though you can't even download the native representation of a Google (text, spreadsheet, ...) document.
- avgcorrection 3y agoWhy is Java apparently one of the few languages that are brave enough to use four characters in its file extension? “Rust” becomes “rs”.
- tbm57 3y agofewer letters saves valuable developer time typical java, prioritizing verbosity at the expense of efficiency /s
- dmoy 3y ago> /s Not entirely sarcastic though, looking at e.g. DescriptiveFooThingFactoryFactory
- avgcorrection 3y agoConsidering that Java needs a four-letter acronym (POJO) to describe value classes... I think a fancy acronym for fully spelled-out file extensions is in order. The Spelt Out File Extension Pattern?
- duxup 3y agoI used to write all my html files with .htm… apparently that went out of fashion. Edit: I got my htm and html backwards and now comment not sense. Fixed now but obviously the folks below were right / responding to an earlier version.
- veidr 3y agowh... what extension do you use now then
- deleted 3y ago[deleted]
- watermelon0 3y ago.htm is another option, but AFAIK it went out of fashion a long time ago.
- 280877267 3y agofile content contains the type can be read by computer. file name contains the type can be read by human.
- pavlov 3y agoJPEG files should have the extension .jpeg. Fight me.
- belter 3y agoLegacy systems, web norms, and user habits dictate '.jpg' triumphs over '.jpeg' for compatibility, brevity, and conformity....Smack down...
- pavlov 3y agoMy only friend and ally is the macOS standard Image Capture app which writes scanned files with the .jpeg extension. I’m guessing this could even be a NeXT leftover because Image Capture is ancient. The .jpeg extension was more popular on 1990s Unix.
- veidr 3y agoI think almost all Apple apps do this, e.g. Photos.app. Which is super-annoying, even though I agree with in in theory. But generally the only reason I am writing an image to .jpg is to email it to somebody or upload it to some web app and that principled .jpeg filename extension certainly isn't helping compatibility..
- 1024core 3y ago.. and not .JFIF?
- mjcohen 3y agoOriginally extensions were only 3 characters long.
- pavlov 3y agoOriginally as in Unix? I don’t think so. But later on microcomputers in CP/M and thence MS-DOS, yes.
- 3y ago
- daveslash 3y agoI don't know who specifically invented file extensions, but Raymond Chen's The Old New Thing has some good insight into why they are important on Windows. Edit: In summary, it is to be able to support Tape based drives and avoid opening a file "unless a user tells you to". https://news.ycombinator.com/item?id=32811707 https://news.ycombinator.com/item?id=32811707
- tpmx 3y agoJust to be clear: Bill Gates and Microsoft weren't anywhere near inventing this. They bought what was mostly a clone of CP/M and called it PC-DOS/MS-DOS. That's where they got the file extension scheme from. Digital Research (the creators of CP/M) also didn't invent this. For more details, see the stackexchange link.
- gilcot 3y agoThe poorly written clone was QDOS (for quick and dirty)
- PaulHoule 3y agoI remember them on the DEC PDP-8 (I was taking classes at the high school part time in the 4th grade, the high school had one that had those big 8 inch floppy drives) and RSTS/E on PDP-11 early on (spent a lot of time with one at the high school in Milford one summer.) These were on CP/M, a microcomputer OS that was big on high end microcomputers from 1975 to 1985 or so that was the inspiration for MS-DOS which also had them.
- rqtwteye 3y agoIt's always amazing to think that somebody at some point had to invent things we now take for granted and feel like they just have to be that way. As a sidenote it's sad that WinFS failed.
- thriftwy 3y agoWinFS failed because users do not care that much about local files. Cloud is everything. Local files are even easier to lose and even harder to search than cloud.
- dleslie 3y agoIt was shelved in 2006. The product managers must have had incredible foresight if they expected cloud storage to supercede local storage. Hell, try as they might, Microsoft still doesn't have ubiquitous OneDrive usage among Windows users.
- pixelesque 3y agoFirst part I'd agree with: the second part I'm not sure, if only because of my experiences and frustrations of using MS OneDrive as part of my work's O365 integration: it unbelievably seems impossible to actually list all files in the web interface - I can only see "Recent" documents (which are documents I've viewed or opened, not new ones I've added), and I end up having to search to find new documents I've added (i.e. saved from Outlook, or scanned docs from printer), open them, and THEN I can see them in the main doc view. Maybe I'm doing something wrong, but other colleagues have complained about the same thing, so I'm not sure...
- ravenstine 3y agoThat is until The Google inexplicably locks your entire account with no recourse.
- HumblyTossed 3y ago> WinFS failed because users do not care that much about local files. Cloud is everything. This is such a web weenie take. Not everyone lives in the "cloud". So annoying that we have to call it "the cloud".
- linuxontheweb 3y ago[dead]
- SushiHippie 3y agoIsn't this a bit ironic, as GNU/Linux doesn't care about file extensions? OT: why are all your commit messages, "ACK! THBBFT!"? https://github.com/linuxontheweb/linuxontheweb.github.io/commits/main https://github.com/linuxontheweb/linuxontheweb.github.io/com...
- linuxontheweb 3y agoWell, GNU/Linux, as such might not, but the various desktops that run atop it most certainly should care. Re: ACK! THBBFT!: Just my personal ode to Bloom County which I feel must certainly be regarded as the greatest comic strip ever. (I need to wait for others to start coming on board with the project before I worry about doing things for any other reason than pure self-amusement.)
- cafard 3y agoBack 40 years ago, Data General's AOS/VS defined 255 file types. In many cases, maybe all, there was a corresponding extension for the file, e.g. .exe for executables, .txt for text and so on. However, there was a trick that I encountered: copies made not by a CLI command or a properly written utility, say by sending a file over email, did not preserve the type in the filesystem. Then you would try to compile or assemble the code somebody sent you, and get a baffling message about your file being of the wrong type. If you had encountered this before, you would REN xyz.asm xyz.xyz CREATE/TYPE=ASM xyz.asm COPY/APPEND xyz.asm xyz.xyz DEL/V xyz.xyz and go on with your work.
- mixmastamyk 3y agoWow, begging for a script or direct utility.
- user3939382 3y agoWe usually can use file extensions to differentiate files that otherwise share the same name. I once worked on a VAX mainframe OS that to my surprise supported completely duplicate filenames including extension!
- didgetmaster 3y agoUsing file extensions (or having to open the file and inspect contents) to determine file type is a slow way to find files. If you have one of the newest hard drives that is capable of storing 100M+ files on it (or a NAS made up of multiple, smaller drives); then it can take forever to find all files of a certain kind (e.g. photos, documents, etc.). Just try to write a program that lists all your photos. You have to know all the various extensions that apply to still images (.jpg, .jpeg, .gif, .png, etc.) and do a string comparison against every file in the drive hierarchy. Might as well go to lunch waiting for it to finish if you have many millions of files to search. This was the primary reason why I set out to build a better system that could scan through hundreds of millions of files and find all that matched a given subset in just a few seconds. https://www.Didgets.com https://www.Didgets.com
- fooker 3y agoYou seem to go out of your way to avoid mentioning 'index' when that's the usual way to solve this problem.
- didgetmaster 3y agoApparently, your experience with various indexing services has been different than mine. I found it is just too easy for the index to become 'out of sync' with the actual file system and has to be occasionally rebuilt. Even with just 1M files, that always took a long time; but with 100M+ files?? If the storage was removeable or if you booted occasionally with another OS (or even just a different version of the same OS) then I found it was near impossible for an indexing service to keep track of all the changes.
- fooker 3y agoI was curious how slow it was for 1M files and tried it out on XFS and btrfs partitions. It was basically instant without any explicit indexing on my end.
- eviks 3y agoBut Everything does this kind of search instantly on NTFS
- crazygringo 3y agoTangentially related: I find it weird that relating file extensions to GUI document icons still doesn't work intuitively. On my Mac, the document icons for file types still correspond to whatever program I've chosen to open that extension type by default. Which is so strange -- an .mkv file isn't a VLC document; an .mp4 file isn't a QuickTime document, an .mp3 file isn't an Apple Music document, a .jpg isn't a Preview document, and a .tiff isn't a Photoshop document. What the heck? I wish the OS would just define reasonable, attractive, default document icons for every standard file type, that applications couldn't control/overwrite. Reserve application-defined document icons just for those apps who truly have their own proprietary file format (e.g. .psd or .docx).
- ulfw 3y agoTo each their own. I prefer to know which app will open when I double click a file. Seems Apple agrees as that's how it's working on macOS.
- radlad 3y ago100%. Having the icon show what's going to actually open lets me know whether I need to right click and "Open with..."
- Workaccount2 3y agoI'm surprised people are adverse to this on here. Having both the extension and the graphical icon convey the same information is redundant and wasteful.
- crazygringo 3y agoIt's way easier to recognize an icon at a glance, rather than scan the filename to locate and read the extension. And the application icons are often super ugly, and often don't distinguish between the filetypes anyways. Honestly, I'd rather do away with default application handlers altogether, if I've got multiple apps installed for a file type. Every time I double-click on a .jpeg, just ask me if I want to open it in Preview or Photoshop. When it's a .pdf, ask me about Acrobat or Preview. When it's an .mp4, ask me about VLC or QuickTime. I have different reasons for wanting to use a different app each time (do I want to consume or edit, and edit how?), and trying to remember which one is the default handler and when I need to pick the non-default one is cognitive load I don't want to deal with. Especially since the application-specific icons also sometimes don't even always make it clear which app it is. E.g. the IINA player assigns its own dedicated icons to video files, but you'd never guess that they open IINA. Just give me standardized icons that are recognizable at a glance, and let me pick the application I want to use at the moment.
- nashashmi 3y agoMakes for an intriguing concept in a tv show set in an alternate universe (Fringe?), where file extensions are not in the name but in the attributes of the file. You would not need to hide file extensions then.
- CharlesW 3y agoThis is how it worked in (Classic) Mac OS. I’m sad we lost this in (today’s) macOS.
- wazoox 3y agoProDOS on the mighty Apple /// (and also the Apple ][) had a file type metadata back in 1983 :) In fact even Apple DOS 3.1 (1978) supported 8 different file types.
- jdswain 3y agoIt was called SOS on the Apple ///, originally Sara's Operating System but officially Sophisticated Operating System. It was a very advanced OS for its time, most notably one of the first to include a useful driver model. The SOS filesystem was reused for ProDOS (and later GS/OS as well), but a lot of the advanced features were removed for ProDOS due to wanting to fit into the smaller RAM of the Apple ][.
- xkcd-sucks 3y agoSomewhat related, the question of "what IS a file's 'type' really" is pretty messy and AFAIK doesn't have any satisfying solution or any satisfying single answer [0]. A satisfying solution might look like a (long) feature vector. Libmagic goes in the right direction at least although the binary-fingerprint-at-the-beginning approach doesn't work well for everything / past some level of detail [0] where different use cases might be satisfied by e.g. "a text file" "a file exclusively comprised of alphanumeric UTF16 characters" "a CSV file" "a file with tabular data and key-value metadata that calls itself CSV but is not spec-compliant so internally we'll call it CSVprime" "A file with tabular data written as ASCII text that represents $this_kind_of_measurement" ... etc If you have any resources on this topic off the top of your head I'd appreciate it if you shared them
- duped 3y agoGNU file doesn't just check magic numbers against libmagic, it also defines a scripting language and a series of tests/printers written in it. That's what allows it to do complex things, eg identify all the flavors of ELF objects even though they share a magic number or determine if something is JSON or CSV without one.
- prmph 3y agoThe point is that, fundamentally, the concept of a file type is undecidable or not well defined. Think about it: A JSON file can also be considered a text file. It could also be some higher level type of file, depending on whether it conforms to some application-specific JSON schema. Thus the kind of file it is has more to do with what you want to do with it; it's not some intrinsic property of the file.
- LargoLasskhyfv 3y agotl;dr MAD FAP