guilt: fix portability problem with using find -perm +111
PATCH 1/1 guilt: fix portability problem with using find -perm +111
GNU find no longers accepts -perm +111, even though the rest of the world (MacOS, Solaris, BSD) still do. Workaround this problem by using -executable if the system find utility will accept it.
Signed-off-by Theodore Ts'o <[email protected]>
--- guilt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
guilt +11 -2
@@ -73,8 +73,17 @@ GUILT_PATH="$(dirname "$0")" guilt_commands() { - find "$GUILT_PATH/../lib/guilt" -maxdepth 1 -name "guilt-*" -type f -perm +111 2> /dev/null | sed -e "s/.*\\/$GUILT-//" - find "$GUILT_PATH" -maxdepth 1 -name "guilt-*" -type f -perm +111 | sed -e "s/.*\\/$GUILT-//" + # GNU Find no longer accepts -perm +111, even though the rest + # world (MacOS, Solaris, BSD, etc.) does. Sigh. Using -executable + # is arugably better, but it is a GNU extension. Since this isn't + # a fast path and guilt doesn't use autoconf, test for it as needed. + if find . -maxdepth 0 -executable > /dev/null 2>&1 ; then + exe_test="-executable" + else + exe_test="-find +111" + fi + find "$GUILT_PATH/../lib/guilt" -maxdepth 1 -name "guilt-*" -type f $exe_test 2> /dev/null | sed -e "s/.*\\/$GUILT-//" + find "$GUILT_PATH" -maxdepth 1 -name "guilt-*" -type f $exe_test | sed -e "s/.*\\/$GUILT-//" } # by default, we shouldn't fail
Signature · 1 line
2.5.0
Hi Ted,
guilt GUILT_PATH="$(dirname "$0")" · line 78
Quoted 1 line · Theodore Ts'o
guilt +1
-0+ # is arugably better, but it is a GNU extension. Since this isn't
s/arugably/arguably/
Ciao,
Dscho