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

Re: [PATCH 2/5] refs.c: do not die if locking fails in `write_pseudoref()`

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
May 6, 2018, 15:56 UTC
Message-ID
<CAN0heSpfu+070fxhjjccXQpfFnr13O4tvSaj44YWkFWVJL_4mA@mail.gmail.com>
In-Reply-To
<1525621731.16035.11.camel@novalis.org>
On 6 May 2018 at 17:48, David Turner <novalis@novalis.org> wrote:
> On Sun, 2018-05-06 at 16:10 +0200, Martin Ågren wrote:
>> While at it, make the lock non-static.
Show 10 quoted lines
> Re making the lock static, I wonder about the following case:
>
>       if (read_ref(pseudoref, &actual_old_oid))
>
> die("could not read ref '%s'", pseudoref);
>
> I think this calls exit(), and then atexit tries to clean up the lock
> files.  But since lock is no longer static, the stack may have been
> destroyed (I don't actually know whether this is true, so maybe someone
> else does).

Right. After commit 076aa2cbda (tempfile: auto-allocate tempfiles on heap, 2017-09-05) this is safe though. Quite a few locks have already been moved to the stack, e.g., in 14bca6c63c (sequencer: make lockfiles non-static, 2018-02-27) and 02ae242fdd (checkout-index: simplify locking logic, 2017-10-05). I could add a note to the commit message to make this clear, like "After 076aa2cbda, locks no longer need to be static."

Martin
Previous: David TurnerNext: David Turner
Message 3 of 6 in “refs.c: do not die if locking fails in `write_pseudoref()`”
  1. 2/5 refs.c: do not die if locking fails in `write_pseudoref()`Martin Ågren, May 6, 2018
  2. David TurnerMay 6, 2018
  3. Martin ÅgrenMay 6, 2018
  4. David TurnerMay 7, 2018
  5. Jeff KingMay 8, 2018
  6. Stefan BellerMay 7, 2018

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.