{"thread":{"id":"41606","subject":"t9700-perl-git.sh is broken on some configurations","startedAt":"2016-03-04T08:13:51Z","lastAt":"2016-03-04T20:12:23Z","messageCount":10,"participants":["Christian Couder","Jeff King","Dennis Kaarsemaker","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"280175","messageId":"CAP8UFD1z9H=SygaMVzpc__mXTbnFc2XiW0LZ+sfzdCPmrnXW6g@mail.gmail.com","threadId":"41606","inReplyTo":null,"subject":"t9700-perl-git.sh is broken on some configurations","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-03-04T08:13:51Z","receivedAt":"2016-03-04T08:13:51Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi,\n\nIt looks like t9700-perl-git.sh is broken on one machine I use but not\non my laptop since commit d53c2c67380f769f91fd45cc8c63a5883245ccca\n(mingw: fix t9700's assumption about directory separators, Jan 27\n17:19:56 2016).\n\nI get:\n\n------------------------\nInitialized empty Git repository in /home/ccouder/git/git/t/trash\ndirectory.t9700-perl-git/.git/\nexpecting success: echo \"test file 1\" > file1 &&\n     echo \"test file 2\" > file2 &&\n     mkdir directory1 &&\n     echo \"in directory1\" >> directory1/file &&\n     mkdir directory2 &&\n     echo \"in directory2\" >> directory2/file &&\n     git add . &&\n     git commit -m \"first commit\" &&\n\n     echo \"new file in subdir 2\" > directory2/file2 &&\n     git add . &&\n     git commit -m \"commit in directory2\" &&\n\n     echo \"changed file 1\" > file1 &&\n     git commit -a -m \"second commit\" &&\n\n     git config --add color.test.slot1 green &&\n     git config --add test.string value &&\n     git config --add test.dupstring value1 &&\n     git config --add test.dupstring value2 &&\n     git config --add test.booltrue true &&\n     git config --add test.boolfalse no &&\n     git config --add test.boolother other &&\n     git config --add test.int 2k &&\n     git config --add test.path \"~/foo\" &&\n     git config --add test.pathexpanded \"$HOME/foo\" &&\n     git config --add test.pathmulti foo &&\n     git config --add test.pathmulti bar\n\n[master (root-commit) fc41470] first commit\n Author: A U Thor <author@example.com>\n 4 files changed, 4 insertions(+)\n create mode 100644 directory1/file\n create mode 100644 directory2/file\n create mode 100644 file1\n create mode 100644 file2\n[master 6a30dee] commit in directory2\n Author: A U Thor <author@example.com>\n 1 file changed, 1 insertion(+)\n create mode 100644 directory2/file2\n[master 33414b1] second commit\n Author: A U Thor <author@example.com>\n 1 file changed, 1 insertion(+), 1 deletion(-)\nok 1 - set up test repository\n\n# run 1: Perl API (perl /home/ccouder/git/git/t/t9700/test.pl)\nok 2 - use Git;\n# test_external test Perl API failed: perl /home/ccouder/git/git/t/t9700/test.pl\n# expecting no stderr from previous command\n# test_external_without_stderr test no stderr: Perl API failed: perl\n/home/ccouder/git/git/t/t9700/test.pl:\n# Stderr is:\nBareword found where operator expected at\n/home/ccouder/git/git/t/t9700/test.pl line 36, near \"s/\\\\/\\//gr\"\nsyntax error at /home/ccouder/git/git/t/t9700/test.pl line 36, near \"s/\\\\/\\//gr\"\nExecution of /home/ccouder/git/git/t/t9700/test.pl aborted due to\ncompilation errors.\n------------------------\n\nIndeed on the command line I get:\n\n------------------------\n$ t/t9700/test.pl\nok 2 - use Git;\nBareword found where operator expected at t/t9700/test.pl line 36,\nnear \"s/\\\\/\\//gr\"\nsyntax error at t/t9700/test.pl line 36, near \"s/\\\\/\\//gr\"\nExecution of t/t9700/test.pl aborted due to compilation errors.\n------------------------\n\nA quick look at t/t9700/test.pl line 36 was not enough for me to spot\nthe problem.\n\nPerl version is: perl 5, version 18, subversion 2 (v5.18.2) built for\nx86_64-linux\n\nThe machine is running CentOS 6.5.\n\nThanks,\nChristian.\n"},{"id":"280176","messageId":"20160304085649.GA29752@sigill.intra.peff.net","threadId":"41606","inReplyTo":"CAP8UFD1z9H=SygaMVzpc__mXTbnFc2XiW0LZ+sfzdCPmrnXW6g@mail.gmail.com","subject":"Re: t9700-perl-git.sh is broken on some configurations","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-03-04T08:56:49Z","receivedAt":"2016-03-04T08:56:49Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Mar 04, 2016 at 09:13:51AM +0100, Christian Couder wrote:\n\n> Indeed on the command line I get:\n> \n> ------------------------\n> $ t/t9700/test.pl\n> ok 2 - use Git;\n> Bareword found where operator expected at t/t9700/test.pl line 36,\n> near \"s/\\\\/\\//gr\"\n> syntax error at t/t9700/test.pl line 36, near \"s/\\\\/\\//gr\"\n> Execution of t/t9700/test.pl aborted due to compilation errors.\n> ------------------------\n> \n> A quick look at t/t9700/test.pl line 36 was not enough for me to spot\n> the problem.\n> \n> Perl version is: perl 5, version 18, subversion 2 (v5.18.2) built for\n> x86_64-linux\n> \n> The machine is running CentOS 6.5.\n\nI can't reproduce on any of the machines I have handy (perl 5.14, 5.20,\nand 5.22). I don't have 5.18 handy. The line in question looks fine to\nme, so perhaps it is a temporary regression in 5.18.\n\nDoes it help to wrap it in parentheses, like:\n\ndiff --git a/t/t9700/test.pl b/t/t9700/test.pl\nindex 7e8c40b..edeeb0e 100755\n--- a/t/t9700/test.pl\n+++ b/t/t9700/test.pl\n@@ -33,7 +33,7 @@ is($r->config_int(\"test.int\"), 2048, \"config_int: integer\");\n is($r->config_int(\"test.nonexistent\"), undef, \"config_int: nonexistent\");\n ok($r->config_bool(\"test.booltrue\"), \"config_bool: true\");\n ok(!$r->config_bool(\"test.boolfalse\"), \"config_bool: false\");\n-is($r->config_path(\"test.path\") =~ s/\\\\/\\//gr, $r->config(\"test.pathexpanded\"),\n+is(($r->config_path(\"test.path\") =~ s/\\\\/\\//gr), $r->config(\"test.pathexpanded\"),\n    \"config_path: ~/foo expansion\");\n is_deeply([$r->config_path(\"test.pathmulti\")], [\"foo\", \"bar\"],\n    \"config_path: multiple values\");\n\nor even write it out longhand without \"/r\":\n\ndiff --git a/t/t9700/test.pl b/t/t9700/test.pl\nindex 7e8c40b..52471cf 100755\n--- a/t/t9700/test.pl\n+++ b/t/t9700/test.pl\n@@ -33,7 +33,9 @@ is($r->config_int(\"test.int\"), 2048, \"config_int: integer\");\n is($r->config_int(\"test.nonexistent\"), undef, \"config_int: nonexistent\");\n ok($r->config_bool(\"test.booltrue\"), \"config_bool: true\");\n ok(!$r->config_bool(\"test.boolfalse\"), \"config_bool: false\");\n-is($r->config_path(\"test.path\") =~ s/\\\\/\\//gr, $r->config(\"test.pathexpanded\"),\n+my $test_path = $r->config_path(\"test.path\");\n+$test_path =~ s/\\\\/\\//g;\n+is($test_path, $r->config(\"test.pathexpanded\"),\n    \"config_path: ~/foo expansion\");\n is_deeply([$r->config_path(\"test.pathmulti\")], [\"foo\", \"bar\"],\n    \"config_path: multiple values\");\n\n? Those are just guesses, but if we are tickling a bug in perl's parser,\nthis might avoid them. I also wondered when \"/r\" appeared. It was in\n5.14, so you're presumably good there. The \"use\" statement at the top of\nthe script says \"5.008\", so perhaps we should be writing it out longhand\nanyway (that version is \"only\" 5 years old, so I suspect there are still\nsystems around with 5.12 or older).\n\n-Peff\n"},{"id":"280178","messageId":"CAP8UFD3jZ2b8jgw8dR0U=AkPTTm5nO1F92UVjyeAMsfiOaJ_5w@mail.gmail.com","threadId":"41606","inReplyTo":"20160304085649.GA29752@sigill.intra.peff.net","subject":"Re: t9700-perl-git.sh is broken on some configurations","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-03-04T10:30:36Z","receivedAt":"2016-03-04T10:30:36Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Fri, Mar 4, 2016 at 9:56 AM, Jeff King <peff@peff.net> wrote:\n> On Fri, Mar 04, 2016 at 09:13:51AM +0100, Christian Couder wrote:\n>\n>> Indeed on the command line I get:\n>>\n>> ------------------------\n>> $ t/t9700/test.pl\n>> ok 2 - use Git;\n>> Bareword found where operator expected at t/t9700/test.pl line 36,\n>> near \"s/\\\\/\\//gr\"\n>> syntax error at t/t9700/test.pl line 36, near \"s/\\\\/\\//gr\"\n>> Execution of t/t9700/test.pl aborted due to compilation errors.\n>> ------------------------\n>>\n>> A quick look at t/t9700/test.pl line 36 was not enough for me to spot\n>> the problem.\n>>\n>> Perl version is: perl 5, version 18, subversion 2 (v5.18.2) built for\n>> x86_64-linux\n>>\n>> The machine is running CentOS 6.5.\n>\n> I can't reproduce on any of the machines I have handy (perl 5.14, 5.20,\n> and 5.22). I don't have 5.18 handy. The line in question looks fine to\n> me, so perhaps it is a temporary regression in 5.18.\n\nIt is strange because on the same machine there is also v5.10.1\ninstalled and I get the same error with it.\n\n> Does it help to wrap it in parentheses, like:\n>\n> diff --git a/t/t9700/test.pl b/t/t9700/test.pl\n> index 7e8c40b..edeeb0e 100755\n> --- a/t/t9700/test.pl\n> +++ b/t/t9700/test.pl\n> @@ -33,7 +33,7 @@ is($r->config_int(\"test.int\"), 2048, \"config_int: integer\");\n>  is($r->config_int(\"test.nonexistent\"), undef, \"config_int: nonexistent\");\n>  ok($r->config_bool(\"test.booltrue\"), \"config_bool: true\");\n>  ok(!$r->config_bool(\"test.boolfalse\"), \"config_bool: false\");\n> -is($r->config_path(\"test.path\") =~ s/\\\\/\\//gr, $r->config(\"test.pathexpanded\"),\n> +is(($r->config_path(\"test.path\") =~ s/\\\\/\\//gr), $r->config(\"test.pathexpanded\"),\n>     \"config_path: ~/foo expansion\");\n>  is_deeply([$r->config_path(\"test.pathmulti\")], [\"foo\", \"bar\"],\n>     \"config_path: multiple values\");\n\nNo, parentheses don't help.\n\n> or even write it out longhand without \"/r\":\n>\n> diff --git a/t/t9700/test.pl b/t/t9700/test.pl\n> index 7e8c40b..52471cf 100755\n> --- a/t/t9700/test.pl\n> +++ b/t/t9700/test.pl\n> @@ -33,7 +33,9 @@ is($r->config_int(\"test.int\"), 2048, \"config_int: integer\");\n>  is($r->config_int(\"test.nonexistent\"), undef, \"config_int: nonexistent\");\n>  ok($r->config_bool(\"test.booltrue\"), \"config_bool: true\");\n>  ok(!$r->config_bool(\"test.boolfalse\"), \"config_bool: false\");\n> -is($r->config_path(\"test.path\") =~ s/\\\\/\\//gr, $r->config(\"test.pathexpanded\"),\n> +my $test_path = $r->config_path(\"test.path\");\n> +$test_path =~ s/\\\\/\\//g;\n> +is($test_path, $r->config(\"test.pathexpanded\"),\n>     \"config_path: ~/foo expansion\");\n>  is_deeply([$r->config_path(\"test.pathmulti\")], [\"foo\", \"bar\"],\n>     \"config_path: multiple values\");\n>\n> ?\n\nYeah, it works like the above with both perl versions.\n\n> Those are just guesses, but if we are tickling a bug in perl's parser,\n> this might avoid them. I also wondered when \"/r\" appeared. It was in\n> 5.14, so you're presumably good there.\n\nIf I just remove the \"r\" at the end of \"s/\\\\/\\//gr\", I get with both\nPerl versions:\n\nCan't modify non-lvalue subroutine call at t/t9700/test.pl line 36.\n\n> The \"use\" statement at the top of\n> the script says \"5.008\", so perhaps we should be writing it out longhand\n> anyway (that version is \"only\" 5 years old, so I suspect there are still\n> systems around with 5.12 or older).\n\nYeah, it would work.\n\nThanks,\nChristian.\n"},{"id":"280182","messageId":"1457089104.2660.79.camel@kaarsemaker.net","threadId":"41606","inReplyTo":"20160304085649.GA29752@sigill.intra.peff.net","subject":"Re: t9700-perl-git.sh is broken on some configurations","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2016-03-04T10:58:24Z","receivedAt":"2016-03-04T10:58:24Z","isPatch":false,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"On vr, 2016-03-04 at 03:56 -0500, Jeff King wrote:\n> ? Those are just guesses, but if we are tickling a bug in perl's parser,\n> this might avoid them. I also wondered when \"/r\" appeared. It was in\n> 5.14, so you're presumably good there. The \"use\" statement at the top of\n> the script says \"5.008\", so perhaps we should be writing it out longhand\n> anyway (that version is \"only\" 5 years old, so I suspect there are still\n> systems around with 5.12 or older).\n\nKnowing the system Christian is testing on, I think the problem is that\nthe tests are actually being run against perl 5.10, which RHEL 6 ships\nas system perl. As that's still a supported OS, writing tests in a form\ncompatible with it would be a good thing :)\n\n-- \nDennis Kaarsemaker\nhttp://www.kaarsemaker.net\n"},{"id":"280183","messageId":"20160304114321.GA569@sigill.intra.peff.net","threadId":"41606","inReplyTo":"1457089104.2660.79.camel@kaarsemaker.net","subject":"[PATCH] t9700: fix test for perl older than 5.14","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-03-04T11:43:21Z","receivedAt":"2016-03-04T11:43:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Mar 04, 2016 at 11:58:24AM +0100, Dennis Kaarsemaker wrote:\n\n> On vr, 2016-03-04 at 03:56 -0500, Jeff King wrote:\n> > ? Those are just guesses, but if we are tickling a bug in perl's parser,\n> > this might avoid them. I also wondered when \"/r\" appeared. It was in\n> > 5.14, so you're presumably good there. The \"use\" statement at the top of\n> > the script says \"5.008\", so perhaps we should be writing it out longhand\n> > anyway (that version is \"only\" 5 years old, so I suspect there are still\n> > systems around with 5.12 or older).\n> \n> Knowing the system Christian is testing on, I think the problem is that\n> the tests are actually being run against perl 5.10, which RHEL 6 ships\n> as system perl. As that's still a supported OS, writing tests in a form\n> compatible with it would be a good thing :)\n\nThat would make sense. `perl` in t9700-perl-git.sh (and all of our\nscripts) is actually a shell function:\n\n  perl () {\n          command \"$PERL_PATH\" \"$@\"\n  }\n\nto make sure we respect PERL_PATH everywhere. And that defaults in the\nMakefile to /usr/bin/perl. Christian presumably has 5.14 in his $PATH,\nbut /usr/bin/perl is the system 5.10.\n\nOne workaround would therefore be for him to tweak PERL_PATH, but\nobviously that does not help anyone else. I think we should do this:\n\n-- >8 --\nSubject: t9700: fix test for perl older than 5.14\n\nCommit d53c2c6 (mingw: fix t9700's assumption about\ndirectory separators, 2016-01-27) uses perl's \"/r\" regex\nmodifier to do a non-destructive replacement on a string,\nleaving the original unmodified and returning the result.\n\nThis feature was introduced in perl 5.14, but systems with\nolder perl are still common (e.g., CentOS 6.5 still has perl\n5.10). Let's work around it by providing a helper function\nthat does the same thing using older syntax.\n\nWhile we're at it, let's switch to using an alternate regex\nseparator, which is slightly more readable.\n\nReported-by: Christian Couder <christian.couder@gmail.com>\nHelped-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>\nSigned-off-by: Jeff King <peff@peff.net>\n---\nAnd yes, before anyone checks, the alternate separators are available\neven in ancient versions of perl. :)\n\n t/t9700/test.pl | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t9700/test.pl b/t/t9700/test.pl\nindex 7e8c40b..1b75c91 100755\n--- a/t/t9700/test.pl\n+++ b/t/t9700/test.pl\n@@ -17,6 +17,12 @@ BEGIN {\n use Cwd;\n use File::Basename;\n \n+sub adjust_dirsep {\n+\tmy $path = shift;\n+\t$path =~ s{\\\\}{/}g;\n+\treturn $path;\n+}\n+\n BEGIN { use_ok('Git') }\n \n # set up\n@@ -33,7 +39,7 @@ is($r->config_int(\"test.int\"), 2048, \"config_int: integer\");\n is($r->config_int(\"test.nonexistent\"), undef, \"config_int: nonexistent\");\n ok($r->config_bool(\"test.booltrue\"), \"config_bool: true\");\n ok(!$r->config_bool(\"test.boolfalse\"), \"config_bool: false\");\n-is($r->config_path(\"test.path\") =~ s/\\\\/\\//gr, $r->config(\"test.pathexpanded\"),\n+is(adjust_dirsep($r->config_path(\"test.path\")), $r->config(\"test.pathexpanded\"),\n    \"config_path: ~/foo expansion\");\n is_deeply([$r->config_path(\"test.pathmulti\")], [\"foo\", \"bar\"],\n    \"config_path: multiple values\");\n-- \n2.8.0.rc0.309.g6677de9\n"},{"id":"280184","messageId":"20160304114542.GB569@sigill.intra.peff.net","threadId":"41606","inReplyTo":"CAP8UFD3jZ2b8jgw8dR0U=AkPTTm5nO1F92UVjyeAMsfiOaJ_5w@mail.gmail.com","subject":"Re: t9700-perl-git.sh is broken on some configurations","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-03-04T11:45:42Z","receivedAt":"2016-03-04T11:45:42Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Mar 04, 2016 at 11:30:36AM +0100, Christian Couder wrote:\n\n> > Those are just guesses, but if we are tickling a bug in perl's parser,\n> > this might avoid them. I also wondered when \"/r\" appeared. It was in\n> > 5.14, so you're presumably good there.\n> \n> If I just remove the \"r\" at the end of \"s/\\\\/\\//gr\", I get with both\n> Perl versions:\n> \n> Can't modify non-lvalue subroutine call at t/t9700/test.pl line 36.\n\nRight, because the string being operated on is the return value of a\nfunction, so we can't do substitution on it (unless with \"r\", whose\npurpose is to allow exactly such a thing).\n\n> > The \"use\" statement at the top of\n> > the script says \"5.008\", so perhaps we should be writing it out longhand\n> > anyway (that version is \"only\" 5 years old, so I suspect there are still\n> > systems around with 5.12 or older).\n> \n> Yeah, it would work.\n\nThanks for confirming the longhand does work; I think the patch I just\nposted elsewhere in the thread should be good for you, then.\n\n-Peff\n"},{"id":"280189","messageId":"1457094068.2660.85.camel@kaarsemaker.net","threadId":"41606","inReplyTo":"20160304114321.GA569@sigill.intra.peff.net","subject":"Re: [PATCH] t9700: fix test for perl older than 5.14","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2016-03-04T12:21:08Z","receivedAt":"2016-03-04T12:21:08Z","isPatch":true,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"On vr, 2016-03-04 at 06:43 -0500, Jeff King wrote:\n> On Fri, Mar 04, 2016 at 11:58:24AM +0100, Dennis Kaarsemaker wrote:\n> \n> > On vr, 2016-03-04 at 03:56 -0500, Jeff King wrote:\n> > > ? Those are just guesses, but if we are tickling a bug in perl's parser,\n> > > this might avoid them. I also wondered when \"/r\" appeared. It was in\n> > > 5.14, so you're presumably good there. The \"use\" statement at the top of\n> > > the script says \"5.008\", so perhaps we should be writing it out longhand\n> > > anyway (that version is \"only\" 5 years old, so I suspect there are still\n> > > systems around with 5.12 or older).\n> > \n> > Knowing the system Christian is testing on, I think the problem is that\n> > the tests are actually being run against perl 5.10, which RHEL 6 ships\n> > as system perl. As that's still a supported OS, writing tests in a form\n> > compatible with it would be a good thing :)\n> \n> That would make sense. `perl` in t9700-perl-git.sh (and all of our\n> scripts) is actually a shell function:\n> \n>   perl () {\n>           command \"$PERL_PATH\" \"$@\"\n>   }\n> \n> to make sure we respect PERL_PATH everywhere. And that defaults in the\n> Makefile to /usr/bin/perl. Christian presumably has 5.14 in his $PATH,\n> but /usr/bin/perl is the system 5.10.\n\nYeah, that's how our systems are set up.\n\n> One workaround would therefore be for him to tweak PERL_PATH, but\n> obviously that does not help anyone else. I think we should do this:\n\nTested against 5.10 and 5.18 and works with both. I also tested the /r\nvariant with 5.18 and that works as expected.\n\n-- \nDennis Kaarsemaker\nhttp://www.kaarsemaker.net\n"},{"id":"280199","messageId":"alpine.DEB.2.20.1603041720550.3152@virtualbox","threadId":"41606","inReplyTo":"20160304114321.GA569@sigill.intra.peff.net","subject":"Re: [PATCH] t9700: fix test for perl older than 5.14","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-03-04T16:21:27Z","receivedAt":"2016-03-04T16:21:27Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Peff,\n\nOn Fri, 4 Mar 2016, Jeff King wrote:\n\n> Subject: t9700: fix test for perl older than 5.14\n> \n> Commit d53c2c6 (mingw: fix t9700's assumption about\n> directory separators, 2016-01-27) uses perl's \"/r\" regex\n> modifier to do a non-destructive replacement on a string,\n> leaving the original unmodified and returning the result.\n> \n> This feature was introduced in perl 5.14, but systems with\n> older perl are still common (e.g., CentOS 6.5 still has perl\n> 5.10). Let's work around it by providing a helper function\n> that does the same thing using older syntax.\n> \n> While we're at it, let's switch to using an alternate regex\n> separator, which is slightly more readable.\n\nMy apologies! And thanks for cleaning up after me.\n\nCiao,\nDscho\n"},{"id":"280201","messageId":"xmqqwppiyuqy.fsf@gitster.mtv.corp.google.com","threadId":"41606","inReplyTo":"20160304114321.GA569@sigill.intra.peff.net","subject":"Re: [PATCH] t9700: fix test for perl older than 5.14","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-04T18:15:49Z","receivedAt":"2016-03-04T18:15:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> One workaround would therefore be for him to tweak PERL_PATH, but\n> obviously that does not help anyone else. I think we should do this:\n>\n> -- >8 --\n> Subject: t9700: fix test for perl older than 5.14\n>\n> Commit d53c2c6 (mingw: fix t9700's assumption about\n> directory separators, 2016-01-27) uses perl's \"/r\" regex\n> modifier to do a non-destructive replacement on a string,\n> leaving the original unmodified and returning the result.\n\nWill apply on js/mingw-tests and merge to 'master' before -rc1.\nThanks.\n\n>\n> This feature was introduced in perl 5.14, but systems with\n> older perl are still common (e.g., CentOS 6.5 still has perl\n> 5.10). Let's work around it by providing a helper function\n> that does the same thing using older syntax.\n>\n> While we're at it, let's switch to using an alternate regex\n> separator, which is slightly more readable.\n>\n> Reported-by: Christian Couder <christian.couder@gmail.com>\n> Helped-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> And yes, before anyone checks, the alternate separators are available\n> even in ancient versions of perl. :)\n>\n>  t/t9700/test.pl | 8 +++++++-\n>  1 file changed, 7 insertions(+), 1 deletion(-)\n>\n> diff --git a/t/t9700/test.pl b/t/t9700/test.pl\n> index 7e8c40b..1b75c91 100755\n> --- a/t/t9700/test.pl\n> +++ b/t/t9700/test.pl\n> @@ -17,6 +17,12 @@ BEGIN {\n>  use Cwd;\n>  use File::Basename;\n>  \n> +sub adjust_dirsep {\n> +\tmy $path = shift;\n> +\t$path =~ s{\\\\}{/}g;\n> +\treturn $path;\n> +}\n> +\n>  BEGIN { use_ok('Git') }\n>  \n>  # set up\n> @@ -33,7 +39,7 @@ is($r->config_int(\"test.int\"), 2048, \"config_int: integer\");\n>  is($r->config_int(\"test.nonexistent\"), undef, \"config_int: nonexistent\");\n>  ok($r->config_bool(\"test.booltrue\"), \"config_bool: true\");\n>  ok(!$r->config_bool(\"test.boolfalse\"), \"config_bool: false\");\n> -is($r->config_path(\"test.path\") =~ s/\\\\/\\//gr, $r->config(\"test.pathexpanded\"),\n> +is(adjust_dirsep($r->config_path(\"test.path\")), $r->config(\"test.pathexpanded\"),\n>     \"config_path: ~/foo expansion\");\n>  is_deeply([$r->config_path(\"test.pathmulti\")], [\"foo\", \"bar\"],\n>     \"config_path: multiple values\");\n"},{"id":"280211","messageId":"CAP8UFD2Jh4NAaJ-1DPSUB5A00XqQNNhEq34oDP-Nqo0W2zKVhg@mail.gmail.com","threadId":"41606","inReplyTo":"1457094068.2660.85.camel@kaarsemaker.net","subject":"Re: [PATCH] t9700: fix test for perl older than 5.14","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-03-04T20:12:23Z","receivedAt":"2016-03-04T20:12:23Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Fri, Mar 4, 2016 at 1:21 PM, Dennis Kaarsemaker\n<dennis@kaarsemaker.net> wrote:\n> On vr, 2016-03-04 at 06:43 -0500, Jeff King wrote:\n>> On Fri, Mar 04, 2016 at 11:58:24AM +0100, Dennis Kaarsemaker wrote:\n>>\n>> > On vr, 2016-03-04 at 03:56 -0500, Jeff King wrote:\n>> > > ? Those are just guesses, but if we are tickling a bug in perl's parser,\n>> > > this might avoid them. I also wondered when \"/r\" appeared. It was in\n>> > > 5.14, so you're presumably good there. The \"use\" statement at the top of\n>> > > the script says \"5.008\", so perhaps we should be writing it out longhand\n>> > > anyway (that version is \"only\" 5 years old, so I suspect there are still\n>> > > systems around with 5.12 or older).\n>> >\n>> > Knowing the system Christian is testing on, I think the problem is that\n>> > the tests are actually being run against perl 5.10, which RHEL 6 ships\n>> > as system perl. As that's still a supported OS, writing tests in a form\n>> > compatible with it would be a good thing :)\n>>\n>> That would make sense. `perl` in t9700-perl-git.sh (and all of our\n>> scripts) is actually a shell function:\n>>\n>>   perl () {\n>>           command \"$PERL_PATH\" \"$@\"\n>>   }\n>>\n>> to make sure we respect PERL_PATH everywhere. And that defaults in the\n>> Makefile to /usr/bin/perl. Christian presumably has 5.14 in his $PATH,\n>> but /usr/bin/perl is the system 5.10.\n>\n> Yeah, that's how our systems are set up.\n\nYeah, you are both right.\n\nThanks for debugging this,\nChristian.\n"}]}