git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Turner <novalis@novalis.org>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 2/5] refs.c: do not die if locking fails in `write_pseudoref()`
Date: Mon, 07 May 2018 05:12:27 -0600	[thread overview]
Message-ID: <01AF002E-C9E2-48FB-97AB-D9D903866310@novalis.org> (raw)
In-Reply-To: <CAN0heSpfu+070fxhjjccXQpfFnr13O4tvSaj44YWkFWVJL_4mA@mail.gmail.com>



On May 6, 2018 9:56:31 AM MDT, "Martin Ågren" <martin.agren@gmail.com> wrote:
>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.
>
>> 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.

  reply	other threads:[~2018-05-07 18:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-06 14:10 [PATCH 2/5] refs.c: do not die if locking fails in `write_pseudoref()` Martin Ågren
2018-05-06 15:48 ` David Turner
2018-05-06 15:56   ` Martin Ågren
2018-05-07 11:12     ` David Turner [this message]
2018-05-08 18:08       ` Jeff King
2018-05-07 18:48 ` Stefan Beller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01AF002E-C9E2-48FB-97AB-D9D903866310@novalis.org \
    --to=novalis@novalis.org \
    --cc=git@vger.kernel.org \
    --cc=martin.agren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).