Thread (16 messages) flat view 16 messages, 4 authors, 2016-06-15

Re: [PATCH 2/2] lock_packed_refs(): allow retries when acquiring the packed-refs lock

From: Michael Haggerty <hidden>
Date: 2016-06-15 23:04:43

On 05/02/2015 11:43 PM, Johannes Sixt wrote:
Am 02.05.2015 um 05:47 schrieb Michael Haggerty:
quoted
On 05/01/2015 06:13 PM, Johannes Sixt wrote:
quoted
How about this:

     test_when_finished "wait; rm -f $LOCK" &&
     { sleep 1 & } &&
     ...
Thanks for pointing out this problem. Your suggestion seems good. I
assume that you didn't intend to omit the "rm -f $LOCK" from the
subprocess, because the whole point is for that to happen while "git
pack-refs" is running.
I see. So, if git pack-refs works correctly, it waits for the
sub-process, and the 'wait' in test_when_finished does not buy a lot. If
there is breakage, the trash directory is not attempted to be removed,
and it does not matter that a process potentially occupies it. I think
your version is good then.
Well, even if my version is working correctly, there is still a gap
between when the subprocess removes the lockfile and when the subprocess
ends, during which the outer process could theoretically finish and try
to delete the test directory. It may not cause problems in practice, but
let's add the wait anyway to make everything kosher.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help