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

[PATCH 2/4] t5000: tar portability fix

From
Jeff King <peff@peff.net>
Date
May 13, 2008, 08:45 UTC
Message-ID
<20080513084532.GB23799@sigill.intra.peff.net>
In-Reply-To
<20080513084338.GA23729@sigill.intra.peff.net>

The output of 'tar tv' varies from system to system. In particular, the t5000 was expecting to parse the date from something like:

  -rw-rw-r-- root/root         0 2008-05-13 04:27 file
but FreeBSD's tar produces this:
  -rw-rw-r--  0 root   root        0 May 13 04:27 file

Instead of relying on tar's output, let's just extract the file using tar and stat the result using perl.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t5000-tar-tree.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index fa62b6a..9b0baac 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -67,10 +67,10 @@ test_expect_success \
 
 test_expect_success \
     'validate file modification time' \
-    'TZ=GMT $TAR tvf b.tar a/a |
-     awk \{print\ \$4,\ \(length\(\$5\)\<7\)\ ?\ \$5\":00\"\ :\ \$5\} \
-     >b.mtime &&
-     echo "2005-05-27 22:00:00" >expected.mtime &&
+    'mkdir extract &&
+     $TAR xf b.tar -C extract a/a &&
+     perl -e '\''print((stat("extract/a/a"))[9], "\n")'\'' >b.mtime &&
+     echo "1117231200" >expected.mtime &&
      diff expected.mtime b.mtime'
 
 test_expect_success \
-- 
1.5.5.1.296.gf618c
Previous: Jeff KingNext: Jeff King
Message 5 of 13 in “freebsd portability fixes”
  1. 0/4 freebsd portability fixesJeff King, May 13, 2008
  2. 1/4 fix bsd shell negationJeff King, May 13, 2008
  3. Junio C HamanoMay 14, 2008
  4. Jeff KingMay 14, 2008
  5. 2/4 t5000: tar portability fixJeff King, May 13, 2008
  6. 3/4 clone: bsd shell portability fixJeff King, May 13, 2008
  7. 4/4 filter-branch: fix variable export logicJeff King, May 13, 2008
  8. Junio C HamanoMay 14, 2008
  9. Jeff KingMay 14, 2008
  10. Paolo BonziniMay 14, 2008
  11. Jeff KingMay 13, 2008
  12. Alex RiesenMay 13, 2008
  13. Alex RiesenMay 13, 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.