{"thread":{"id":"49907","subject":"in 2.19.2 t0061-run-command FAILs if . is in $PATH","startedAt":"2018-11-28T09:05:31Z","lastAt":"2018-11-29T10:13:48Z","messageCount":4,"participants":["H.Merijn Brand","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"364201","messageId":"20181128100517.28d44804@pc09.procura.nl","threadId":"49907","inReplyTo":null,"subject":"in 2.19.2 t0061-run-command FAILs if . is in $PATH","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2018-11-28T09:05:17Z","receivedAt":"2018-11-28T09:05:31Z","isPatch":false,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"the test is explicitely checking that it should not find runnable\nscripts outside $PATH, *assuming* $PATH does not have . in it\n\nHaving '.' in $PATH can be seen as a bad idea (and it most likely is),\nbut the tests should either remove '.' from $PATH before testing or\nignore that fail if $PATH does have '.', as it is not illegal\n\n$ git-2.19.2/t 504 > prove -v t0061-run-command.sh\nt0061-run-command.sh ..\nok 1 - start_command reports ENOENT (slash)\nok 2 - start_command reports ENOENT (no slash)\nok 3 - run_command can run a command\nok 4 - run_command is restricted to PATH\nok 5 - run_command can run a script without a #! line\nok 6 - run_command does not try to execute a directory\nok 7 - run_command passes over non-executable file\nok 8 - run_command reports EACCES\nok 9 - unreadable directory in PATH\nok 10 - run_command runs in parallel with more jobs available than tasks\nok 11 - run_command runs in parallel with as many jobs as tasks\nok 12 - run_command runs in parallel with more tasks than jobs available\nok 13 - run_command is asked to abort gracefully\nok 14 - run_command outputs\nok 15 - GIT_TRACE with environment variables\n# passed all 15 test(s)\n1..15\nok\nAll tests successful.\nFiles=1, Tests=15,  1 wallclock secs ( 0.04 usr  0.01 sys +  0.26 cusr  0.07 csys =  0.38 CPU)\nResult: PASS\n\n$ env PATH=\"$PATH\"\":.\" prove -v t0061-run-command.sh\nt0061-run-command.sh ..\nok 1 - start_command reports ENOENT (slash)\nok 2 - start_command reports ENOENT (no slash)\nok 3 - run_command can run a command\nnot ok 4 - run_command is restricted to PATH\n#\n#               write_script should-not-run <<-\\EOF &&\n#               echo yikes\n#               EOF\n#               test_must_fail test-tool run-command run-command should-not-run\n#\nok 5 - run_command can run a script without a #! line\nok 6 - run_command does not try to execute a directory\nok 7 - run_command passes over non-executable file\nok 8 - run_command reports EACCES\nok 9 - unreadable directory in PATH\nok 10 - run_command runs in parallel with more jobs available than tasks\nok 11 - run_command runs in parallel with as many jobs as tasks\nok 12 - run_command runs in parallel with more tasks than jobs available\nok 13 - run_command is asked to abort gracefully\nok 14 - run_command outputs\nok 15 - GIT_TRACE with environment variables\n# failed 1 among 15 test(s)\n1..15\nDubious, test returned 1 (wstat 256, 0x100)\nFailed 1/15 subtests\n\nTest Summary Report\n-------------------\nt0061-run-command.sh (Wstat: 256 Tests: 15 Failed: 1)\n  Failed test:  4\n  Non-zero exit status: 1\nFiles=1, Tests=15,  1 wallclock secs ( 0.03 usr  0.00 sys +  0.24 cusr  0.07 csys =  0.34 CPU)\nResult: FAIL\n\n-- \nH.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/\nusing perl5.00307 .. 5.29   porting perl5 on HP-UX, AIX, and openSUSE\nhttp://mirrors.develooper.com/hpux/        http://www.test-smoke.org/\nhttp://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"364206","messageId":"nycvar.QRO.7.76.6.1811281041400.41@tvgsbejvaqbjf.bet","threadId":"49907","inReplyTo":"20181128100517.28d44804@pc09.procura.nl","subject":"Re: in 2.19.2 t0061-run-command FAILs if . is in $PATH","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-11-28T09:42:45Z","receivedAt":"2018-11-28T09:42:49Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 28 Nov 2018, H.Merijn Brand wrote:\n\n> the test is explicitely checking that it should not find runnable\n> scripts outside $PATH, *assuming* $PATH does not have . in it\n\nDoes this fix it for you?\n\n-- snip --\ndiff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh\nindex f3f308920f04..4949fdfde88b 100755\n--- a/t/t0061-run-command.sh\n+++ b/t/t0061-run-command.sh\n@@ -33,7 +33,14 @@ test_expect_success 'run_command can run a command' '\n \ttest_must_be_empty err\n '\n \n-test_expect_success 'run_command is restricted to PATH' '\n+test_lazy_prereq DOT_IN_PATH '\n+\tcase \":$PATH:\" in\n+\t*:.:*) true;;\n+\t*) false;;\n+\tesac\n+'\n+\n+test_expect_success !DOT_IN_PATH 'run_command is restricted to PATH' '\n \twrite_script should-not-run <<-\\EOF &&\n \techo yikes\n \tEOF\n-- snap --\n\nIf so, can you please provide a commit message for it (you can add my\nSigned-off-by: line and your Tested-by: line).\n\nThanks,\nJohannes\n\n\n> \n> Having '.' in $PATH can be seen as a bad idea (and it most likely is),\n> but the tests should either remove '.' from $PATH before testing or\n> ignore that fail if $PATH does have '.', as it is not illegal\n> \n> $ git-2.19.2/t 504 > prove -v t0061-run-command.sh\n> t0061-run-command.sh ..\n> ok 1 - start_command reports ENOENT (slash)\n> ok 2 - start_command reports ENOENT (no slash)\n> ok 3 - run_command can run a command\n> ok 4 - run_command is restricted to PATH\n> ok 5 - run_command can run a script without a #! line\n> ok 6 - run_command does not try to execute a directory\n> ok 7 - run_command passes over non-executable file\n> ok 8 - run_command reports EACCES\n> ok 9 - unreadable directory in PATH\n> ok 10 - run_command runs in parallel with more jobs available than tasks\n> ok 11 - run_command runs in parallel with as many jobs as tasks\n> ok 12 - run_command runs in parallel with more tasks than jobs available\n> ok 13 - run_command is asked to abort gracefully\n> ok 14 - run_command outputs\n> ok 15 - GIT_TRACE with environment variables\n> # passed all 15 test(s)\n> 1..15\n> ok\n> All tests successful.\n> Files=1, Tests=15,  1 wallclock secs ( 0.04 usr  0.01 sys +  0.26 cusr  0.07 csys =  0.38 CPU)\n> Result: PASS\n> \n> $ env PATH=\"$PATH\"\":.\" prove -v t0061-run-command.sh\n> t0061-run-command.sh ..\n> ok 1 - start_command reports ENOENT (slash)\n> ok 2 - start_command reports ENOENT (no slash)\n> ok 3 - run_command can run a command\n> not ok 4 - run_command is restricted to PATH\n> #\n> #               write_script should-not-run <<-\\EOF &&\n> #               echo yikes\n> #               EOF\n> #               test_must_fail test-tool run-command run-command should-not-run\n> #\n> ok 5 - run_command can run a script without a #! line\n> ok 6 - run_command does not try to execute a directory\n> ok 7 - run_command passes over non-executable file\n> ok 8 - run_command reports EACCES\n> ok 9 - unreadable directory in PATH\n> ok 10 - run_command runs in parallel with more jobs available than tasks\n> ok 11 - run_command runs in parallel with as many jobs as tasks\n> ok 12 - run_command runs in parallel with more tasks than jobs available\n> ok 13 - run_command is asked to abort gracefully\n> ok 14 - run_command outputs\n> ok 15 - GIT_TRACE with environment variables\n> # failed 1 among 15 test(s)\n> 1..15\n> Dubious, test returned 1 (wstat 256, 0x100)\n> Failed 1/15 subtests\n> \n> Test Summary Report\n> -------------------\n> t0061-run-command.sh (Wstat: 256 Tests: 15 Failed: 1)\n>   Failed test:  4\n>   Non-zero exit status: 1\n> Files=1, Tests=15,  1 wallclock secs ( 0.03 usr  0.00 sys +  0.24 cusr  0.07 csys =  0.34 CPU)\n> Result: FAIL\n> \n> -- \n> H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/\n> using perl5.00307 .. 5.29   porting perl5 on HP-UX, AIX, and openSUSE\n> http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/\n> http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/\n> \n"},{"id":"364278","messageId":"xmqqpnuor6qs.fsf@gitster-ct.c.googlers.com","threadId":"49907","inReplyTo":"nycvar.QRO.7.76.6.1811281041400.41@tvgsbejvaqbjf.bet","subject":"Re: in 2.19.2 t0061-run-command FAILs if . is in $PATH","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-11-29T01:51:23Z","receivedAt":"2018-11-29T01:51:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> -test_expect_success 'run_command is restricted to PATH' '\n> +test_lazy_prereq DOT_IN_PATH '\n> +\tcase \":$PATH:\" in\n> +\t*:.:*) true;;\n> +\t*) false;;\n> +\tesac\n> +'\n\nAn empty element in the colon-separated list also serves as an\ninstruction to pick up executable from $cwd, so\n\n\tcase \":$PATH:\" in\n\t*:.:** | *::*) true ;;\n\t*) false ;;\n\tesac\n\nperhaps.\n\n> +test_expect_success !DOT_IN_PATH 'run_command is restricted to PATH' '\n>  \twrite_script should-not-run <<-\\EOF &&\n>  \techo yikes\n>  \tEOF\n> -- snap --\n>\n> If so, can you please provide a commit message for it (you can add my\n> Signed-off-by: line and your Tested-by: line).\n>\n> Thanks,\n> Johannes\n"},{"id":"364300","messageId":"nycvar.QRO.7.76.6.1811291112460.41@tvgsbejvaqbjf.bet","threadId":"49907","inReplyTo":"xmqqpnuor6qs.fsf@gitster-ct.c.googlers.com","subject":"Re: in 2.19.2 t0061-run-command FAILs if . is in $PATH","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-11-29T10:13:39Z","receivedAt":"2018-11-29T10:13:48Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Merijn and Junio,\n\nOn Thu, 29 Nov 2018, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > -test_expect_success 'run_command is restricted to PATH' '\n> > +test_lazy_prereq DOT_IN_PATH '\n> > +\tcase \":$PATH:\" in\n> > +\t*:.:*) true;;\n> > +\t*) false;;\n> > +\tesac\n> > +'\n> \n> An empty element in the colon-separated list also serves as an\n> instruction to pick up executable from $cwd, so\n> \n> \tcase \":$PATH:\" in\n> \t*:.:** | *::*) true ;;\n> \t*) false ;;\n> \tesac\n> \n> perhaps.\n\nGood point.\n\nMerijn, please be sure to squash this fix in before you submit the final\nthing.\n\nThanks,\nJohannes\n\n> \n> > +test_expect_success !DOT_IN_PATH 'run_command is restricted to PATH' '\n> >  \twrite_script should-not-run <<-\\EOF &&\n> >  \techo yikes\n> >  \tEOF\n> > -- snap --\n> >\n> > If so, can you please provide a commit message for it (you can add my\n> > Signed-off-by: line and your Tested-by: line).\n> >\n> > Thanks,\n> > Johannes\n> \n"}]}