Merge branch 'jk/run-command-notdot' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 21 Nov 2018 13:57:50 +0000 (22:57 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Nov 2018 13:57:50 +0000 (22:57 +0900)
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

1  2 
t/t0061-run-command.sh
index 3e131c5325e363fa6188456e3f5f3f47f762801e,b9cfc03a53d9ef892b047df5a9d6a15fb0febf55..cf932c851411e5abd992005de474cc095abecead
@@@ -11,8 -11,9 +11,8 @@@ 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
  '
  
@@@ -22,9 -27,16 +26,16 @@@ test_expect_success 'run_command can ru
        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