git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Unset TZ in t5000
@ 2005-06-13  0:24 Mark Allen
  2005-06-13 15:54 ` Rene Scharfe
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Allen @ 2005-06-13  0:24 UTC (permalink / raw
  To: git

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

Unset TZ in t5000 and remove GNU awkism

The t5000 test script fails at test #4 on my box because my copy of tar adjusts the time
in the tarfile for local time if TZ is set. Explicitly unset TZ so that it reports GMT
time.  Additionally, my version of AWK doesn't like the "length" directive, so this patch
removes it.

Signed-off-by: Mark Allen <mrallen1@yahoo.com>

[-- Attachment #2: 3951729877-unset-tz-t5000.patch.txt --]
[-- Type: text/plain, Size: 481 bytes --]

diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -50,8 +50,8 @@ test_expect_success \
 
 test_expect_success \
     'validate file modification time' \
-    'tar tvf b.tar a/a |
-     awk \{print\ \$4,\ length\(\$5\)\<7\ ?\ \$5\":00\"\ :\ \$5\} >b.mtime &&
+    'TZ= tar tvf b.tar a/a |
+     awk \{print\ \$4\"\ \"\$5\} >b.mtime &&
      echo "2005-05-27 22:00:00" >expected.mtime &&
      diff expected.mtime b.mtime'

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Unset TZ in t5000
  2005-06-13  0:24 [PATCH] Unset TZ in t5000 Mark Allen
@ 2005-06-13 15:54 ` Rene Scharfe
  2005-06-13 17:27   ` Mark Allen
  2005-06-14 13:17   ` Mark Allen
  0 siblings, 2 replies; 6+ messages in thread
From: Rene Scharfe @ 2005-06-13 15:54 UTC (permalink / raw
  To: Mark Allen; +Cc: git

Mark Allen schrieb:
> Unset TZ in t5000 and remove GNU awkism
> 
> The t5000 test script fails at test #4 on my box because my copy of 
> tar adjusts the time in the tarfile for local time if TZ is set. 
> Explicitly unset TZ so that it reports GMT time.

Good idea.

> Additionally, my version of AWK doesn't like the "length" directive, 
> so this patch removes it.

What kind of AWK is that?  The One True AWK certainly has a length
function for strings and POSIX mandates it, too, so it's not a GNUism.

The expression

   length($5)<7 ? $5":00" : $5

(where $5 is a time value) is there to cope with tars that format the
time like hh:mm instead of the expected hh:mm:ss.  If you have to remove
the call to "length", please replace the thing with something
equivalent, like

   match($5, /:.*:/) ? $5 : $5":00"

or similar, instead of simply dropping that test.

Thanks,
Rene

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Unset TZ in t5000
  2005-06-13 15:54 ` Rene Scharfe
@ 2005-06-13 17:27   ` Mark Allen
  2005-06-14 13:17   ` Mark Allen
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Allen @ 2005-06-13 17:27 UTC (permalink / raw
  To: Rene Scharfe; +Cc: git

--- Rene Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:
> What kind of AWK is that?  The One True AWK certainly has a length
> function for strings and POSIX mandates it, too, so it's not a GNUism.
> 
> The expression
> 
>    length($5)<7 ? $5":00" : $5
> 
> (where $5 is a time value) is there to cope with tars that format the
> time like hh:mm instead of the expected hh:mm:ss.  If you have to remove
> the call to "length", please replace the thing with something
> equivalent, like
> 
>    match($5, /:.*:/) ? $5 : $5":00"
> 
> or similar, instead of simply dropping that test.

Hi Rene,

I'll test your suggestion later tonight (US time) when I get home from work.  Sorry I
don't know much about awk. (I usually break out perl for any job I used to give awk) When
I ran the t5000 script in --verbose mode, all I could see was awk complaining about the
length directive.

It *is* possible that there's some kind of quoting/character escape problem which Linux
tolerates but is causing the syntax error on my home system. (It's Mac OS 10.4.1/Darwin)

Thanks,

--Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Unset TZ in t5000
  2005-06-13 15:54 ` Rene Scharfe
  2005-06-13 17:27   ` Mark Allen
@ 2005-06-14 13:17   ` Mark Allen
  2005-06-14 15:17     ` Rene Scharfe
  1 sibling, 1 reply; 6+ messages in thread
From: Mark Allen @ 2005-06-14 13:17 UTC (permalink / raw
  To: Rene Scharfe; +Cc: git

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

--- Rene Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:> Mark Allen schrieb:
 > The expression
> 
>    length($5)<7 ? $5":00" : $5
> 
> (where $5 is a time value) is there to cope with tars that format the
> time like hh:mm instead of the expected hh:mm:ss.

I put (escaped) parenthesis around the length function and now it works as expected.
Here's a new patch. Please ack if you approve. 

Thanks,

--Mark

Signed-off-by: Mark Allen <mrallen1@yahoo.com>


[-- Attachment #2: 560000162-t5000-portability.patch.txt --]
[-- Type: text/plain, Size: 528 bytes --]

diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -50,8 +50,9 @@ test_expect_success \
 
 test_expect_success \
     'validate file modification time' \
-    'tar tvf b.tar a/a |
-     awk \{print\ \$4,\ length\(\$5\)\<7\ ?\ \$5\":00\"\ :\ \$5\} >b.mtime &&
+    'TZ= 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 &&
      diff expected.mtime b.mtime'
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Unset TZ in t5000
  2005-06-14 13:17   ` Mark Allen
@ 2005-06-14 15:17     ` Rene Scharfe
  2005-06-14 17:09       ` Mark Allen
  0 siblings, 1 reply; 6+ messages in thread
From: Rene Scharfe @ 2005-06-14 15:17 UTC (permalink / raw
  To: Mark Allen; +Cc: git

Mark Allen schrieb:
> --- Rene Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:> Mark Allen schrieb:
>  > The expression
> 
>>   length($5)<7 ? $5":00" : $5
>>
>>(where $5 is a time value) is there to cope with tars that format the
>>time like hh:mm instead of the expected hh:mm:ss.
> 
> 
> I put (escaped) parenthesis around the length function and now it works as expected.
> Here's a new patch. Please ack if you approve. 
> 
> Thanks,
> 
> --Mark
> 
> Signed-off-by: Mark Allen <mrallen1@yahoo.com>
> 
> 
> ------------------------------------------------------------------------
> 
> diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
> --- a/t/t5000-tar-tree.sh
> +++ b/t/t5000-tar-tree.sh
> @@ -50,8 +50,9 @@ test_expect_success \
>  
>  test_expect_success \
>      'validate file modification time' \
> -    'tar tvf b.tar a/a |
> -     awk \{print\ \$4,\ length\(\$5\)\<7\ ?\ \$5\":00\"\ :\ \$5\} >b.mtime &&
> +    'TZ= 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 &&
>       diff expected.mtime b.mtime'
>  

Acked-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Unset TZ in t5000
  2005-06-14 15:17     ` Rene Scharfe
@ 2005-06-14 17:09       ` Mark Allen
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Allen @ 2005-06-14 17:09 UTC (permalink / raw
  To: Rene Scharfe, torvalds; +Cc: git

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

Linus,

Please apply this patch to make t5000 more portable.

Thanks,

--Mark

---

Unset TZ to force GMT in test #4 and add a set of parens around
the length function in the awk script.

Signed-off-by: Mark Allen <mrallen1@yahoo.com>
Acked-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
 

[-- Attachment #2: 560000162-t5000-portability.patch.txt --]
[-- Type: text/plain, Size: 528 bytes --]

diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -50,8 +50,9 @@ test_expect_success \
 
 test_expect_success \
     'validate file modification time' \
-    'tar tvf b.tar a/a |
-     awk \{print\ \$4,\ length\(\$5\)\<7\ ?\ \$5\":00\"\ :\ \$5\} >b.mtime &&
+    'TZ= 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 &&
      diff expected.mtime b.mtime'
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-06-14 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-13  0:24 [PATCH] Unset TZ in t5000 Mark Allen
2005-06-13 15:54 ` Rene Scharfe
2005-06-13 17:27   ` Mark Allen
2005-06-14 13:17   ` Mark Allen
2005-06-14 15:17     ` Rene Scharfe
2005-06-14 17:09       ` Mark Allen

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).