git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Jakob Pfender <jpfender@elegosoft.com>
Cc: git@vger.kernel.org, casey@nrlssc.navy.mil,
	jon.seymour@gmail.com, Junio C Hamano <gitster@pobox.com>
Subject: Re: [RFD] git stash over OpenBSD/Linux NFS - cp -p breakage
Date: Tue, 15 Mar 2011 11:58:50 +0100	[thread overview]
Message-ID: <4D7F466A.4090508@viscovery.net> (raw)
In-Reply-To: <4D7F3AA4.1080202@elegosoft.com>

Am 3/15/2011 11:08, schrieb Jakob Pfender:
> We have an NFS setup with Linux machines mounting an NFS that is hosted on
> an OpenBSD server. Recently, we discovered git-stash breaking with:
> 
> $ git stash
> cp: preserving permissions for
> `/home/jpfender/stashtest/.git/.git-stash.3056-index': Operation not
> supported
> Cannot save the current worktree state
> 
> This was discovered to be caused by a bug in cp that causes 'cp -p' to
> fail in this particular NFS setup - preserving permissions in an NFS
> shared across Linux and OpenBSD machines doesn't work.
> 
> I looked at git-stash.sh and could not discover a reason why it had to use
> 'cp -p'. I patched it to use only cp without preserving permissions, and
> everything seemed to work fine. All stash tests succeeded (bar two known
> breakages).
> 
> So my question is: Does git-stash really need 'cp -p'? Is it safe to remove?

Yes. No.

The timestamp of the index file is important. It is needed to discover
racily-clean index entries. Therefore, the -p must remain.

You can also try the patch below. Warning: completely untested.

-- Hannes

diff --git a/git-stash.sh b/git-stash.sh
index 7561b37..fa62135 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -82,10 +82,9 @@ create_stash () {
 		# state of the working tree
 		w_tree=$( (
 			rm -f "$TMP-index" &&
-			cp -p ${GIT_INDEX_FILE-"$GIT_DIR/index"} "$TMP-index" &&
+			git read-tree --index-output="$TMP-index" -m $i_tree &&
 			GIT_INDEX_FILE="$TMP-index" &&
 			export GIT_INDEX_FILE &&
-			git read-tree -m $i_tree &&
 			git diff --name-only -z HEAD | git update-index -z --add --remove --stdin &&
 			git write-tree &&
 			rm -f "$TMP-index"

  reply	other threads:[~2011-03-15 10:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-15 10:08 [RFD] git stash over OpenBSD/Linux NFS - cp -p breakage Jakob Pfender
2011-03-15 10:58 ` Johannes Sixt [this message]
2011-03-15 12:00   ` Jakob Pfender
2011-03-15 12:37     ` [PATCH] stash: copy the index using --index-output instead of cp -p Johannes Sixt
2011-03-15 19:28       ` Junio C Hamano
2011-03-15 19:53         ` Bert Wesarg
2011-03-16  8:12           ` Johannes Sixt
2011-03-16  8:14             ` [PATCH 1/2] stash: fix incorrect quoting in cleanup of temporary files Johannes Sixt
2011-03-16  8:18             ` [PATCH 2/2 v2] stash: copy the index using --index-output instead of cp -p Johannes Sixt

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=4D7F466A.4090508@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=casey@nrlssc.navy.mil \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jon.seymour@gmail.com \
    --cc=jpfender@elegosoft.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).