Skip to content

Commit

Permalink
Fix "space in script path" problem in all scripts. (#3698)
Browse files Browse the repository at this point in the history
Scripts that were not prone to this problem were updated also, to make it more homogeneous.

(cherry picked from commit 40471a5cab87beb7d3665e137dc6a784575e7858)
  • Loading branch information
eustas committed Dec 5, 2024
1 parent 0e1976e commit efd1219
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion bash_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 5 additions & 4 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion doc/fuzzing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
3 changes: 2 additions & 1 deletion tools/scripts/jpegli_tools_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions tools/scripts/ossfuzz-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions tools/scripts/reference_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

set -eu

MYDIR=$(dirname $(realpath "$0"))
SELF=$(realpath "$0")
MYDIR=$(dirname "${SELF}")

# Temporary files cleanup hooks.
CLEANUP_FILES=()
Expand All @@ -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
Expand Down

0 comments on commit efd1219

Please sign in to comment.