diff --git a/bash_test.sh b/bash_test.sh index 0e4761e5..227cceee 100755 --- a/bash_test.sh +++ b/bash_test.sh @@ -8,7 +8,8 @@ # Tests implemented in bash. These typically will run checks about the source # code rather than the compiled one. -MYDIR=$(dirname $(realpath "$0")) +SELF=$(realpath "$0") +MYDIR=$(dirname "${SELF}") set -u diff --git a/ci.sh b/ci.sh index 939bf52d..53140846 100755 --- a/ci.sh +++ b/ci.sh @@ -13,7 +13,8 @@ set -eu OS=`uname -s` -MYDIR=$(dirname $(realpath "$0")) +SELF=$(realpath "$0") +MYDIR=$(dirname "${SELF}") ### Environment parameters: TEST_STACK_LIMIT="${TEST_STACK_LIMIT:-256}" @@ -1210,7 +1211,7 @@ cmd_lint() { # It is ok, if buildifier is not installed. #if which buildifier >/dev/null; then # local buildifier_patch="${tmpdir}/buildifier.patch" - # local bazel_files=`git -C ${MYDIR} ls-files | grep -E "/BUILD$|WORKSPACE|.bzl$"` + # local bazel_files=`git -C "${MYDIR}" ls-files | grep -E "/BUILD$|WORKSPACE|.bzl$"` # set -x # buildifier -d ${bazel_files} >"${buildifier_patch}"|| true # { set +x; } 2>/dev/null @@ -1226,8 +1227,8 @@ cmd_lint() { # It is ok, if spell-checker is not installed. if which typos >/dev/null; then local src_ext="bazel|bzl|c|cc|cmake|gni|h|html|in|java|js|m|md|nix|py|rst|sh|ts|txt|yaml|yml" - local sources=`git -C ${MYDIR} ls-files | grep -E "\.(${src_ext})$"` - typos -c ${MYDIR}/tools/scripts/typos.toml ${sources} + local sources=`git -C "${MYDIR}" ls-files | grep -E "\.(${src_ext})$"` + typos -c "${MYDIR}/tools/scripts/typos.toml" ${sources} else echo "Consider installing https://github.com/crate-ci/typos for spell-checking" fi diff --git a/deps.sh b/deps.sh index 9bddd7d1..bd5fb0d9 100755 --- a/deps.sh +++ b/deps.sh @@ -10,7 +10,8 @@ set -eu -MYDIR=$(dirname $(realpath "$0")) +SELF=$(realpath "$0") +MYDIR=$(dirname "${SELF}") # Git revisions we use for the given submodules. Update these whenever you # update a git submodule. diff --git a/doc/fuzzing.md b/doc/fuzzing.md index b673957c..2bd84030 100644 --- a/doc/fuzzing.md +++ b/doc/fuzzing.md @@ -103,7 +103,7 @@ clang package for that version outside the container and using `clang-NN` (for example `clang-11`) instead of `clang` in the following commands: ```bash -symbolizer=$($(realpath $(which clang)) -print-prog-name=llvm-symbolizer) +symbolizer=$($(realpath "$(which clang)") -print-prog-name=llvm-symbolizer) export MSAN_SYMBOLIZER_PATH="${symbolizer}" export UBSAN_SYMBOLIZER_PATH="${symbolizer}" export ASAN_SYMBOLIZER_PATH="${symbolizer}" diff --git a/tools/scripts/jpegli_tools_test.sh b/tools/scripts/jpegli_tools_test.sh index d5b418aa..19362bee 100644 --- a/tools/scripts/jpegli_tools_test.sh +++ b/tools/scripts/jpegli_tools_test.sh @@ -10,7 +10,8 @@ set -eux -MYDIR=$(dirname $(realpath "$0")) +SELF=$(realpath "$0") +MYDIR=$(dirname "${SELF}") JPEGXL_TEST_DATA_PATH="${MYDIR}/../../testdata" # Temporary files cleanup hooks. diff --git a/tools/scripts/ossfuzz-build.sh b/tools/scripts/ossfuzz-build.sh index e35d5357..0c31a9a4 100755 --- a/tools/scripts/ossfuzz-build.sh +++ b/tools/scripts/ossfuzz-build.sh @@ -15,6 +15,9 @@ fi set -eux +self=$(realpath "$0") +mydir=$(dirname "${self}") + main() { # Build the fuzzers in release mode but force the inclusion of JXL_DASSERT # checks. @@ -65,8 +68,7 @@ if [[ -n "${JPEGXL_UID:-}" && "${JPEGXL_UID}" != $(id -u) ]]; then userspec="${JPEGXL_UID}:${JPEGXL_GID}" unset JPEGXL_UID unset JPEGXL_GID - chroot --skip-chdir --userspec="${userspec}" \ - / $(realpath "$0") "$@" + chroot --skip-chdir --userspec="${userspec}" / "${mydir}" "$@" exit $? fi diff --git a/tools/scripts/reference_zip.sh b/tools/scripts/reference_zip.sh index 69a34d39..4e8da192 100755 --- a/tools/scripts/reference_zip.sh +++ b/tools/scripts/reference_zip.sh @@ -10,7 +10,8 @@ set -eu -MYDIR=$(dirname $(realpath "$0")) +SELF=$(realpath "$0") +MYDIR=$(dirname "${SELF}") # Temporary files cleanup hooks. CLEANUP_FILES=() @@ -24,7 +25,7 @@ trap 'retcode=$?; { set +x; } 2>/dev/null; cleanup' INT TERM EXIT main() { # Run from the repo's top level directory. - cd "${MYDIR[@]}/.." + cd "${MYDIR}/.." local deps=( third_party/brotli