git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Riesen" <raa.lkml@gmail.com>
To: "Git Mailing List" <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Subject: [PATCH] Use find instead of perl in t5000 to get file modification time
Date: Wed, 29 Oct 2008 11:38:32 +0100	[thread overview]
Message-ID: <81b0412b0810290338j1beaa25bx9fb373a69f5dfe7@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 909 bytes --]

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(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-find-instead-of-perl-in-t5000-to-get-file-modifi.patch --]
[-- Type: text/x-diff; name=0001-Use-find-instead-of-perl-in-t5000-to-get-file-modifi.patch, Size: 1470 bytes --]

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


             reply	other threads:[~2008-10-29 10:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 10:38 Alex Riesen [this message]
2008-10-29 21:54 ` [PATCH] Use find instead of perl in t5000 to get file modification time Jeff King
2008-10-30  7:26   ` Alex Riesen
2008-10-30  5:29 ` Sam Vilain
2008-10-31  7:00   ` Alex Riesen
2008-10-31 12:59     ` Peter Harris
2008-10-31 13:45       ` Alex Riesen
2008-10-31 22:14     ` Johannes Schindelin
2008-10-31 23:37       ` Alex Riesen
2008-11-01  0:23         ` Johannes Schindelin
2008-11-01 14:24           ` Alex Riesen
2008-11-01 20:37             ` Johannes Schindelin
2008-11-02 14:37               ` Alex Riesen
2008-11-02 16:05                 ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81b0412b0810290338j1beaa25bx9fb373a69f5dfe7@mail.gmail.com \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).