git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Fredrik Kuivinen" <frekui@gmail.com>
To: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Cc: "Len Brown" <lenb@kernel.org>, git@vger.kernel.org
Subject: Re: fatal: unable to create '.git/index': File exists
Date: Sat, 6 Jan 2007 10:24:24 +0100	[thread overview]
Message-ID: <4c8ef70701060124u3fa1dddfp5347a006c4ebb13d@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.63.0701052115161.22628@wbgn013.biozentrum.uni-wuerzburg.de>

On 1/5/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Fri, 5 Jan 2007, Len Brown wrote:
>
> > I kicked off a pull.
> > Realized I was on the wrong branch
> > and immediately did a ^C
> >
> > Now I can't change branches:
> >
> > # git checkout release
> > fatal: unable to create '.git/index': File exists
>
> This usually means that .git/index.lock exists. Try removing that file.
>
> However, it _should_ be removed by the atexit() handler, methinks. I have
> no idea why it does not.

We will get SIGINT when the user hits ^C so I don't think the atexit handler
will run. However, we also install a signal handler for SIGINT which removes
the lock file, so I don't really see how it can be left around...

There is a small race condition between open and signal as we do

    fd = open(lk->filename, O_RDWR | O_CREAT | O_EXCL, 0666);
    ...
    signal(SIGINT, remove_lock_file_on_signal);
    atexit(remove_lock_file);

in lock_file:lockfile.c. But I think it is very improbable that the user hits ^C
between  "open" and "signal". It might be worth fixing though.

Are there any other signals we might get when the user hits ^C? SIGPIPE?

- Fredrik

  reply	other threads:[~2007-01-06  9:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-05 16:50 fatal: unable to create '.git/index': File exists Len Brown
2007-01-05 17:30 ` Manu
2007-01-05 20:16 ` Johannes Schindelin
2007-01-06  9:24   ` Fredrik Kuivinen [this message]
2007-01-06  3:01 ` Len Brown

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=4c8ef70701060124u3fa1dddfp5347a006c4ebb13d@mail.gmail.com \
    --to=frekui@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=lenb@kernel.org \
    /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).