From: Jeff King <peff@peff.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Christian Hesse <mail@eworm.de>, Git List <git@vger.kernel.org>
Subject: Re: [PATCH 1/1] tests: fix gzip with exported GZIP variable in environment
Date: Tue, 3 Dec 2013 08:18:12 -0500 [thread overview]
Message-ID: <20131203131812.GC26667@sigill.intra.peff.net> (raw)
In-Reply-To: <CAPig+cQqKQdVEojYF+-+ZE2hQjxsH4WrgPymj8g7P6pSQzfVpw@mail.gmail.com>
On Tue, Dec 03, 2013 at 04:49:06AM -0500, Eric Sunshine wrote:
> > -if $GZIP --version >/dev/null 2>&1; then
> > - test_set_prereq GZIP
> > +if $GZIPCMD --version >/dev/null 2>&1; then
> > + test_set_prereq GZIPCMD
>
> test_set_prereq is not actually operating on an environment variable.
> Its argument is just a generic tag, which is uppercase by convention,
> but not otherwise related to a variable which may share the same name,
> and which does not pollute the environment. Consequently, it should
> not be necessary to rename the argument to test_set_prereq, thus all
> changes following this one become superfluous (since they are checking
> for presence of tag GZIP, not referencing environment variable GZIP or
> GZIPCMD). Thus, the patch becomes much smaller.
Right. We can get away with just changing the environment variable, and
leaving the prereq.
By the way, we had the exact same problem with $UNZIP, fixed in ac00128
(t0024, t5000: clear variable UNZIP, use GIT_UNZIP instead, 2013-01-06).
I'd probably call the new variable GIT_GZIP for consistency, but...
> In fact, the GZIP command does not appear to be used at all by the
> tests, so a simpler solution might be to remove the variable
> altogether, and perhaps the prerequisite. Peff?
Yes, though it's a bit more subtle than that. The gzip tests are relying
on git's internally-configured "tar.tgz.command" filter, which is
hard-coded to "gzip -cn". So we do depend on having a working gzip, but
we do _not_ depend on the one found in the $GZIP variable. It must be
called "gzip".
There are a few options I see:
1. Drop $GZIP variable, and hard-code the prerequisite check to
"gzip", which is what is being tested.
2. Keep $GZIP (but rename it to $GIT_GZIP), and explicitly set up
tar.tgz.command as "$GIT_GZIP -cn".
3. Teach the Makefile a knob to set the value for "gzip" at compile
time, and use that for the baked-in config (and propagate it to the
test to check the prerequisite).
I think I'd be in favor of (1). It's the simplest, and we have not seen
any reports of people who do not actually have gzip called "gzip". Users
can still override it via config if they really want to.
-Peff
next prev parent reply other threads:[~2013-12-03 13:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 8:57 [PATCH 1/1] tests: fix gzip with exported GZIP variable in environment Christian Hesse
2013-12-03 9:49 ` Eric Sunshine
2013-12-03 13:18 ` Jeff King [this message]
2013-12-03 13:21 ` [PATCH] t5000: simplify gzip prerequisite checks Jeff King
2013-12-03 18:21 ` [PATCH 1/1] tests: fix gzip with exported GZIP variable in environment Junio C Hamano
2013-12-04 19:32 ` Jeff King
2013-12-04 22:07 ` Junio C Hamano
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=20131203131812.GC26667@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=mail@eworm.de \
--cc=sunshine@sunshineco.com \
/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).