From: Junio C Hamano Date: Tue, 30 Oct 2018 06:43:41 +0000 (+0900) Subject: Merge branch 'jk/run-command-notdot' X-Git-Tag: v2.20.0-rc0~124 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/17809a98f9b77b6295e06f54bbe500333171345a?ds=inline;hp=-c Merge branch 'jk/run-command-notdot' The implementation of run_command() API on the UNIX platforms had a bug that caused a command not on $PATH to be found in the current directory. * jk/run-command-notdot: run-command: mark path lookup errors with ENOENT --- 17809a98f9b77b6295e06f54bbe500333171345a diff --combined t/t0061-run-command.sh index 3e131c5325,b9cfc03a53..cf932c8514 --- a/t/t0061-run-command.sh +++ b/t/t0061-run-command.sh @@@ -11,20 -11,32 +11,31 @@@ cat >hello-script <<-EO #!$SHELL_PATH cat hello-script EOF ->empty - test_expect_success 'start_command reports ENOENT' ' + test_expect_success 'start_command reports ENOENT (slash)' ' test-tool run-command start-command-ENOENT ./does-not-exist ' + test_expect_success 'start_command reports ENOENT (no slash)' ' + test-tool run-command start-command-ENOENT does-not-exist + ' + test_expect_success 'run_command can run a command' ' cat hello-script >hello.sh && chmod +x hello.sh && test-tool run-command run-command ./hello.sh >actual 2>err && test_cmp hello-script actual && - test_cmp empty err + test_must_be_empty err ' + test_expect_success 'run_command is restricted to PATH' ' + write_script should-not-run <<-\EOF && + echo yikes + EOF + test_must_fail test-tool run-command run-command should-not-run + ' + test_expect_success !MINGW 'run_command can run a script without a #! line' ' cat >hello <<-\EOF && cat hello-script @@@ -33,7 -45,7 +44,7 @@@ test-tool run-command run-command ./hello >actual 2>err && test_cmp hello-script actual && - test_cmp empty err + test_must_be_empty err ' test_expect_success 'run_command does not try to execute a directory' ' @@@ -46,7 -58,7 +57,7 @@@ PATH=$PWD/bin1:$PWD/bin2:$PATH \ test-tool run-command run-command greet >actual 2>err && test_cmp bin2/greet actual && - test_cmp empty err + test_must_be_empty err ' test_expect_success POSIXPERM 'run_command passes over non-executable file' ' @@@ -63,7 -75,7 +74,7 @@@ PATH=$PWD/bin1:$PWD/bin2:$PATH \ test-tool run-command run-command greet >actual 2>err && test_cmp bin2/greet actual && - test_cmp empty err + test_must_be_empty err ' test_expect_success POSIXPERM 'run_command reports EACCES' '