2021-01-22 13:44:05 -03:00
|
|
|
#!/usr/bin/env bash
|
2020-12-27 11:26:43 -03:00
|
|
|
|
|
|
|
|
set -eo pipefail
|
2020-07-27 00:57:14 -03:00
|
|
|
|
|
|
|
|
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
2026-04-22 19:04:11 -03:00
|
|
|
cd "${script_path}/../.." || exit 1
|
2020-07-27 00:57:14 -03:00
|
|
|
|
2026-03-24 18:08:36 -03:00
|
|
|
tests_find_args=(
|
|
|
|
|
Tests/
|
|
|
|
|
\( -name WPT -o -path '*/wpt-import' \) -prune
|
|
|
|
|
-or
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
ignored_executable_paths='^(Meta/lint-executable-resources\.sh)$'
|
|
|
|
|
|
2021-10-26 15:12:59 -03:00
|
|
|
if [ "$(uname -s)" = "Darwin" ]; then
|
|
|
|
|
# MacOS's find does not support '-executable' OR '-perm /mode'.
|
2024-05-30 16:19:35 -03:00
|
|
|
BAD_FILES=$(find Base/res/ -type f -perm +111)
|
2026-03-24 18:08:36 -03:00
|
|
|
BAD_FILES+=$(find "${tests_find_args[@]}" -perm +111 \! -type d -print | grep -Ev "(${ignored_executable_paths}|\\.(sh|py)$)" || true)
|
2021-10-26 15:12:59 -03:00
|
|
|
else
|
2024-05-30 16:19:35 -03:00
|
|
|
BAD_FILES=$(find Base/res/ -type f -executable)
|
2026-03-24 18:08:36 -03:00
|
|
|
BAD_FILES+=$(find "${tests_find_args[@]}" -executable \! -type d -print | grep -Ev "(${ignored_executable_paths}|\\.(sh|py)$)" || true)
|
2021-10-26 15:12:59 -03:00
|
|
|
fi
|
2020-07-27 00:57:14 -03:00
|
|
|
|
|
|
|
|
if [ -n "${BAD_FILES}" ]
|
|
|
|
|
then
|
|
|
|
|
echo "These files are marked as executable, but are in directories that do not commonly"
|
|
|
|
|
echo "contain executables. Please double-check the permissions of these files:"
|
|
|
|
|
echo "${BAD_FILES}" | xargs ls -ld
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|