Re: [PATCH 2/2] git: continue alias lookup on EACCES errors

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/2] git: continue alias lookup on EACCES errors

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:24

Jeff King [off-list ref] writes:
If git receives an EACCES error while trying to execute an
external command, we currently give up and report the error.
However, the EACCES may be caused by an inaccessible
directory in the user's PATH.
Regardless of EACCES/ENOENT change we discussed, the observable behaviour
should be testable.  Something like this?

 t/t0061-run-command.sh |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index 8d4938f..dbb1d9e 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -26,7 +26,7 @@ test_expect_success 'run_command can run a command' '
 	test_cmp empty err
 '
 
-test_expect_success POSIXPERM 'run_command reports EACCES' '
+test_expect_failure POSIXPERM 'run_command reports EACCES' '
 	cat hello-script >hello.sh &&
 	chmod -x hello.sh &&
 	test_must_fail test-run-command run-command ./hello.sh 2>err &&
@@ -34,4 +34,17 @@ test_expect_success POSIXPERM 'run_command reports EACCES' '
 	grep "fatal: cannot exec.*hello.sh" err
 '
 
+test_expect_success POSIXPERM 'unreadable directory in PATH' '
+	mkdir local-command &&
+	test_when_finished "chmod u+rwx local-command && rm -fr local-command" &&
+	git config alias.nitfol "!echo frotz" &&
+	chmod a-rx local-command &&
+	(
+		PATH=./local-command:$PATH &&
+		git nitfol >actual
+	) &&
+	echo frotz >expect &&
+	test_cmp expect actual
+'
+
 test_done

Re: [PATCH 2/2] git: continue alias lookup on EACCES errors

From: Jeff King <hidden>
Date: 2016-06-15 22:53:24

On Tue, Mar 27, 2012 at 12:16:36PM -0700, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
If git receives an EACCES error while trying to execute an
external command, we currently give up and report the error.
However, the EACCES may be caused by an inaccessible
directory in the user's PATH.
Regardless of EACCES/ENOENT change we discussed, the observable behaviour
should be testable.  Something like this?
Yes, though I held back on writing tests, because I don't think we've
quite decided what the behavior _should_ be. Should we be
differentiating "chmod -x /bin/ls" from "chmod -x /bin"? Should we be
continuing alias lookup on EACCES? Should we print edit-distance
suggestions on EACCES?

I think the four cases from my previous email would be reasonable things
to test, but I wasn't sure what the expected outcomes should look like.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help