util-lib: Don't propagate EACCES from find_binary PATH lookup to caller
authorChris Down <chris@chrisdown.name>
Wed, 25 Sep 2019 16:09:38 +0000 (17:09 +0100)
committerMichael Biebl <biebl@debian.org>
Sun, 10 Nov 2019 23:58:41 +0000 (23:58 +0000)
commit9094052d5629a4f7fabd57b13b79b4d3bb63ae6f
tree1bc77a585e68c000788ba0d2b470e591f86f04df
parent54b6392a0d262e36b3d7fc4934cc02e530866f51
util-lib: Don't propagate EACCES from find_binary PATH lookup to caller

On one of my test machines, test-path-util was failing because the
find_binary("xxxx-xxxx") was returning -EACCES instead of -ENOENT. This
happens because the PATH entry on that host contains a directory which
the user in question doesn't have access to. Typically applications
ignore permission errors when searching through PATH, for example in
bash:

    $ whoami
    cdown
    $ PATH=/root:/bin type sh
    sh is /bin/sh

This behaviour is present on zsh and other shells as well, though. This
patch brings our PATH search behaviour closer to other major Unix tools.

(cherry picked from commit 4e1ddb661272ddb2f03d6046369c973657dfdd62)
(cherry picked from commit 8282bc61df10dc1f2290c9c351d5ff6fdb157c24)

Gbp-Pq: Name util-lib-Don-t-propagate-EACCES-from-find_binary-PATH-loo.patch
src/basic/path-util.c