Skip to contentSkip to conversation

Racy GIT (part #3)

PATCH/RFH Junio C Hamano 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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.

---
 git-commit.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-commit.sh +1 -1
index 7e50cf3..22c4ce8 100755
@@ -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 () {
Signature · 1 line
1.4.1.rc2.g3257-dirty
#1 lore raw

Hello,

Quoted 3 lines · Junio C Hamano

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

Signature · 3 lines
Uwe Zeisberger

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