git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Use find instead of perl in t5000 to get file modification time

From
Alex Riesen <raa.lkml@gmail.com>
Date
Oct 29, 2008, 10:38 UTC
Message-ID
<81b0412b0810290338j1beaa25bx9fb373a69f5dfe7@mail.gmail.com>

The test "validate file modification time" was broken on admittedly broken combination of Windows, Cygwin, and ActiveState Perl. Something (I blame ActiveState) of the three is very confused about what time zone to use for the modification time.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

I could not find what exactly does the ActiveState's Perl use for its stat implementation (and honestly, have no motivation to look harder). It seems to honor TZ, but the produced time does not seem to be either local or GMT.

There can be a problem with "-printf": Open Group SUS does not specify -printf for find(1), so it is probably a problem somewhere. I just don't know.

There is always a fallback, which is to write a small program which calls native stat(2). Or modify test-chmtime to just print mtime when asked.

 t/t5000-tar-tree.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
From 1bd8a9445d9bba463fb1edb758d7760fbf53b03a Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Wed, 29 Oct 2008 10:22:15 +0100
Subject: [PATCH] Use find instead of perl in t5000 to get file modification time

The test was broken on admittedly broken combination of Windows, Cygwin, and ActiveState Perl.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 t/t5000-tar-tree.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 0f27d73..4eabebd 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -26,6 +26,8 @@ commit id embedding:
 
 . ./test-lib.sh
 UNZIP=${UNZIP:-unzip}
+TZ=GMT
+export TZ
 
 SUBSTFORMAT=%H%n
 
@@ -54,7 +56,7 @@ test_expect_success \
      find a -type l | xargs git update-index --add &&
      treeid=`git write-tree` &&
      echo $treeid >treeid &&
-     git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
+     git update-ref HEAD $(GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
      git commit-tree $treeid </dev/null)'
 
 test_expect_success \
@@ -90,7 +92,7 @@ test_expect_success \
     'validate file modification time' \
     'mkdir extract &&
      "$TAR" xf b.tar -C extract a/a &&
-     perl -e '\''print((stat("extract/a/a"))[9], "\n")'\'' >b.mtime &&
+     find extract/a/a -printf "%T@\\n" >b.mtime &&
      echo "1117231200" >expected.mtime &&
      diff expected.mtime b.mtime'
 
-- 
1.6.0.3.549.gb475d
Next: Jeff King
Message 1 of 14 in “Use find instead of perl in t5000 to get file modification time”
  1. Use find instead of perl in t5000 to get file modification timeAlex Riesen, Oct 29, 2008
  2. Jeff KingOct 29, 2008
  3. Alex RiesenOct 30, 2008
  4. Sam VilainOct 30, 2008
  5. Alex RiesenOct 31, 2008
  6. Peter HarrisOct 31, 2008
  7. Alex RiesenOct 31, 2008
  8. Johannes SchindelinOct 31, 2008
  9. Alex RiesenOct 31, 2008
  10. Johannes SchindelinNov 1, 2008
  11. Alex RiesenNov 1, 2008
  12. Johannes SchindelinNov 1, 2008
  13. Alex RiesenNov 2, 2008
  14. Johannes SchindelinNov 2, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.