frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

We Are Doing Files Wrong (2021)

https://simonsafar.com/2021/we_are_doing_files_wrong/
5•Expurple•1y ago

Comments

jll29•1y 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•1y 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•1y 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•1y 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

Debian 11 bullseye-security repos have gone missing after botched EOL process

https://lists.debian.org/debian-mirrors/2026/09/msg00001.html
1•superkuh•3m ago•1 comments

Roundup of October 2026 Bootstrapper Events

https://bootstrappersbreakfast.com/2026/09/22/roundup-of-october-2026-bootstrapper-events/
1•skmurphy•3m ago•0 comments

Microsoft drops Copilot+ branding from its new laptops

https://www.tomshardware.com/tablets/microsoft-surface/microsoft-quietly-drops-copilot-branding-f...
3•anthuswilliams•7m ago•0 comments

Build a Real‑Time Telemetry Pipeline for SpaceX Starship Launches

https://thelooplet.com/posts/how-to-build-a-real-time-telemetry-pipeline-for-spacex-starship-laun...
2•killme2008•7m ago•0 comments

You are a 1000x maker, and you can't think of how to make your stack 10x better?

https://twitter.com/josevalim/status/2103751481757216781
4•thunderbong•16m ago•1 comments

Nissan's third generation e-POWER powertrain

https://www.nissan-global.com/EN/INNOVATION/TECHNOLOGY/ARCHIVE/E_POWER_GEN3/
2•mroche•22m ago•0 comments

TabPFN and TabICL vs. tuned XGBoost: the model that doesn't train won 14/14

https://efraingaray.com/en/blog/tabpfn-vs-xgboost/
2•EfrainGaray•26m ago•0 comments

How to build a Jev-style classifier with DiffusionGemma and vLLM

https://medium.com/google-cloud/how-to-build-a-jev-style-classifier-with-diffusiongemma-and-vllm-...
1•teleforce•32m ago•1 comments

Russia hits Ukraine's largest mobile provider, strikes data centres

https://www.reuters.com/business/aerospace-defense/russia-hits-ukraines-largest-mobile-provider-s...
3•giuliomagnifico•34m ago•0 comments

Minecraft beat Minecraft after 2B years

https://www.pcgamer.com/games/survival-crafting/minecraft-beat-minecraft-after-2-billion-years/
1•morder•35m ago•0 comments

New Domain:)

https://www.base31.org/
1•notam•36m ago•2 comments

Ruby-lean: A Ruby semantics with a type soundness proof

https://samx.io/blog/topics/devlog/2026-09-26-ruby-lean.html
1•samxif•40m ago•0 comments

Musk, the Movie

https://bleeckerstreetmedia.com/musk
5•yablak•41m ago•0 comments

Emotional Well-Being on ChatGPT

https://arxiv.org/abs/2504.03888
2•lasky•44m ago•1 comments

The next AI breakout will come from a services firm

https://www.introspection.dev/manifesto
2•asasidh•44m ago•0 comments

Claude Generated Summary on Sri Lanka Batalanda Commission of Inquiry

https://claude.ai/artifact/4xzcAXCXwFTeMSopXhJjvk
2•kharon•47m ago•0 comments

Owed a billion dollars in Nvidia stock

https://colo.to/nvidia-stock-narrative.html
27•Eric_Gullichsen•48m ago•8 comments

Fool's Expertise

https://bcantrill.dtrace.org/2026/09/27/fools-expertise/
2•elffjs•49m ago•1 comments

Internal Weather

https://alearningaday.blog/2026/09/26/internal-weather-3/
2•JumpCrisscross•55m ago•0 comments

When Back-to-School Shopping Includes Bulletproof Backpacks

https://www.nytimes.com/interactive/2026/09/21/magazine/shooting-fears-school-equipment.html
2•bookofjoe•57m ago•1 comments

Comet SWAN26Q – The unconfirmed Scout object warrants monitoring, not concern

https://www.astrophyzix.com/2026/09/SWAN26Q-NEOCP-Report.html
4•JEOFFEZZ•1h ago•0 comments

Goodbye to the Hard Parts That Never Mattered

https://jakegoldsborough.com/blog/2026/goodbye-to-the-hard-parts-that-never-mattered/
2•JumpCrisscross•1h ago•0 comments

Show HN: I made a tool that turns Jetpack Compose Previews to embeddable scripts

https://composables.com/
1•alexstyl•1h ago•0 comments

OpenRig: Multi-Agent Harness

https://github.com/mvschwarz/openrig
2•handfuloflight•1h ago•0 comments

Behold the pawpaw, the tropical 'alien banana' that grows right here in Canada

https://www.cbc.ca/radio/thecurrent/pawpaw-tropical-fruit-canada-9.7356882
7•BiraIgnacio•1h ago•0 comments

OpenAI pauses top-model work after AI bypasses internet safeguards [video]

https://www.youtube.com/watch?v=a1qnCu1t9hI
1•kbn•1h ago•0 comments

PostgreSQL 19's "scary patch contest"

https://lwn.net/Articles/1092003/
1•pykello•1h ago•0 comments

(Book) When It Goes Wrong: What Angels and Founders Do Next

https://susanjmontgomery.substack.com/p/when-it-goes-wrong-what-angels-and
2•mgav•1h ago•0 comments

Show HN: Guess which repository has more GitHub stars

https://higherlower.focuslab.pk/
1•alexander2002•1h ago•0 comments

In preparation for Wow Forever, here is a guided tour of Warcraft

https://ryeceps.github.io/azeroth-chronicle/
3•carnufex•1h ago•0 comments