From: Michael Haggerty <mhagger@alum.mit.edu>
To: "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"Johannes Sixt" <j6t@kdbg.org>,
"Ramsay Jones" <ramsay@ramsay1.demon.co.uk>,
"Yue Lin Ho" <yuelinho777@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH v5] lockfile.c: store absolute path
Date: Wed, 05 Nov 2014 15:19:28 +0100 [thread overview]
Message-ID: <545A31F0.5080306@alum.mit.edu> (raw)
In-Reply-To: <20141105022315.GA28292@odin.ulthar.us>
On 11/05/2014 03:23 AM, Scott Schmit wrote:
> On Sun, Nov 02, 2014 at 07:24:37AM +0100, Michael Haggerty wrote:
>> Locked paths can be saved in a linked list so that if something wrong
>> happens, *.lock are removed. For relative paths, this works fine if we
>> keep cwd the same, which is true 99% of time except:
>>
>> - update-index and read-tree hold the lock on $GIT_DIR/index really
>> early, then later on may call setup_work_tree() to move cwd.
>>
>> - Suppose a lock is being held (e.g. by "git add") then somewhere
>> down the line, somebody calls real_path (e.g. "link_alt_odb_entry"),
>> which temporarily moves cwd away and back.
>>
>> During that time when cwd is moved (either permanently or temporarily)
>> and we decide to die(), attempts to remove relative *.lock will fail,
>> and the next operation will complain that some files are still locked.
>>
>> Avoid this case by turning relative paths to absolute before storing
>> the path in "filename" field.
>
> This might be a little pathological, but it seems like this scheme would
> run into trouble if the entire repo is moved while the lock is held.
Correct. You shouldn't move a repository while Git operations are
running in it. That would break for many reasons, not just because of
this change to lockfile handling.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
prev parent reply other threads:[~2014-11-05 14:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-02 6:24 [PATCH v5] lockfile.c: store absolute path Michael Haggerty
2014-11-05 2:23 ` Scott Schmit
2014-11-05 14:19 ` Michael Haggerty [this message]
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=545A31F0.5080306@alum.mit.edu \
--to=mhagger@alum.mit.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=pclouds@gmail.com \
--cc=ramsay@ramsay1.demon.co.uk \
--cc=yuelinho777@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).