From: Karthik Nayak <karthik.188@gmail.com>
To: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 02/20] t: refactor environment sanitization to not use Perl
Date: Fri, 21 Mar 2025 04:52:45 -0500 [thread overview]
Message-ID: <CAOLa=ZR3V9e33oU5ard+eZLCUQgMybGwcj9PLMr7hy+4wNgM_Q@mail.gmail.com> (raw)
In-Reply-To: <20250320-b4-pks-t-perlless-v1-2-b1eefe27ac55@pks.im>
[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]
Patrick Steinhardt <ps@pks.im> writes:
> Before executing tests we first sanitize the environment. Part of the
> sanitization is to unset a couple of environment variables that we know
> will change the behaviour of Git. This is done with a small Perl script,
> which has the consequence that having a Perl interpreter available is a
> strict requirement for running our unit tests.
>
> The logic itself isn't particularly involved: we simply unset every
> environment variable whose key starts with 'GIT_', but then explicitly
> allow a subset of these.
>
> Refactor the logic to instead use sed(1) so that it becomes possible to
> execute our tests without Perl.
>
> Based-on-patch-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> t/test-lib.sh | 32 ++++++++++++++------------------
> 1 file changed, 14 insertions(+), 18 deletions(-)
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 1ce3b32fcac..a62699d6c79 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -499,24 +499,20 @@ EDITOR=:
> # /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
> # deriving from the command substitution clustered with the other
> # ones.
> -unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
> - my @env = keys %ENV;
> - my $ok = join("|", qw(
> - TRACE
> - DEBUG
> - TEST
> - .*_TEST
> - PROVE
> - VALGRIND
> - UNZIP
> - PERF_
> - CURL_VERBOSE
> - TRACE_CURL
> - BUILD_DIR
> - ));
> - my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
> - print join("\n", @vars);
> -')
> +unset VISUAL EMAIL LANGUAGE $(env | sed -n \
> + -e '/^GIT_TRACE/d' \
> + -e '/^GIT_DEBUG/d' \
> + -e '/^GIT_TEST/d' \
> + -e '/^GIT_.*_TEST/d' \
> + -e '/^GIT_PROVE/d' \
> + -e '/^GIT_VALGRIND/d' \
> + -e '/^GIT_UNZIP/d' \
> + -e '/^GIT_PERF_/d' \
> + -e '/^GIT_CURL_VERBOSE/d' \
> + -e '/^GIT_TRACE_CURL/d' \
> + -e '/^GIT_BUILD_DIR/d' \
So we delete all of the following from the stream of env.
> + -e 's/^\(GIT_[^=]*\)=.*/\1/p'
But any other `GIT_*` env variable is printed to be `unset`. Ok makes
sense. This is much more readable than the perl version!
> +)
> unset XDG_CACHE_HOME
> unset XDG_CONFIG_HOME
> unset GITPERLLIB
>
> --
> 2.49.0.472.ge94155a9ec.dirty
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]
next prev parent reply other threads:[~2025-03-21 9:52 UTC|newest]
Thread overview: 125+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 9:35 [PATCH 00/20] t: drop Perl as a mandatory prerequisite Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 01/20] t: skip chain lint when PERL_PATH is unset Patrick Steinhardt
2025-03-20 18:36 ` Eric Sunshine
2025-03-20 9:35 ` [PATCH 02/20] t: refactor environment sanitization to not use Perl Patrick Steinhardt
2025-03-21 9:52 ` Karthik Nayak [this message]
2025-03-20 9:35 ` [PATCH 03/20] t: adapt character translation helpers " Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 04/20] t: adapt `test_copy_bytes()` " Patrick Steinhardt
2025-03-21 9:56 ` Karthik Nayak
2025-03-20 9:35 ` [PATCH 05/20] t: adapt `test_readlink()` " Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 06/20] t: introduce PERL_TEST_HELPERS prerequisite Patrick Steinhardt
2025-03-20 18:55 ` Eric Sunshine
2025-03-24 12:46 ` Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 07/20] t: adapt existing PERL prerequisites Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 08/20] meson: stop requiring Perl when tests are enabled Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 09/20] Makefile: stop requiring Perl when running tests Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 10/20] t: refactor tests depending on Perl transliteration operator Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 11/20] t: refactor tests depending on Perl substitution operator Patrick Steinhardt
2025-03-24 16:16 ` Phillip Wood
2025-03-20 9:35 ` [PATCH 12/20] t: refactor tests depending on Perl to print data Patrick Steinhardt
2025-03-20 19:33 ` Eric Sunshine
2025-03-24 12:46 ` Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 13/20] t: refactor tests depending on Perl for textconv scripts Patrick Steinhardt
2025-03-20 19:37 ` Eric Sunshine
2025-03-24 12:46 ` Patrick Steinhardt
2025-03-24 16:07 ` Eric Sunshine
2025-03-25 12:42 ` Patrick Steinhardt
2025-03-24 16:16 ` Phillip Wood
2025-03-25 12:43 ` Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 14/20] t/lib-gpg: refactor `sanitize_pgp()` to not depend on Perl Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 15/20] t/lib-t6000: refactor `name_from_description()` " Patrick Steinhardt
2025-03-20 19:41 ` Eric Sunshine
2025-03-24 12:46 ` Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 16/20] t/lib-httpd: refactor "one-time-perl" CGI script " Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 17/20] t0021: refactor `generate_random_characters()` " Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 18/20] t0210: refactor trace2 scrubbing to not use Perl Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 19/20] t5316: refactor `max_chain()` to not depend on Perl Patrick Steinhardt
2025-03-20 9:35 ` [PATCH 20/20] t5703: refactor test " Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 00/20] t: drop Perl as a mandatory prerequisite Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 01/20] t: skip chain lint when PERL_PATH is unset Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 02/20] t: refactor environment sanitization to not use Perl Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 03/20] t: adapt character translation helpers " Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 04/20] t: adapt `test_copy_bytes()` " Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 05/20] t: adapt `test_readlink()` " Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 06/20] t: introduce PERL_TEST_HELPERS prerequisite Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 07/20] t: adapt existing PERL prerequisites Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 08/20] meson: stop requiring Perl when tests are enabled Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 09/20] Makefile: stop requiring Perl when running tests Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 10/20] t: refactor tests depending on Perl transliteration operator Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 11/20] t: refactor tests depending on Perl substitution operator Patrick Steinhardt
2025-03-25 14:35 ` Phillip Wood
2025-03-27 10:19 ` Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 12/20] t: refactor tests depending on Perl to print data Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 13/20] t: refactor tests depending on Perl for textconv scripts Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 14/20] t/lib-gpg: refactor `sanitize_pgp()` to not depend on Perl Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 15/20] t/lib-t6000: refactor `name_from_description()` " Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 16/20] t/lib-httpd: refactor "one-time-perl" CGI script " Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 17/20] t0021: refactor `generate_random_characters()` " Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 18/20] t0210: refactor trace2 scrubbing to not use Perl Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 19/20] t5316: refactor `max_chain()` to not depend on Perl Patrick Steinhardt
2025-03-25 13:14 ` [PATCH v2 20/20] t5703: refactor test " Patrick Steinhardt
2025-03-27 10:36 ` [PATCH v3 00/20] t: drop Perl as a mandatory prerequisite Patrick Steinhardt
2025-03-27 10:36 ` [PATCH v3 01/20] t: skip chain lint when PERL_PATH is unset Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 02/20] t: refactor environment sanitization to not use Perl Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 03/20] t: adapt character translation helpers " Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 04/20] t: adapt `test_copy_bytes()` " Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 05/20] t: adapt `test_readlink()` " Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 06/20] t: introduce PERL_TEST_HELPERS prerequisite Patrick Steinhardt
2025-04-01 18:26 ` Johannes Schindelin
2025-04-02 7:16 ` Patrick Steinhardt
2025-04-02 19:10 ` Johannes Schindelin
2025-04-03 5:05 ` Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 07/20] t: adapt existing PERL prerequisites Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 08/20] meson: stop requiring Perl when tests are enabled Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 09/20] Makefile: stop requiring Perl when running tests Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 10/20] t: refactor tests depending on Perl transliteration operator Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 11/20] t: refactor tests depending on Perl substitution operator Patrick Steinhardt
2025-04-01 18:32 ` Johannes Schindelin
2025-04-02 7:16 ` Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 12/20] t: refactor tests depending on Perl to print data Patrick Steinhardt
2025-04-01 18:35 ` Johannes Schindelin
2025-04-02 7:16 ` Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 13/20] t: refactor tests depending on Perl for textconv scripts Patrick Steinhardt
2025-04-01 18:55 ` Johannes Schindelin
2025-04-02 7:16 ` Patrick Steinhardt
2025-04-02 19:17 ` Johannes Schindelin
2025-03-27 10:37 ` [PATCH v3 14/20] t/lib-gpg: refactor `sanitize_pgp()` to not depend on Perl Patrick Steinhardt
2025-04-01 18:56 ` Johannes Schindelin
2025-04-02 7:16 ` Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 15/20] t/lib-t6000: refactor `name_from_description()` " Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 16/20] t/lib-httpd: refactor "one-time-perl" CGI script " Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 17/20] t0021: refactor `generate_random_characters()` " Patrick Steinhardt
2025-04-01 19:04 ` Johannes Schindelin
2025-04-02 7:16 ` Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 18/20] t0210: refactor trace2 scrubbing to not use Perl Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 19/20] t5316: refactor `max_chain()` to not depend on Perl Patrick Steinhardt
2025-03-27 10:37 ` [PATCH v3 20/20] t5703: refactor test " Patrick Steinhardt
2025-03-28 10:29 ` [PATCH v3 00/20] t: drop Perl as a mandatory prerequisite Phillip Wood
2025-04-02 19:32 ` Johannes Schindelin
2025-04-03 5:05 ` [PATCH v4 " Patrick Steinhardt
2025-04-03 5:05 ` [PATCH v4 01/20] t: skip chain lint when PERL_PATH is unset Patrick Steinhardt
2025-04-03 5:05 ` [PATCH v4 02/20] t: refactor environment sanitization to not use Perl Patrick Steinhardt
2025-04-03 5:05 ` [PATCH v4 03/20] t: adapt character translation helpers " Patrick Steinhardt
2025-04-03 5:05 ` [PATCH v4 04/20] t: adapt `test_copy_bytes()` " Patrick Steinhardt
2025-04-03 5:05 ` [PATCH v4 05/20] t: adapt `test_readlink()` " Patrick Steinhardt
2025-04-03 5:05 ` [PATCH v4 06/20] t: introduce PERL_TEST_HELPERS prerequisite Patrick Steinhardt
2025-04-03 5:05 ` [PATCH v4 07/20] t: adapt existing PERL prerequisites Patrick Steinhardt
2025-04-03 5:05 ` [PATCH v4 08/20] meson: stop requiring Perl when tests are enabled Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 09/20] Makefile: stop requiring Perl when running tests Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 10/20] t: refactor tests depending on Perl transliteration operator Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 11/20] t: refactor tests depending on Perl substitution operator Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 12/20] t: refactor tests depending on Perl to print data Patrick Steinhardt
2025-06-10 19:52 ` SZEDER Gábor
2025-06-10 21:31 ` Junio C Hamano
2025-07-07 9:53 ` Patrick Steinhardt
2025-06-10 21:44 ` Junio C Hamano
2025-04-03 5:06 ` [PATCH v4 13/20] t: refactor tests depending on Perl for textconv scripts Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 14/20] t/lib-gpg: refactor `sanitize_pgp()` to not depend on Perl Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 15/20] t/lib-t6000: refactor `name_from_description()` " Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 16/20] t/lib-httpd: refactor "one-time-perl" CGI script " Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 17/20] t0021: refactor `generate_random_characters()` " Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 18/20] t0210: refactor trace2 scrubbing to not use Perl Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 19/20] t5316: refactor `max_chain()` to not depend on Perl Patrick Steinhardt
2025-04-03 5:06 ` [PATCH v4 20/20] t5703: refactor test " Patrick Steinhardt
2025-04-03 12:12 ` [PATCH v4 00/20] t: drop Perl as a mandatory prerequisite Johannes Schindelin
2025-04-08 0:32 ` 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='CAOLa=ZR3V9e33oU5ard+eZLCUQgMybGwcj9PLMr7hy+4wNgM_Q@mail.gmail.com' \
--to=karthik.188@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/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).