{"thread":{"id":"42811","subject":"[PATCH] guilt: fix portability problem with using find -perm +111","startedAt":"2016-07-09T22:18:41Z","lastAt":"2016-07-10T07:01:38Z","messageCount":2,"participants":["Theodore Ts'o","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"291110","messageId":"1468102715-465-1-git-send-email-tytso@mit.edu","threadId":"42811","inReplyTo":null,"subject":"[PATCH] guilt: fix portability problem with using find -perm +111","fromName":"Theodore Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2016-07-09T22:18:35Z","receivedAt":"2016-07-09T22:18:41Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"GNU find no longers accepts -perm +111, even though the rest of the\nworld (MacOS, Solaris, BSD) still do.  Workaround this problem by\nusing -executable if the system find utility will accept it.\n\nSigned-off-by: Theodore Ts'o <tytso@mit.edu>\n---\n guilt | 13 +++++++++++--\n 1 file changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex 38d426b..b90f02d 100755\n--- a/guilt\n+++ b/guilt\n@@ -73,8 +73,17 @@ GUILT_PATH=\"$(dirname \"$0\")\"\n \n guilt_commands()\n {\n-\tfind \"$GUILT_PATH/../lib/guilt\" -maxdepth 1 -name \"guilt-*\" -type f -perm +111 2> /dev/null | sed -e \"s/.*\\\\/$GUILT-//\"\n-\tfind \"$GUILT_PATH\" -maxdepth 1 -name \"guilt-*\" -type f -perm +111 | sed -e \"s/.*\\\\/$GUILT-//\"\n+\t# GNU Find no longer accepts -perm +111, even though the rest\n+\t# world (MacOS, Solaris, BSD, etc.) does.  Sigh.  Using -executable\n+\t# is arugably better, but it is a GNU extension.  Since this isn't\n+\t# a fast path and guilt doesn't use autoconf, test for it as needed.\n+\tif find . -maxdepth 0 -executable > /dev/null 2>&1 ; then\n+\t\texe_test=\"-executable\"\n+\telse\n+\t\texe_test=\"-find +111\"\n+\tfi\n+\tfind \"$GUILT_PATH/../lib/guilt\" -maxdepth 1 -name \"guilt-*\" -type f $exe_test 2> /dev/null | sed -e \"s/.*\\\\/$GUILT-//\"\n+\tfind \"$GUILT_PATH\" -maxdepth 1 -name \"guilt-*\" -type f $exe_test | sed -e \"s/.*\\\\/$GUILT-//\"\n }\n \n # by default, we shouldn't fail\n-- \n2.5.0\n\n"},{"id":"291122","messageId":"alpine.DEB.2.20.1607100900320.6426@virtualbox","threadId":"42811","inReplyTo":"1468102715-465-1-git-send-email-tytso@mit.edu","subject":"Re: [PATCH] guilt: fix portability problem with using find -perm +111","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-07-10T07:01:23Z","receivedAt":"2016-07-10T07:01:38Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ted,\n\nOn Sat, 9 Jul 2016, Theodore Ts'o wrote:\n\n> +\t# is arugably better, but it is a GNU extension.  Since this isn't\n\ns/arugably/arguably/\n\nCiao,\nDscho\n"}]}