From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Nate Parsons <parsons.nate@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git .lock file error
Date: Thu, 30 Sep 2010 19:13:02 +0000 [thread overview]
Message-ID: <AANLkTik364t7WEHOsZcB7FE4Y2gJQNxkXsRvW5guUWCi@mail.gmail.com> (raw)
In-Reply-To: <AANLkTim2sFCx8qZ-6o4tiugX3a-EBN9T8wuCSWXb5L12@mail.gmail.com>
On Thu, Sep 30, 2010 at 18:00, Nate Parsons <parsons.nate@gmail.com> 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;'
next prev parent reply other threads:[~2010-09-30 19:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-13 15:19 git .lock file error Nate Parsons
2010-09-20 2:42 ` Nate Parsons
2010-09-30 18:00 ` Nate Parsons
2010-09-30 19:13 ` Ævar Arnfjörð Bjarmason [this message]
2010-09-30 20:15 ` Junio C Hamano
2010-09-30 21:10 ` Nate Parsons
2010-09-30 21:16 ` Ævar Arnfjörð Bjarmason
2010-09-30 23:45 ` Erik Faye-Lund
2010-10-01 0:57 ` Nate Parsons
[not found] ` <AANLkTik2HtyVGz6xFb_VmCh1gSAA_vwpUXhytHFzgCwa@mail.gmail.com>
2010-10-01 1:59 ` Erik Faye-Lund
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTik364t7WEHOsZcB7FE4Y2gJQNxkXsRvW5guUWCi@mail.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=parsons.nate@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.
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 NNTP newsgroup(s).