Re: curiosities with tempfile.active
- From
Chris Torek <chris.torek@gmail.com>
- Date
- Aug 27, 2022, 21:47 UTC
- Message-ID
- <CAPx1Gvddmk8cfWGg7M8gJ=rxnoTgQRgQNX95BgYcQk1N3VUi8A@mail.gmail.com>
- In-Reply-To
- <YwoV9/xAcWTRbUBG@coredump.intra.peff.net>
On Sat, Aug 27, 2022 at 6:05 AM Jeff King <peff@peff.net> wrote:
> Yeah, I saw that. It's a bit vague, and if the call returns ENOSYS or > EISDIR, that would be perfectly fine. It's the "what happens on the > implementations that do support it..." part that I'm more worried about. :)
The history here is that pre-4.2BSD, Unix systems had no mkdir system call. You used mknod() to make a truly empty directory and the link() to create the "." and ".." entries within it, and all three of these operations were restricted to the super-user. There was no rmdir either, so again, unlink() as the super-user was permitted to do the job (with three calls to unlink the "." and ".." entries first and then remove the directory).
Unlinking a directory when it still contains "." leaves the link count at 1 and there's no GC, so it sits around occupying an inode.
If you have a mkdir() system call and don't need backwards compatibility, you get to have these return EISDIR errors...
Chris