git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Jeff KingNext: Jeff King
Message 4 of 8 in “curiosities with tempfile.active”
  1. Jeff KingAug 24, 2022
  2. René ScharfeAug 26, 2022
  3. Jeff KingAug 27, 2022
  4. Chris TorekAug 27, 2022
  5. Jeff KingAug 30, 2022
  6. 0/2 cleaning up tempfile active flagJeff King, Aug 30, 2022
  7. 1/2 tempfile: drop active flagJeff King, Aug 30, 2022
  8. 2/2 tempfile: update comment describing state transitionsJeff King, Aug 30, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.