git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* t5562: gzip -k is not portable
@ 2018-06-19 17:25 Torsten Bögershausen
  2018-06-19 18:06 ` Junio C Hamano
  2018-06-19 20:48 ` Rodrigo Campos
  0 siblings, 2 replies; 10+ messages in thread
From: Torsten Bögershausen @ 2018-06-19 17:25 UTC (permalink / raw)
  To: Git Mailing List, max

Hej Max,

t5562 fails here under MacOS:
"gzip -k"  is not portable.

The following works (there may be better solutions, I didn't dig into 
the test code)

diff --git a/t/t5562-http-backend-content-length.sh 
b/t/t5562-http-backend-content-length.sh
index 8040d80e04..7befe3885c 100755
--- a/t/t5562-http-backend-content-length.sh
+++ b/t/t5562-http-backend-content-length.sh
@@ -61,9 +61,13 @@ test_expect_success 'setup' '
  '

  test_expect_success GZIP 'setup, compression related' '
-       gzip -k fetch_body &&
+       cp fetch_body f &&
+       gzip fetch_body &&
+       mv f fetch_body &&
         test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
-       gzip -k push_body &&
+       cp push_body f &&
+       gzip push_body &&
+       mv f push_body &&
         test_copy_bytes 10 <push_body.gz >push_body.gz.trunc


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

* Re: t5562: gzip -k is not portable
  2018-06-19 17:25 t5562: gzip -k is not portable Torsten Bögershausen
@ 2018-06-19 18:06 ` Junio C Hamano
  2018-06-19 18:22   ` Eric Sunshine
  2018-06-19 20:48 ` Rodrigo Campos
  1 sibling, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2018-06-19 18:06 UTC (permalink / raw)
  To: Torsten Bögershausen; +Cc: Git Mailing List, max

Torsten Bögershausen <tboegi@web.de> writes:

> Hej Max,
>
> t5562 fails here under MacOS:
> "gzip -k"  is not portable.

Sigh.  Perhaps -c would help.  Or do BSD implementations also lack -c?

 t/t5562-http-backend-content-length.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh
index 8040d80e04..98b6543827 100755
--- a/t/t5562-http-backend-content-length.sh
+++ b/t/t5562-http-backend-content-length.sh
@@ -61,9 +61,9 @@ test_expect_success 'setup' '
 '
 
 test_expect_success GZIP 'setup, compression related' '
-	gzip -k fetch_body &&
+	gzip -c fetch_body >fetch_body.gz &&
 	test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
-	gzip -k push_body &&
+	gzip -c push_body >push_body.gz &&
 	test_copy_bytes 10 <push_body.gz >push_body.gz.trunc
 '
 

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

* Re: t5562: gzip -k is not portable
  2018-06-19 18:06 ` Junio C Hamano
@ 2018-06-19 18:22   ` Eric Sunshine
  2018-06-19 20:40     ` Torsten Bögershausen
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Sunshine @ 2018-06-19 18:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Torsten Bögershausen, Git List, Max Kirillov

On Tue, Jun 19, 2018 at 2:06 PM Junio C Hamano <gitster@pobox.com> wrote:
> Torsten Bögershausen <tboegi@web.de> writes:
> > t5562 fails here under MacOS:
> > "gzip -k"  is not portable.

Very odd. Stock /usr/bin/gzip on my MacOS 10.12.6 _does_ recognize -k,
and the test does pass.

> Sigh.  Perhaps -c would help.  Or do BSD implementations also lack -c?

MacOS and BSD do support -c, so this solution would also work (and is
"cleaner" the the other proposal).

> diff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh
> @@ -61,9 +61,9 @@ test_expect_success 'setup' '
>  test_expect_success GZIP 'setup, compression related' '
> -       gzip -k fetch_body &&
> +       gzip -c fetch_body >fetch_body.gz &&
>         test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
> -       gzip -k push_body &&
> +       gzip -c push_body >push_body.gz &&
>         test_copy_bytes 10 <push_body.gz >push_body.gz.trunc
>  '

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

* Re: t5562: gzip -k is not portable
  2018-06-19 18:22   ` Eric Sunshine
@ 2018-06-19 20:40     ` Torsten Bögershausen
  2018-06-19 20:53       ` Rodrigo Campos
  2018-06-19 20:53       ` Jeff King
  0 siblings, 2 replies; 10+ messages in thread
From: Torsten Bögershausen @ 2018-06-19 20:40 UTC (permalink / raw)
  To: Eric Sunshine, Junio C Hamano; +Cc: Git List, Max Kirillov



On 06/19/2018 08:22 PM, Eric Sunshine wrote:
> On Tue, Jun 19, 2018 at 2:06 PM Junio C Hamano <gitster@pobox.com> wrote:
>> Torsten Bögershausen <tboegi@web.de> writes:
>>> t5562 fails here under MacOS:
>>> "gzip -k"  is not portable.
> Very odd. Stock /usr/bin/gzip on my MacOS 10.12.6 _does_ recognize -k,
> and the test does pass.

This is the test box running Mac OS X 10.6 speaking.
The -c seems to need even -f.
But this doesn't work either:

gzip 1.3.12
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Jean-loup Gailly.
prerequisite GZIP ok
expecting success:
     gzip -f -c fetch_body >fetch_body.gz &&
     test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
     gzip -f -c push_body >push_body,gz &&
     test_copy_bytes 10 <push_body.gz >push_body.gz.trunc

./test-lib.sh: line 632: push_body.gz: No such file or directory
not ok 2 - setup, compression related
#
#        gzip -f -c fetch_body >fetch_body.gz &&
#        test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
#        gzip -f -c push_body >push_body,gz &&
#        test_copy_bytes 10 <push_body.gz >push_body.gz.trunc
#


>> Sigh.  Perhaps -c would help.  Or do BSD implementations also lack -c?
> MacOS and BSD do support -c, so this solution would also work (and is
> "cleaner" the the other proposal).
>
>> diff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh
>> @@ -61,9 +61,9 @@ test_expect_success 'setup' '
>>   test_expect_success GZIP 'setup, compression related' '
>> -       gzip -k fetch_body &&
>> +       gzip -c fetch_body >fetch_body.gz &&
>>          test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
>> -       gzip -k push_body &&
>> +       gzip -c push_body >push_body.gz &&
>>          test_copy_bytes 10 <push_body.gz >push_body.gz.trunc
>>   '


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

* Re: t5562: gzip -k is not portable
  2018-06-19 17:25 t5562: gzip -k is not portable Torsten Bögershausen
  2018-06-19 18:06 ` Junio C Hamano
@ 2018-06-19 20:48 ` Rodrigo Campos
  1 sibling, 0 replies; 10+ messages in thread
From: Rodrigo Campos @ 2018-06-19 20:48 UTC (permalink / raw)
  To: Torsten Bögershausen; +Cc: Git Mailing List, max

On Tue, Jun 19, 2018 at 07:25:15PM +0200, Torsten Bögershausen wrote:
> Hej Max,
> 
> t5562 fails here under MacOS:
> "gzip -k"  is not portable.

What do you mean with is not portable?

I wrote the patch for gzip[1]. That was in 2013, and is included since version
1.6 IIUC:

	$ git tag --contains 0192f02e26ac9fa0a27ed177263ee3ea73d5e95c
	v1.6
	v1.7
	v1.8
	v1.9

But that maybe is too new? Or do you mean something else?

[1]: http://git.savannah.gnu.org/cgit/gzip.git/commit/?id=0192f02e26ac9fa0a27ed177263ee3ea73d5e95c

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

* Re: t5562: gzip -k is not portable
  2018-06-19 20:40     ` Torsten Bögershausen
@ 2018-06-19 20:53       ` Rodrigo Campos
  2018-06-19 20:53       ` Jeff King
  1 sibling, 0 replies; 10+ messages in thread
From: Rodrigo Campos @ 2018-06-19 20:53 UTC (permalink / raw)
  To: Torsten Bögershausen
  Cc: Eric Sunshine, Junio C Hamano, Git List, Max Kirillov

On Tue, Jun 19, 2018 at 10:40:16PM +0200, Torsten Bögershausen wrote:
> 
> 
> On 06/19/2018 08:22 PM, Eric Sunshine wrote:
> > On Tue, Jun 19, 2018 at 2:06 PM Junio C Hamano <gitster@pobox.com> wrote:
> > > Torsten Bögershausen <tboegi@web.de> writes:
> > > > t5562 fails here under MacOS:
> > > > "gzip -k"  is not portable.
> > Very odd. Stock /usr/bin/gzip on my MacOS 10.12.6 _does_ recognize -k,
> > and the test does pass.
> 
> gzip 1.3.12

Oh, this seems to be the issue. As I've said in my prvious email, the first
version to include this was 1.6 IIRC.

The commit adding it is here[1]. But yeah, it was not added 20 years ago, and it
seems there are systems with such old versions of gzip (although can probably
update? Don't know much about mac) :-(


[1]: http://git.savannah.gnu.org/cgit/gzip.git/commit/?id=0192f02e26ac9fa0a27ed177263ee3ea73d5e95c

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

* Re: t5562: gzip -k is not portable
  2018-06-19 20:40     ` Torsten Bögershausen
  2018-06-19 20:53       ` Rodrigo Campos
@ 2018-06-19 20:53       ` Jeff King
  2018-06-20  6:13         ` Torsten Bögershausen
  1 sibling, 1 reply; 10+ messages in thread
From: Jeff King @ 2018-06-19 20:53 UTC (permalink / raw)
  To: Torsten Bögershausen
  Cc: Eric Sunshine, Junio C Hamano, Git List, Max Kirillov

On Tue, Jun 19, 2018 at 10:40:16PM +0200, Torsten Bögershausen wrote:

> 
> 
> On 06/19/2018 08:22 PM, Eric Sunshine wrote:
> > On Tue, Jun 19, 2018 at 2:06 PM Junio C Hamano <gitster@pobox.com> wrote:
> > > Torsten Bögershausen <tboegi@web.de> writes:
> > > > t5562 fails here under MacOS:
> > > > "gzip -k"  is not portable.
> > Very odd. Stock /usr/bin/gzip on my MacOS 10.12.6 _does_ recognize -k,
> > and the test does pass.
> 
> This is the test box running Mac OS X 10.6 speaking.
> The -c seems to need even -f.
> But this doesn't work either:
> 
> gzip 1.3.12
> Copyright (C) 2007 Free Software Foundation, Inc.
> Copyright (C) 1993 Jean-loup Gailly.
> This is free software.  You may redistribute copies of it under the terms of
> the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
> There is NO WARRANTY, to the extent permitted by law.

Ah, that's it. "-k" came about in gzip v1.6. That's 5 years old, but
obviously some people are still running it.

"-c" goes back quite a while and should be safe, I think.

> expecting success:
>     gzip -f -c fetch_body >fetch_body.gz &&
>     test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
>     gzip -f -c push_body >push_body,gz &&
>     test_copy_bytes 10 <push_body.gz >push_body.gz.trunc
> 
> ./test-lib.sh: line 632: push_body.gz: No such file or directory

Typo in the ">" redirect (comma instead of period)?

-Peff

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

* Re: t5562: gzip -k is not portable
  2018-06-19 20:53       ` Jeff King
@ 2018-06-20  6:13         ` Torsten Bögershausen
  2018-06-20 12:40           ` Jeff King
  0 siblings, 1 reply; 10+ messages in thread
From: Torsten Bögershausen @ 2018-06-20  6:13 UTC (permalink / raw)
  To: Jeff King; +Cc: Eric Sunshine, Junio C Hamano, Git List, Max Kirillov

On Tue, Jun 19, 2018 at 04:53:10PM -0400, Jeff King wrote:
> On Tue, Jun 19, 2018 at 10:40:16PM +0200, Torsten Bögershausen wrote:
> 
> > 
> > 
> > On 06/19/2018 08:22 PM, Eric Sunshine wrote:
> > > On Tue, Jun 19, 2018 at 2:06 PM Junio C Hamano <gitster@pobox.com> wrote:
> > > > Torsten Bögershausen <tboegi@web.de> writes:
> > > > > t5562 fails here under MacOS:
> > > > > "gzip -k"  is not portable.
> > > Very odd. Stock /usr/bin/gzip on my MacOS 10.12.6 _does_ recognize -k,
> > > and the test does pass.
> > 
> > This is the test box running Mac OS X 10.6 speaking.
> > The -c seems to need even -f.
> > But this doesn't work either:
> > 
> > gzip 1.3.12
> > Copyright (C) 2007 Free Software Foundation, Inc.
> > Copyright (C) 1993 Jean-loup Gailly.
> > This is free software.  You may redistribute copies of it under the terms of
> > the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
> > There is NO WARRANTY, to the extent permitted by law.
> 
> Ah, that's it. "-k" came about in gzip v1.6. That's 5 years old, but
> obviously some people are still running it.
> 
> "-c" goes back quite a while and should be safe, I think.
> 
> > expecting success:
> >     gzip -f -c fetch_body >fetch_body.gz &&
> >     test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
> >     gzip -f -c push_body >push_body,gz &&
> >     test_copy_bytes 10 <push_body.gz >push_body.gz.trunc
> > 
> > ./test-lib.sh: line 632: push_body.gz: No such file or directory
> 
> Typo in the ">" redirect (comma instead of period)?
> 
> -Peff

Good eyes, thanks.
The "-f -c" combo works:

-       gzip -k fetch_body &&
+       gzip -f -c fetch_body >fetch_body.gz &&
        test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
-       gzip -k push_body &&
+       gzip -f -c push_body >push_body.gz &&

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

* Re: t5562: gzip -k is not portable
  2018-06-20  6:13         ` Torsten Bögershausen
@ 2018-06-20 12:40           ` Jeff King
  2018-06-20 15:41             ` Torsten Bögershausen
  0 siblings, 1 reply; 10+ messages in thread
From: Jeff King @ 2018-06-20 12:40 UTC (permalink / raw)
  To: Torsten Bögershausen
  Cc: Eric Sunshine, Junio C Hamano, Git List, Max Kirillov

On Wed, Jun 20, 2018 at 08:13:06AM +0200, Torsten Bögershausen wrote:

> Good eyes, thanks.
> The "-f -c" combo works:
> 
> -       gzip -k fetch_body &&
> +       gzip -f -c fetch_body >fetch_body.gz &&
>         test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
> -       gzip -k push_body &&
> +       gzip -f -c push_body >push_body.gz &&

Do we still need "-f"?  With "-c" gzip is only writing to stdout, so we
should not need to force anything.

-Peff

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

* Re: t5562: gzip -k is not portable
  2018-06-20 12:40           ` Jeff King
@ 2018-06-20 15:41             ` Torsten Bögershausen
  0 siblings, 0 replies; 10+ messages in thread
From: Torsten Bögershausen @ 2018-06-20 15:41 UTC (permalink / raw)
  To: Jeff King; +Cc: Eric Sunshine, Junio C Hamano, Git List, Max Kirillov

On Wed, Jun 20, 2018 at 08:40:06AM -0400, Jeff King wrote:
> On Wed, Jun 20, 2018 at 08:13:06AM +0200, Torsten Bögershausen wrote:
> 
> > Good eyes, thanks.
> > The "-f -c" combo works:
> > 
> > -       gzip -k fetch_body &&
> > +       gzip -f -c fetch_body >fetch_body.gz &&
> >         test_copy_bytes 10 <fetch_body.gz >fetch_body.gz.trunc &&
> > -       gzip -k push_body &&
> > +       gzip -f -c push_body >push_body.gz &&
> 
> Do we still need "-f"?  With "-c" gzip is only writing to stdout, so we
> should not need to force anything.
> 
> -Peff

You are rigth, -f is not needed.

I was confusing stdout with terminal :-( 
Most often stdout is the terminal, but not here of course.

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

end of thread, other threads:[~2018-06-20 15:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 17:25 t5562: gzip -k is not portable Torsten Bögershausen
2018-06-19 18:06 ` Junio C Hamano
2018-06-19 18:22   ` Eric Sunshine
2018-06-19 20:40     ` Torsten Bögershausen
2018-06-19 20:53       ` Rodrigo Campos
2018-06-19 20:53       ` Jeff King
2018-06-20  6:13         ` Torsten Bögershausen
2018-06-20 12:40           ` Jeff King
2018-06-20 15:41             ` Torsten Bögershausen
2018-06-19 20:48 ` Rodrigo Campos

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