# [PATCH/RFH] Racy GIT (part #3)

2 messages from 2006-06-29 to 2006-06-30. Participants: Junio C Hamano, Uwe Zeisberger.
Thread: https://gitlist.dev/t/4712

## Junio C Hamano, 2006-06-29 21:50

Subject: [PATCH/RFH] Racy GIT (part #3)
Message-ID: <7v7j2zpr6k.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v7j2zpr6k.fsf%40assigned-by-dhcp.cox.net

```
Does everybody have "cp -p" to preserve the file timestamps on
his/her platform?  I am assuming this is safe (it is in POSIX),
but please raise hand if that is not a case for you.

-- >8 --
Commit 29e4d3635709778bcc808dbad0477efad82f8d7e fixed the
underlying update-index races but git-commit was not careful
enough to preserve the index file timestamp when copying the
index file.  This caused t3402 test to occasionally fail.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 git-commit.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-commit.sh b/git-commit.sh
index 7e50cf3..22c4ce8 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -29,7 +29,7 @@ THIS_INDEX="$GIT_DIR/index"
 NEXT_INDEX="$GIT_DIR/next-index$$"
 rm -f "$NEXT_INDEX"
 save_index () {
-	cp "$THIS_INDEX" "$NEXT_INDEX"
+	cp -p "$THIS_INDEX" "$NEXT_INDEX"
 }
 
 report () {
-- 
1.4.1.rc2.g3257-dirty

```

## Uwe Zeisberger, 2006-06-30 07:43

Subject: Re: [PATCH/RFH] Racy GIT (part #3)
Message-ID: <20060630074300.GA1643@informatik.uni-freiburg.de>
URL: https://gitlist.dev/e/20060630074300.GA1643%40informatik.uni-freiburg.de
In-Reply-To: <7v7j2zpr6k.fsf@assigned-by-dhcp.cox.net>

```
Hello,

Junio C Hamano wrote:
> Does everybody have "cp -p" to preserve the file timestamps on
> his/her platform?  I am assuming this is safe (it is in POSIX),
> but please raise hand if that is not a case for you.
Solaris[1] has two different "cp"s[2].

 From cp(1):
	[...] [/usr/bin/cp] does not fail if unable to preserve extended
	attributes, modification and access time, or permission modes.

	[...] [/usr/xpg4/bin/cp] does not fail if unable to preserve
	extended attributes.  If unable to duplicate the modification
	and access time or the permission modes, cp prints a diagnostic
	message to stderr and return a non-zero exit status.


There is yet an other difference when -@ is specified.  The complete man
page can be found at docs.sun.com[2].

Best regards
Uwe

[1] in my case Solaris 10 = SunOS 5.10 and Solaris 9 = SunOS 5.9
[2] http://docs.sun.com/app/docs/doc/816-5165/6mbb0m9dm?a=view

-- 
Uwe Zeisberger

http://www.google.com/search?q=0+degree+Celsius+in+kelvin

```
