threads / patch / 4712

patchRacy GIT (part #3)

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

## tl;dr

2 messages between Jun 29, 2006 and Jun 30, 2006. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Junio C Hamano· Jun 29, 2006, 21:50 UTC · lore

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(-)
Show changes to git-commit.sh +1 −1
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· Jun 30, 2006, 07:43 UTC · re: Junio C Hamano · lore

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

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

← back to recent threads