Skip to content

Commit 521f1e0

Browse files
committed
sh: add missing quote, drop no longer used var, fixup printf mask, shellcheck warnings (./scripts/)
1 parent 373233d commit 521f1e0

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

scripts/check_data.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ then
1111
fi
1212

1313
# Exit if the build root has not been defined.
14-
. ${SCRIPTDIR}/fuzz_targets
14+
. "${SCRIPTDIR}"/fuzz_targets
1515

1616
if [[ ${DEBUG} == 1 ]]
1717
then
@@ -44,6 +44,7 @@ do
4444
PERCALL=100
4545
fi
4646

47-
find ${BUILD_ROOT}/corpora/${TARGET}/ ${EXTRA_CORPUS} -type f -print0 | xargs -0 -L${PERCALL} ${BUILD_ROOT}/build/${TARGET}
47+
# shellcheck disable=SC2248
48+
find "${BUILD_ROOT}/corpora/${TARGET}/" ${EXTRA_CORPUS} -type f -print0 | xargs -0 -L${PERCALL} "${BUILD_ROOT}/build/${TARGET}"
4849
fi
4950
done

scripts/compile_target.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
TARGET=${1:-fuzz}
2525

2626
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
27-
export BUILD_ROOT=$(readlink -f "${SCRIPTDIR}/..")
27+
export BUILD_ROOT; BUILD_ROOT=$(readlink -f "${SCRIPTDIR}/..")
2828

2929
# Check for GDB-specific behaviour by checking for the GDBMODE flag.
3030
# - Compile with -O0 so that DEBUGASSERTs can be debugged in gdb.
3131
if [[ -n ${GDBMODE:-} ]]
3232
then
33-
[[ -n ${CFLAGS:-} ]] && export CFLAGS="${CFLAGS} -O0" || export CFLAGS="-O0"
34-
[[ -n ${CXXFLAGS:-} ]] && export CXXFLAGS="${CXXFLAGS} -O0" || export CXXFLAGS="-O0"
33+
export CFLAGS="${CFLAGS:-} -O0"
34+
export CXXFLAGS="${CXXFLAGS:-} -O0"
3535
CMAKE_GDB_FLAG="-DBUILD_GDB=ON"
3636
else
3737
CMAKE_GDB_FLAG="-DBUILD_GDB=OFF"
@@ -58,13 +58,14 @@ echo "MAKEFLAGS: ${MAKEFLAGS}"
5858

5959
# Create a build directory for the dependencies.
6060
BUILD_DIR=${BUILD_ROOT}/build
61-
mkdir -p ${BUILD_DIR}
61+
mkdir -p "${BUILD_DIR}"
6262

6363
options=''
6464
command -v ninja >/dev/null 2>&1 && options+=' -G Ninja'
6565

6666
# Compile the dependencies.
67-
pushd ${BUILD_DIR}
68-
cmake ${CMAKE_GDB_FLAG} .. ${options}
69-
cmake --build . --target ${TARGET} ${CMAKE_VERBOSE_FLAG}
67+
pushd "${BUILD_DIR}"
68+
# shellcheck disable=SC2086
69+
cmake "${CMAKE_GDB_FLAG}" .. ${options}
70+
cmake --build . --target "${TARGET}" ${CMAKE_VERBOSE_FLAG}
7071
popd

scripts/create_zip.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ set -ex
55
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
66
BUILD_ROOT=$(readlink -f "${SCRIPTDIR}/..")
77

8-
. ${SCRIPTDIR}/fuzz_targets
8+
. "${SCRIPTDIR}"/fuzz_targets
99

1010
for TARGET in ${FUZZ_TARGETS}
1111
do
12-
pushd ${BUILD_ROOT}/corpora/${TARGET}
13-
zip ../../${TARGET}_seed_corpus.zip *
14-
popd
12+
pushd "${BUILD_ROOT}/corpora/${TARGET}"
13+
zip ../../"${TARGET}_seed_corpus.zip" *
14+
popd
1515
done

scripts/ossfuzzdeps.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# Use it to compile and install all the dependencies
77

88
set -ex
9-
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
109

1110
# Work out if we need to install with sudo or not.
1211
if [[ $(id -u) -eq 0 ]]

0 commit comments

Comments
 (0)