From: Lars Schneider <larsxschneider@gmail.com>
To: Jeff King <peff@peff.net>
Cc: "Torsten Bögershausen" <tboegi@web.de>,
"Junio C Hamano" <gitster@pobox.com>,
git@vger.kernel.org
Subject: Re: [PATCH 3/4] t0021: use $PERL_PATH for rot13-filter.pl
Date: Sun, 6 Nov 2016 15:52:00 +0100 [thread overview]
Message-ID: <E073426F-8285-4D11-91BC-E1B80F54AD32@gmail.com> (raw)
In-Reply-To: <20161102182022.zalzmc6rcwmvrgqq@sigill.intra.peff.net>
> On 02 Nov 2016, at 19:20, Jeff King <peff@peff.net> wrote:
>
> The rot13-filter.pl script hardcodes "#!/usr/bin/perl", and
> does not respect $PERL_PATH at all. That is a problem if the
> system does not have perl at that path, or if it has a perl
> that is too old to run a complicated script like the
> rot13-filter (but PERL_PATH points to a more modern one).
>
> We can fix this by using write_script() to create a new copy
> of the script with the correct #!-line. In theory we could
> move the whole script inside t0021-conversion.sh rather than
> having it as an auxiliary file, but it's long enough that
> it just makes things harder to read.
>
> As a bonus, we can stop using the full path to the script in
> the filter-process config we add (because the trash
> directory is in our PATH). Not only is this shorter, but it
> sidesteps any shell-quoting issues. The original was broken
> when $TEST_DIRECTORY contained a space, because it was
> interpolated in the outer script.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> t/t0021-conversion.sh | 19 +++++++++++--------
> t/t0021/rot13-filter.pl | 1 -
> 2 files changed, 11 insertions(+), 9 deletions(-)
> mode change 100755 => 100644 t/t0021/rot13-filter.pl
>
> diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
> index c1ad20c61..a8fa52148 100755
> --- a/t/t0021-conversion.sh
> +++ b/t/t0021-conversion.sh
> @@ -13,6 +13,9 @@ tr \
> 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
> EOF
>
> +write_script rot13-filter.pl "$PERL_PATH" \
> + <"$TEST_DIRECTORY"/t0021/rot13-filter.pl
> +
> generate_random_characters () {
> LEN=$1
> NAME=$2
> @@ -341,7 +344,7 @@ test_expect_success 'diff does not reuse worktree files that need cleaning' '
> '
>
> test_expect_success PERL 'required process filter should filter data' '
> - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
> + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> test_config_global filter.protocol.required true &&
> rm -rf repo &&
> mkdir repo &&
> @@ -434,7 +437,7 @@ test_expect_success PERL 'required process filter should filter data' '
>
> test_expect_success PERL 'required process filter takes precedence' '
> test_config_global filter.protocol.clean false &&
> - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" &&
> + test_config_global filter.protocol.process "rot13-filter.pl clean" &&
> test_config_global filter.protocol.required true &&
> rm -rf repo &&
> mkdir repo &&
> @@ -459,7 +462,7 @@ test_expect_success PERL 'required process filter takes precedence' '
> '
>
> test_expect_success PERL 'required process filter should be used only for "clean" operation only' '
> - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" &&
> + test_config_global filter.protocol.process "rot13-filter.pl clean" &&
> rm -rf repo &&
> mkdir repo &&
> (
> @@ -494,7 +497,7 @@ test_expect_success PERL 'required process filter should be used only for "clean
> '
>
> test_expect_success PERL 'required process filter should process multiple packets' '
> - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
> + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> test_config_global filter.protocol.required true &&
>
> rm -rf repo &&
> @@ -554,7 +557,7 @@ test_expect_success PERL 'required process filter should process multiple packet
> '
>
> test_expect_success PERL 'required process filter with clean error should fail' '
> - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
> + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> test_config_global filter.protocol.required true &&
> rm -rf repo &&
> mkdir repo &&
> @@ -573,7 +576,7 @@ test_expect_success PERL 'required process filter with clean error should fail'
> '
>
> test_expect_success PERL 'process filter should restart after unexpected write failure' '
> - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
> + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> rm -rf repo &&
> mkdir repo &&
> (
> @@ -624,7 +627,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
> '
>
> test_expect_success PERL 'process filter should not be restarted if it signals an error' '
> - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
> + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> rm -rf repo &&
> mkdir repo &&
> (
> @@ -663,7 +666,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
> '
>
> test_expect_success PERL 'process filter abort stops processing of all further files' '
> - test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
> + test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> rm -rf repo &&
> mkdir repo &&
> (
> diff --git a/t/t0021/rot13-filter.pl b/t/t0021/rot13-filter.pl
> old mode 100755
> new mode 100644
> index ae4c50f5c..e3ea58e1e
> --- a/t/t0021/rot13-filter.pl
> +++ b/t/t0021/rot13-filter.pl
> @@ -1,4 +1,3 @@
> -#!/usr/bin/perl
> #
> # Example implementation for the Git filter protocol version 2
> # See Documentation/gitattributes.txt, section "Filter Protocol"
> --
> 2.11.0.rc0.258.gf434c15
Looks good to me!
Minor pedantic nit:
Would it make sense to rename "rot13-filter.pl" to
"rot13-filter.pl.template" or something because of the
missing shebang?
- Lars
next prev parent reply other threads:[~2016-11-06 14:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-31 21:49 What's cooking in git.git (Oct 2016, #09; Mon, 31) Junio C Hamano
2016-11-02 7:16 ` Torsten Bögershausen
2016-11-02 12:55 ` Junio C Hamano
2016-11-02 9:57 ` Johannes Schindelin
2016-11-02 12:57 ` Junio C Hamano
2016-11-02 17:04 ` Torsten Bögershausen
2016-11-02 17:40 ` Jeff King
2016-11-02 18:16 ` [PATCH 0/4] t0021 perl portability fixups Jeff King
2016-11-02 18:17 ` [PATCH 1/4] t0021: use write_script to create rot13 shell script Jeff King
2016-11-06 14:25 ` Lars Schneider
2016-11-06 14:29 ` Jeff King
2016-11-06 14:43 ` Lars Schneider
2016-11-02 18:18 ` [PATCH 2/4] t0021: put $TEST_ROOT in $PATH Jeff King
2016-11-03 20:40 ` Johannes Sixt
2016-11-03 20:44 ` Jeff King
2016-11-03 21:09 ` Johannes Sixt
2016-11-06 14:29 ` Lars Schneider
2016-11-02 18:20 ` [PATCH 3/4] t0021: use $PERL_PATH for rot13-filter.pl Jeff King
2016-11-06 14:52 ` Lars Schneider [this message]
2016-11-06 14:54 ` Jeff King
2016-11-02 18:23 ` [PATCH 4/4] t0021: fix filehandle usage on older perl Jeff King
2016-11-02 20:54 ` Torsten Bögershausen
2016-11-06 14:55 ` Lars Schneider
2016-11-02 17:43 ` What's cooking in git.git (Oct 2016, #09; Mon, 31) Johannes Sixt
2016-11-03 14:21 ` Lars Schneider
2016-11-02 17:44 ` Lars Schneider
[not found] ` <CAG2PGspq34wn2bAGyhR6B-XmmayadmL-v3_65y5LJWTWNHXkOQ@mail.gmail.com>
2016-11-05 7:27 ` Torsten Bögershausen
2016-11-05 7:42 ` Torsten Bögershausen
2016-11-08 8:12 ` Karthik Nayak
[not found] ` <CA+P7+xo+CJU_ng5OWX1y26+=QPCg6Zxpv_0opTAzsNqeFXAwng@mail.gmail.com>
2016-11-08 9:03 ` Karthik Nayak
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E073426F-8285-4D11-91BC-E1B80F54AD32@gmail.com \
--to=larsxschneider@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=tboegi@web.de \
/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.
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).