frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

We Are Doing Files Wrong (2021)

https://simonsafar.com/2021/we_are_doing_files_wrong/
5•Expurple•8mo ago

Comments

jll29•8mo ago
That's one of the few times I've read about a proposed innovation "in the spirit of UNIX" that was not already present in the original UNIX or one of its descendants.

  UNIX: Everything is a file.
  => A directory is a file.

  Parent post: Everything is a directory.
  A file is a directory.
I.e., a switch from "There are files and special files called directories that are handled differently." to the recursive definition "There are files, which are made up of 0..n files (blobs) and 0..n subdirectories" - so file versus directory is just a VIEW.

Makes sense & would make writing traversal code for files wiht internal structure much easier to read and write.

Expurple•8mo ago
> to the recursive definition "There are files, which are made up of 0..n files (blobs) and 0..n subdirectories"

I think, it's more like "a file node contains metadata, a binary blob of data (may be empty), and 0..n child files".

Agreed that this idea is very elegant and removes special cases, nodes become uniform. And the argument for reusing the OS(FS)-provided tree abstraction is compelling.

Although, I can imagine some performance concerns in the real world. If implemented naively and similarly to the existing Unixes, this model results in a lot of small fragmented blocks and separate syscalls+descriptors for dealing with each small file. Also, when the "tree" is actually a sequential array of nameless elements, there's some extra overhead involved with writing and storing made-up file names, as well as sorting by name when reading. This could be remedied by some new API. And a single tree implementation reused by everything could be more cache-friendly than having a userland parser for every "old" format in every application.

Anyway, this mental model is useful and I'd like to see and try out the "automounting" that the author describes.

Expurple•8mo ago
Can't edit the parent comment anymore, so I'll append my other thoughts here.

I remembered that the "automounting" already exists in some forms, and I really like these instances. When you click on an archive in a good file manager, it opens a "folder" view with the archive contents. The difference between an archive and a folder is arbitrary. It shouldn't exist and only complicates things for everybody. I assume that many applications today hand-code the logic for "if the user drags and drops a folder, we need to zip it before sending". Or they don't, and the user has to zip manually :)

One could say that storing program data as "transparent" folders instead of "opaque" binary files is too much detail for the user. And users can accidentally damage something (e.g. delete one of the files inside) more easily. But I have a few counter-points:

1. Many applications already use folders, but they're doing fine.

2. File managers already open many filetypes in an editor by default (e.g. plain text, office docs), but these files are doing fine.

3. A good file manager should recognize most file types and do the more reasonable and safe thing. If JPEG is reimplemented as a folder, clicking on a JPEG should still open the image viewer instead of the folder view. That's already the case with Mac OS app bundles (the example from the original post).

4. Actually, now that folders have a "data" field, it can be used for storing arbitrary metadata. This is extremely powerful and can be used for HIDING extra details from casual users! E.g. there could be a standartized metadata header that hints to the file manager that it should treat the folder as an "opaque" file and not show the user the contents. Now, old applications that already used folders for their internal state, can mark these folders as "opaque" and prevent casual users from messing with the contents! While still allowing to see, move and delete the folder as a whole (unlike hidden folders). And while providing uniform FS access to applications and advanced users.

Man, I really like this idea of arbitrary metadata for folders... It's not as necessary for files, because in practice you can just put the "metadata header" in the beginning of the main "data" (as many file formats do).

Expurple•8mo ago
> I can imagine some performance concerns in the real world.

A friend has pointed out that, for performance reasons, games already tend to sidestep the filesystem and bundle everything into container/archive files, like .pak [1]. It also reminded me of how compile times are often noticeably faster on Linux vs Windows, because its filesystem is better optimized for handling many small files.

Honestly, it's weird and makes me kind of sad. Filesystems are such an important, convenient and (mostly) standardized and portable abstraction. But to this day, it's often a bottleneck and too slow for some domains. It seems like there's a lot of missed opportunity here.

> when the "tree" is actually a sequential array of nameless elements, there's some extra overhead involved with writing and storing made-up file names, as well as sorting by name when reading. This could be remedied by some new API.

As I keep thinking about it, the fastest approach is still a sequential binary blob. It avoids indirection, fragmentation and needlessly storing separate metadata for each element. A VFS mount could still be implemented on top, for accessing elements through a filesystem interface (something like `my_array_file/0`, reporting the same medatata as the parent).

But if storing separate FS-level metadata for each element is actually desirable and indirection+fragmentation isn't a critical problem, we could use folders for arrays. As a partial optimization, we could introduce a special "ordered" folder type. It requires explicitly ordering the subfiles on write, so that later listing the children is sorted and fast by default.

Option 1. The ordering is a separate metadata in the folder. Subfiles still have unique names that are not related to the ordering. This could be useful for the app, or could be unnecessary. POSIX apps (that don't know about "sorted folders") would still re-sort the subfiles by name and could get a different ordering as the result.

Option 2. The subfiles don't have user-provided names. For POSIX-compatibility, the VFS supports "artificial" file names like 0000000, 0000001, 0000002 (the number of digits according to the FS limits, sorts as text correctly) or 0, 1, 2 (prettier, independent of the FS limits and portable, but doesn't sort correctly as text).

In some sense, this special folder type is against the spirit of the original article. It has special write restrictions that prevent treating every inode the same way (as an arbitratily writetable folder). But it's still in the spirit of the original in the sense of reusing the standard FS abstractions and features as much as possible.

[1] https://quakewiki.org/wiki/.pak

Industrialising Code as we know it

https://medium.com/@igorcosta/industrialising-code-as-we-know-it-7d7000aa4b6d
1•igorpcosta•1m ago•1 comments

Repeating fast radio burst shows diverse activity and hints at magnetar origin

https://phys.org/news/2026-01-fast-radio-diverse-hints-magnetar.html
1•wglb•2m ago•1 comments

Why Are Grok and X Still Available in App Stores?

https://daringfireball.net/linked/2026/01/08/grok-x-app-stores
2•chmaynard•5m ago•0 comments

Jupiter's moon Europa lacks undersea activity needed to support life

https://phys.org/news/2026-01-jupiter-moon-europa-lacks-undersea.html
1•wglb•5m ago•1 comments

Videos Contradict Trump Administration Account of ICE Shooting in Minneapolis

https://www.nytimes.com/video/us/100000010631041/minneapolis-ice-shooting-video.html
1•shepherdjerred•7m ago•1 comments

Nanoplastics have diet-dependent impacts on digestive system health

https://phys.org/news/2025-12-nanoplastics-diet-impacts-digestive-health.html
1•PaulHoule•9m ago•0 comments

Why does mint make water taste so cold?

https://theconversation.com/why-does-mint-make-water-taste-so-cold-a-scientist-explains-267550
1•wjb3•9m ago•0 comments

Ruby 4.0 released – but its best new features are not production ready

https://devclass.com/2026/01/06/ruby-4-0-released-but-its-best-new-features-are-not-production-re...
3•thunderbong•12m ago•0 comments

Giant phantom jellyfish spotted deep in Pacific

https://www.popsci.com/environment/giant-phantom-jellyfish-spotted-deep-in-pacific/
2•wjb3•13m ago•0 comments

A.I. Slop Will Crescendo into a Cultural Shift [video]

https://www.youtube.com/watch?v=QyIlxg3z2eQ
1•mooreds•16m ago•0 comments

MiniMax jumps 54% in Hong Kong debut after US$619M IPO

https://www.businesstimes.com.sg/startups-tech/startups/minimax-jumps-54-hong-kong-debut-after-us...
1•dworks•16m ago•0 comments

The week where time stops making sense

https://afterburnout.co/p/the-week-where-time-stops-making-sense
1•mooreds•17m ago•0 comments

The Relation Between Mathematics and Physics – Paul Dirac(1939)

https://www.damtp.cam.ac.uk/events/strings02/dirac/speach.html
1•nill0•18m ago•0 comments

Render AI Revit: AI Rendering for Revit Workflows

https://vocus.cc/article/695f61eafd89780001924d64
1•architech_willy•19m ago•0 comments

This guy raised $40k riding Uber

https://substack.com/inbox/post/183505174
1•haddadda•20m ago•0 comments

The Isolator

https://en.wikipedia.org/wiki/The_Isolator_(helmet)
1•mojoe•21m ago•1 comments

Wilsonic: Open-Source Musical Scale Explorer

https://www.wilsonic.co
2•gyomu•22m ago•0 comments

Account Linking

https://ciamweekly.substack.com/p/account-linking
1•mooreds•22m ago•0 comments

Show HN: Claude Code for Django

https://github.com/kjnez/claude-code-django
1•cui•27m ago•0 comments

Misadventures in Dtrace with macOS

https://jade.fyi/blog/misadventures-in-dtrace/
1•vsgherzi•28m ago•0 comments

I tried to be the government. It did not go well

https://www.theatlantic.com/magazine/2026/02/individual-federal-services-replacement/685333/
1•m-hodges•31m ago•0 comments

Show HN: Executable Markdown files with Unix pipes

3•jedwhite•35m ago•0 comments

Benchmark: Replacing Vector RAG with Context Trees to Fix Gemini Hallucinations

https://www.byterover.dev/blog/why-vector-rag-fails-for-code-we-tested-it-on-1-300-files
1•lanchiii•36m ago•1 comments

Language Modeling, Part 2: Training Dynamics

https://connorjdavis.substack.com/p/language-modeling-part-2-training
1•cjamsonhn•37m ago•0 comments

Global Revolution: Sven Beckert's "Capitalism"

https://www.jdbreport.com/p/sven-beckert-capitalism
1•JameDB•38m ago•0 comments

The Concerning Amount of Malware on the VS Code Marketplace

https://github.com/microsoft/vsmarketplace/blob/main/RemovedPackages.md
3•shadow-ninja•38m ago•0 comments

The JDB Report

https://www.jdbreport.com/
1•JameDB•39m ago•0 comments

Nvidia wants to power robotaxi fleets with chips, software by 2027

https://www.cnbc.com/2026/01/05/nvidia-plans-to-test-a-robotaxi-service-in-2027-in-self-driving-p...
1•gmays•42m ago•1 comments

Apple Watch blood sugar monitoring a step closer as new tech launches

https://9to5mac.com/2026/01/08/apple-watch-blood-sugar-monitoring-a-step-closer-as-new-tech-launc...
5•brandonb•46m ago•0 comments

GPT-4o selected optimal CT protocols more frequently than Radiologists

https://doi.org/10.1148/radiol.252105
1•hdoMRIphysics•47m ago•1 comments