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•11mo ago

Comments

jll29•11mo 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•11mo 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•11mo 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•11mo 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

I was paid to write fake Google reviews – then my 'bosses' tried to scam me

https://www.theguardian.com/technology/2026/mar/27/paid-write-fake-google-reviews-scammer-cryptoc...
1•mykowebhn•2m ago•0 comments

Study: Space no gravity negatively impact sperm navigation, affecting childbirth

https://adelaideuni.edu.au/about/news/2026/human-sperm-may-get-lost-in-space/
1•giuliomagnifico•6m ago•0 comments

Show HN: HTML Viewer with Bidirectional Highlighting (Code ↔ Highlight Element)

https://html-viewer.org
1•jackxmm•6m ago•0 comments

Blog: Book on AI Agents for the Layman

https://www.investigatingsoftware.co.uk/2026/03/the-best-book-on-ai-agents-for-layman.html
2•phoughton•9m ago•0 comments

Should QA Exist

https://www.rubick.com/should-qa-exist/
4•PretzelFisch•15m ago•1 comments

Riding the Memory Boom and Trying to Avoid the Bust

https://www.nextplatform.com/store/2026/03/24/riding-the-memory-boom-and-trying-to-avoid-the-bust...
3•rbanffy•16m ago•0 comments

Taking Down the Internet's Most Popular HTTP Client with a Single JSON Key

https://www.striga.ai/research/crashing-axios-with-proto
4•traekfuglene•16m ago•1 comments

Pyrite64: N64 Game-Engine and Editor using libdragon and tiny3d

https://github.com/HailToDodongo/pyrite64
2•hexmiles•17m ago•0 comments

ninja: a small build system with a focus on speed

https://github.com/ninja-build/ninja
1•tosh•19m ago•0 comments

Show HN: GameHippo.art – Preserving a lost freeware game directory from 2004

https://gamehippo.art
1•hedin_hiervard•19m ago•0 comments

Scaling a Monolith to 1M LOC: 113 Pragmatic Lessons

https://www.semicolonandsons.com/articles/scaling-a-monolith-to-1m-loc-113-pragmatic-lessons-from...
1•semicolonandson•19m ago•0 comments

Ask HN: Any Tradespeople Here?

3•documentorium•30m ago•0 comments

Hold on to Your Hardware

https://xn--gckvb8fzb.com/hold-on-to-your-hardware/
14•LucidLynx•32m ago•3 comments

Ten C64 Demo [video]

https://www.youtube.com/watch?v=QMDE_Sd98cA
1•Fr0styMatt88•32m ago•0 comments

Comparison of two frameworks: 4.0M vs. 2.5M tokens for the same app

https://wasp.sh/blog/2026/03/26/nextjs-vs-wasp-40-percent-less-tokens-same-app
2•Martinsos•34m ago•1 comments

SimpleLogin CLI

https://github.com/mexcool/simplelogin-cli
1•mexcool•36m ago•0 comments

Chronoo – a web-based journaling app where data is stored locally in the browser

https://github.com/altilunium/chronoo
1•altilunium•41m ago•0 comments

Show HN: Walkie-Talkie – Access your terminal from any browser with one command

https://www.walkie-talkie.dev/
1•vochsel•42m ago•0 comments

Noelia Castillo Euthanasia Case

https://en.wikipedia.org/wiki/Noelia_Castillo_euthanasia_case
3•stared•43m ago•0 comments

See what your AI agents are doing (multi-agent observability tool)

https://github.com/hit1001/multiagent-visibility-tool
1•denhit10•44m ago•0 comments

Show HN: Writevoid.com – stop writing, and the void takes it

https://writevoid.com
1•user_timo•46m ago•1 comments

Data centre to be built near planned Polish nuclear power plant

https://world-nuclear-news.org/articles/data-centre-to-be-built-near-planned-polish-nuclear-power...
1•mpweiher•48m ago•0 comments

Ipxlat: a stateless IPv4/IPv6 translation device

https://lore.kernel.org/netdev/20260319151230.655687-1-ralf@mandelbit.com/T/#m6b6603d690f9bd7f85c...
1•argulane•50m ago•0 comments

I built Amazon dynamo in elixir

https://jitesh117.github.io/blog/implementing-amazon-dynamo-in-elixir/
1•Jitesh117•50m ago•0 comments

A discrete-logic solution to the Three-Body Problem (99% compute saving)

https://github.com/alikamp/Parks-Node-Ejection-Protocol
2•kauai1•52m ago•1 comments

Splitflap.org: open-source split-flap display for any screen

https://splitflap.org/
1•mohdmahmodi•52m ago•0 comments

You shall know them by their scams

https://terminaldrift.substack.com/p/you-shall-know-them-by-their-scams
1•limbicsystem•55m ago•0 comments

Show HN: 10 Lines of Python to fix mangled copy-paste from Claude Code

1•collectedparts•56m ago•0 comments

Ronda Rousey Fights Like an Outlier (2015)

https://fivethirtyeight.com/features/ronda-rousey-fights-like-an-outlier/
1•chistev•57m ago•1 comments

Understanding the Go Runtime: The Garbage Collector

https://internals-for-interns.com/posts/go-garbage-collector/
1•valyala•57m ago•0 comments