On May 6, 2018 9:56:31 AM MDT, "Martin Ågren" <martin.agren@xxxxxxxxx> wrote: >On 6 May 2018 at 17:48, David Turner <novalis@xxxxxxxxxxx> wrote: >> On Sun, 2018-05-06 at 16:10 +0200, Martin Ågren wrote: >>> While at it, make the lock non-static. > >> 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." I am going to reply now to keep the thread moving, but I am on my phone with bad connectivity (few cell towers in Bears Ears), so I can't really check the code. Feel free to disregard if I am still wrong. I saw that patch, but I thought the new logic required that cleanup funtions be called before the lock goes out of scope. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.