All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Schmit <i.grok@comcast.net>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: "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: Tue, 4 Nov 2014 21:23:15 -0500	[thread overview]
Message-ID: <20141105022315.GA28292@odin.ulthar.us> (raw)
In-Reply-To: <1414909477-20030-1-git-send-email-mhagger@alum.mit.edu>

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

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.

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3891 bytes --]

  reply	other threads:[~2014-11-05  2:31 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 [this message]
2014-11-05 14:19   ` Michael Haggerty

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=20141105022315.GA28292@odin.ulthar.us \
    --to=i.grok@comcast.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=mhagger@alum.mit.edu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.