From ffcc1e9d9420e03eb5a1a208fbf5ab9ff60c2a26 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 24 Jun 2014 19:28:40 +0200 Subject: [ticket/12693] Extract exceptions, bin/* must be executable PHPBB3-12693 --- travis/check-executable-files.sh | 57 ++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/travis/check-executable-files.sh b/travis/check-executable-files.sh index 469ac4a496..6ec91145ba 100755 --- a/travis/check-executable-files.sh +++ b/travis/check-executable-files.sh @@ -16,40 +16,51 @@ path="$3" if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ] then - # Get the list of the executables files under a given path - # The part "-name 'develop' -o -name 'vendor'" defines a set - # of ignored directories. - # The part "-path '*/bin/phpbbcli.php' -o -name 'composer.phar'" - # defines a whitelist. + # Check the permissions of the files - executables_files=$( \ + # Directories to skip + directories_skipped="-path ${path}develop -o -path ${path}vendor" + + # Files to skip + files_skipped="-name composer.phar" + + # Files which have to be executable + executable_files="-path ${path}bin/*" + + incorect_files=$( \ find ${path} \ '(' \ '(' \ - -name 'develop' -o \ - -name 'vendor' \ + ${directories_skipped} \ ')' \ -a -type d -prune -a -type f \ - ')' \ - -o '(' \ + ')' -o \ + '(' \ + -type f -a \ -not '(' \ - -path '*/bin/phpbbcli.php' -o \ - -name 'composer.phar' \ - ')' \ - -a '(' \ + ${files_skipped} \ + ')' -a \ '(' \ - -type f -a \ - -perm +111 \ - ')' -o \ - -not -perm -600 \ + '(' \ + '(' \ + ${executable_files} \ + ')' -a \ + -not -perm -100 \ + ')' -o \ + '(' \ + -not '(' \ + ${executable_files} \ + ')' -a \ + -perm +111 \ + ')' \ + ')' \ ')' \ - ')' \ - ) + ) - if [ "$executables_files" != '' ] + if [ "${incorect_files}" != '' ] then - ls -la $executables_files - echo "MUST NOT be executable and MUST be readable and writable by the owner."; + ls -la ${incorect_files} + echo "does not have the proper permissions."; exit 1; fi fi -- cgit v1.2.1