From: Ævar Arnfjörð Bjarmason Date: Thu, 30 Sep 2010 19:13:02 GMT Subject: Re: git .lock file error Message-ID: In-Reply-To: On Thu, Sep 30, 2010 at 18:00, Nate Parsons wrote: > OK, so this is definitely a win32 issue. I believe that the perl > script is simply creating .lock files too fast for Windows to keep up. > Simply trying again fixes the problem for me. Sounds like something that might do with a non-hacky solution, but I don't know what that would be. > -       sysopen(my $fh, $db_lock, O_RDWR | O_CREAT) > -            or croak "Couldn't open $db_lock: $!\n"; > +   my $fh; > +   my $tries=10; > +   for(; !sysopen($fh, $db_lock, O_RDWR | O_CREAT) && $tries>=0; $tries--) { } > +   if($tries <= 0) { croak "Couldn't open $db_lock: $!\n"; } >        $update_ref eq 'reset' ? _rev_map_reset($fh, $rev, $commit) : >                                 _rev_map_set($fh, $rev, $commit); >        if ($sync) { FWIW I think this is more readable, but maybe we want to retry on all platforms: my $fh; if ($^O eq 'MSWin32' or $^O eq 'cygwin') { # Try 10 times to open our lock file, in case Windows is lagging for my $try (1..10) { sysopen($fh, $db_lock, O_RDWR | O_CREAT); last if $fh; } } else { sysopen($fh, $db_lock, O_RDWR | O_CREAT); } warn "Couldnt open $db_lock: $!\n" unless $fh;'