git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: t9700-perl-git.sh is broken on some configurations

From
Christian Couder <christian.couder@gmail.com>
Date
Mar 4, 2016, 10:30 UTC
Message-ID
<CAP8UFD3jZ2b8jgw8dR0U=AkPTTm5nO1F92UVjyeAMsfiOaJ_5w@mail.gmail.com>
In-Reply-To
<20160304085649.GA29752@sigill.intra.peff.net>
On Fri, Mar 4, 2016 at 9:56 AM, Jeff King <peff@peff.net> wrote:
Show 24 quoted lines
> On Fri, Mar 04, 2016 at 09:13:51AM +0100, Christian Couder wrote:
>
>> Indeed on the command line I get:
>>
>> ------------------------
>> $ t/t9700/test.pl
>> ok 2 - use Git;
>> Bareword found where operator expected at t/t9700/test.pl line 36,
>> near "s/\\/\//gr"
>> syntax error at t/t9700/test.pl line 36, near "s/\\/\//gr"
>> Execution of t/t9700/test.pl aborted due to compilation errors.
>> ------------------------
>>
>> A quick look at t/t9700/test.pl line 36 was not enough for me to spot
>> the problem.
>>
>> Perl version is: perl 5, version 18, subversion 2 (v5.18.2) built for
>> x86_64-linux
>>
>> The machine is running CentOS 6.5.
>
> I can't reproduce on any of the machines I have handy (perl 5.14, 5.20,
> and 5.22). I don't have 5.18 handy. The line in question looks fine to
> me, so perhaps it is a temporary regression in 5.18.

It is strange because on the same machine there is also v5.10.1 installed and I get the same error with it.

Show 15 quoted lines
> Does it help to wrap it in parentheses, like:
>
> diff --git a/t/t9700/test.pl b/t/t9700/test.pl
> index 7e8c40b..edeeb0e 100755
> --- a/t/t9700/test.pl
> +++ b/t/t9700/test.pl
> @@ -33,7 +33,7 @@ is($r->config_int("test.int"), 2048, "config_int: integer");
>  is($r->config_int("test.nonexistent"), undef, "config_int: nonexistent");
>  ok($r->config_bool("test.booltrue"), "config_bool: true");
>  ok(!$r->config_bool("test.boolfalse"), "config_bool: false");
> -is($r->config_path("test.path") =~ s/\\/\//gr, $r->config("test.pathexpanded"),
> +is(($r->config_path("test.path") =~ s/\\/\//gr), $r->config("test.pathexpanded"),
>     "config_path: ~/foo expansion");
>  is_deeply([$r->config_path("test.pathmulti")], ["foo", "bar"],
>     "config_path: multiple values");
No, parentheses don't help.
Show 19 quoted lines
> or even write it out longhand without "/r":
>
> diff --git a/t/t9700/test.pl b/t/t9700/test.pl
> index 7e8c40b..52471cf 100755
> --- a/t/t9700/test.pl
> +++ b/t/t9700/test.pl
> @@ -33,7 +33,9 @@ is($r->config_int("test.int"), 2048, "config_int: integer");
>  is($r->config_int("test.nonexistent"), undef, "config_int: nonexistent");
>  ok($r->config_bool("test.booltrue"), "config_bool: true");
>  ok(!$r->config_bool("test.boolfalse"), "config_bool: false");
> -is($r->config_path("test.path") =~ s/\\/\//gr, $r->config("test.pathexpanded"),
> +my $test_path = $r->config_path("test.path");
> +$test_path =~ s/\\/\//g;
> +is($test_path, $r->config("test.pathexpanded"),
>     "config_path: ~/foo expansion");
>  is_deeply([$r->config_path("test.pathmulti")], ["foo", "bar"],
>     "config_path: multiple values");
>
> ?
Yeah, it works like the above with both perl versions.
> Those are just guesses, but if we are tickling a bug in perl's parser,
> this might avoid them. I also wondered when "/r" appeared. It was in
> 5.14, so you're presumably good there.

If I just remove the "r" at the end of "s/\\/\//gr", I get with both Perl versions:

Can't modify non-lvalue subroutine call at t/t9700/test.pl line 36.
> The "use" statement at the top of
> the script says "5.008", so perhaps we should be writing it out longhand
> anyway (that version is "only" 5 years old, so I suspect there are still
> systems around with 5.12 or older).
Yeah, it would work.

Thanks, Christian.

Previous: Jeff KingNext: Jeff King
Message 3 of 10 in “t9700-perl-git.sh is broken on some configurations”
  1. Christian CouderMar 4, 2016
  2. Jeff KingMar 4, 2016
  3. Christian CouderMar 4, 2016
  4. Jeff KingMar 4, 2016
  5. Dennis KaarsemakerMar 4, 2016
  6. t9700: fix test for perl older than 5.14Jeff King, Mar 4, 2016
  7. Dennis KaarsemakerMar 4, 2016
  8. Christian CouderMar 4, 2016
  9. Johannes SchindelinMar 4, 2016
  10. Junio C HamanoMar 4, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.