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

Re: curiosities with tempfile.active

From
Jeff King <peff@peff.net>
Date
Aug 30, 2022, 18:56 UTC
Message-ID
<Yw5dT6I7QKkfuQAF@coredump.intra.peff.net>
In-Reply-To
<CAPx1Gvddmk8cfWGg7M8gJ=rxnoTgQRgQNX95BgYcQk1N3VUi8A@mail.gmail.com>
On Sat, Aug 27, 2022 at 02:47:45PM -0700, Chris Torek wrote:
Show 15 quoted lines
> 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.

Thanks, that matches the sense of unease I had in the back of my mind. I seem to recall that maybe older versions of SunOS exhibited this, but that feels like a lifetime ago. At any rate, we should avoid that unlink() call, and René's patch neatly does so.

-Peff
Previous: Chris TorekNext: Jeff King
Message 5 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.