aboutsummaryrefslogtreecommitdiffstats
path: root/travis/check-executable-files.sh
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-06-24 19:28:40 +0200
committerTristan Darricau <github@nicofuma.fr>2014-07-31 14:20:41 +0200
commitffcc1e9d9420e03eb5a1a208fbf5ab9ff60c2a26 (patch)
treef92a22e792debab43040d7978623850c6204e319 /travis/check-executable-files.sh
parentae9c1cddc80da6d4f105b424c6679f48e4e3fc31 (diff)
downloadforums-ffcc1e9d9420e03eb5a1a208fbf5ab9ff60c2a26.tar
forums-ffcc1e9d9420e03eb5a1a208fbf5ab9ff60c2a26.tar.gz
forums-ffcc1e9d9420e03eb5a1a208fbf5ab9ff60c2a26.tar.bz2
forums-ffcc1e9d9420e03eb5a1a208fbf5ab9ff60c2a26.tar.xz
forums-ffcc1e9d9420e03eb5a1a208fbf5ab9ff60c2a26.zip
[ticket/12693] Extract exceptions, bin/* must be executable
PHPBB3-12693
Diffstat (limited to 'travis/check-executable-files.sh')
-rwxr-xr-xtravis/check-executable-files.sh57
1 files 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