Remix.run Logo
somat 2 hours ago

It is double weird because unix has always supported this.

I think was an accident of how the unix filesystem was implemented but basically, every file has at least one name but can have as many as you want, if a file ever has zero names it gets deleted. note that every open file is considered an additional name for that file.

By accident, I don't think it was designed this way but as they were putting together the filesystem "hey, what happens if two directories entries point to the same data?" anyone else "We will make a complicated locking system to prevent that from happening" the unix madlads "ship it and call it a feature, hell, work it into how files are opened as well then you can do tricksy stuff like open a file then delete it so it does not exists anywhere in the filesystem but it is still on disk"

The funny, in an ironic sense, thing is that while this this sort of naturally fell out of the first design of the unix filesystem it is not natural at all to modern copy-on-write filesystems, they have to do contortions to support it, but they do because it is now what people expect.