Files
patches/nodejs/node-v25.8.1-posixify.patch
T
2026-05-26 02:08:47 -05:00

1631 lines
53 KiB
Diff

diff --git a/deps/crates/vendor/autocfg/tests/wrap_ignored b/deps/crates/vendor/autocfg/tests/wrap_ignored
index 5e577d0..b3b464c 100755
--- a/deps/crates/vendor/autocfg/tests/wrap_ignored
+++ b/deps/crates/vendor/autocfg/tests/wrap_ignored
@@ -1,11 +1,11 @@
-#!/bin/bash
+#!/bin/sh
for arg in "$@"; do
case "$arg" in
# Add our own version so we can check that the wrapper is used for that.
"--version") echo "release: 12345.6789.0" ;;
# Read all input so the writer doesn't get EPIPE when we exit.
- "-") read -d "" PROBE ;;
+ "-") cat >/dev/null ;;
esac
done
diff --git a/deps/crates/vendor/displaydoc/update-readme.sh b/deps/crates/vendor/displaydoc/update-readme.sh
index f67bfd5..4976870 100755
--- a/deps/crates/vendor/displaydoc/update-readme.sh
+++ b/deps/crates/vendor/displaydoc/update-readme.sh
@@ -1,4 +1,4 @@
-#! /usr/bin/env bash
+#!/bin/sh
cargo readme > ./README.md
git add ./README.md
diff --git a/deps/crates/vendor/smallvec/scripts/run_miri.sh b/deps/crates/vendor/smallvec/scripts/run_miri.sh
index 010ceb0..ecb410d 100644
--- a/deps/crates/vendor/smallvec/scripts/run_miri.sh
+++ b/deps/crates/vendor/smallvec/scripts/run_miri.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/sh
set -ex
diff --git a/deps/nbytes/tools/run-clang-format.sh b/deps/nbytes/tools/run-clang-format.sh
index ce1a664..d6febe9 100755
--- a/deps/nbytes/tools/run-clang-format.sh
+++ b/deps/nbytes/tools/run-clang-format.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# Copyright 2023 Yagiz Nizipli and Daniel Lemire
@@ -20,23 +20,23 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
set -e
-COMMAND=$*
-SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
-MAINSOURCE=$SCRIPTPATH/..
-ALL_FILES=$(cd $MAINSOURCE && git ls-tree --full-tree --name-only -r HEAD | grep -e ".*\.\(c\|h\|cc\|cpp\|hh\)\$")
+SCRIPTPATH="$(cd "$(dirname "$0")" && pwd -P)"
+MAINSOURCE="$SCRIPTPATH/.."
+ALL_FILES=$(cd "$MAINSOURCE" && git ls-tree --full-tree --name-only -r HEAD | grep -e '.*\.\(c\|h\|cc\|cpp\|hh\)$')
-if clang-format-17 --version 2>/dev/null | grep -qF 'version 17.'; then
- cd $MAINSOURCE; clang-format-17 --style=file --verbose -i "$@" $ALL_FILES
+if clang-format-17 --version 2>/dev/null | grep -qF 'version 17.'; then
+ cd "$MAINSOURCE" && clang-format-17 --style=file --verbose -i "$@" $ALL_FILES
exit 0
-elif clang-format --version 2>/dev/null | grep -qF 'version 17.'; then
- cd $MAINSOURCE; clang-format --style=file --verbose -i "$@" $ALL_FILES
+elif clang-format --version 2>/dev/null | grep -qF 'version 17.'; then
+ cd "$MAINSOURCE" && clang-format --style=file --verbose -i "$@" $ALL_FILES
exit 0
fi
echo "Trying to use docker"
command -v docker >/dev/null 2>&1 || { echo >&2 "Please install docker. E.g., go to https://www.docker.com/products/docker-desktop Type 'docker' to diagnose the problem."; exit 1; }
docker info >/dev/null 2>&1 || { echo >&2 "Docker server is not running? type 'docker info'."; exit 1; }
-if [ -t 0 ]; then DOCKER_ARGS=-it; fi
+DOCKER_ARGS=
+if [ -t 0 ]; then DOCKER_ARGS='-it'; fi
docker pull kszonek/clang-format-17
-docker run --rm $DOCKER_ARGS -v "$MAINSOURCE":"$MAINSOURCE":Z -w "$MAINSOURCE" -u "$(id -u $USER):$(id -g $USER)" kszonek/clang-format-17 --style=file --verbose -i "$@" $ALL_FILES
+docker run --rm $DOCKER_ARGS -v "$MAINSOURCE":"$MAINSOURCE":Z -w "$MAINSOURCE" -u "$(id -u):$(id -g)" kszonek/clang-format-17 --style=file --verbose -i "$@" $ALL_FILES
diff --git a/deps/ngtcp2/ngtcp2/third-party/urlparse/.clusterfuzzlite/build.sh b/deps/ngtcp2/ngtcp2/third-party/urlparse/.clusterfuzzlite/build.sh
index 6f33867..45bd322 100755
--- a/deps/ngtcp2/ngtcp2/third-party/urlparse/.clusterfuzzlite/build.sh
+++ b/deps/ngtcp2/ngtcp2/third-party/urlparse/.clusterfuzzlite/build.sh
@@ -1,4 +1,6 @@
-#!/bin/bash -eu
+#!/bin/sh
+
+set -eu
autoreconf -i
./configure --disable-dependency-tracking
diff --git a/deps/npm/bin/npm b/deps/npm/bin/npm
index 027dc9d..faf28ff 100755
--- a/deps/npm/bin/npm
+++ b/deps/npm/bin/npm
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# This is used by the Node.js installer, which expects the cygwin/mingw
# shell script to already be present in the npm dependency folder.
@@ -11,11 +11,11 @@ case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
-if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then
+if [ "$(uname)" = 'Linux' ] && command -v wslpath >/dev/null 2>&1 ; then
IS_WSL="true"
fi
-function no_node_dir {
+no_node_dir() {
# if this didn't work, then everything else below will fail
echo "Could not determine Node.js install directory" >&2
exit 1
@@ -36,14 +36,14 @@ if [ $? -ne 0 ]; then
# this fails under WSL 1 so add an additional message. we also suppress stderr above
# because the actual error raised is not helpful. in WSL 1 node.exe cannot handle
# output redirection properly. See https://github.com/microsoft/WSL/issues/2370
- if [ "$IS_WSL" == "true" ]; then
+ if [ "$IS_WSL" = "true" ]; then
echo "WSL 1 is not supported. Please upgrade to WSL 2 or above." >&2
fi
no_node_dir
fi
NPM_PREFIX_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-prefix.js"
NPM_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-cli.js"
-NPM_PREFIX=`"$NODE_EXE" "$NPM_PREFIX_JS"`
+NPM_PREFIX=$("$NODE_EXE" "$NPM_PREFIX_JS")
if [ $? -ne 0 ]; then
no_node_dir
fi
@@ -55,8 +55,8 @@ NPM_WSL_PATH="/.."
# WSL can run Windows binaries, so we have to give it the win32 path
# however, WSL bash tests against posix paths, so we need to construct that
# to know if npm is installed globally.
-if [ "$IS_WSL" == "true" ]; then
- NPM_WSL_PATH=`wslpath "$NPM_PREFIX_NPM_CLI_JS"`
+if [ "$IS_WSL" = "true" ]; then
+ NPM_WSL_PATH=$(wslpath "$NPM_PREFIX_NPM_CLI_JS")
fi
if [ -f "$NPM_PREFIX_NPM_CLI_JS" ] || [ -f "$NPM_WSL_PATH" ]; then
NPM_CLI_JS="$NPM_PREFIX_NPM_CLI_JS"
diff --git a/deps/npm/bin/npx b/deps/npm/bin/npx
index b8619ee..4d00bda 100755
--- a/deps/npm/bin/npx
+++ b/deps/npm/bin/npx
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# This is used by the Node.js installer, which expects the cygwin/mingw
# shell script to already be present in the npm dependency folder.
@@ -11,11 +11,11 @@ case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
-if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then
+if [ "$(uname)" = 'Linux' ] && command -v wslpath >/dev/null 2>&1 ; then
IS_WSL="true"
fi
-function no_node_dir {
+no_node_dir() {
# if this didn't work, then everything else below will fail
echo "Could not determine Node.js install directory" >&2
exit 1
@@ -36,14 +36,14 @@ if [ $? -ne 0 ]; then
# this fails under WSL 1 so add an additional message. we also suppress stderr above
# because the actual error raised is not helpful. in WSL 1 node.exe cannot handle
# output redirection properly. See https://github.com/microsoft/WSL/issues/2370
- if [ "$IS_WSL" == "true" ]; then
+ if [ "$IS_WSL" = "true" ]; then
echo "WSL 1 is not supported. Please upgrade to WSL 2 or above." >&2
fi
no_node_dir
fi
NPM_PREFIX_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-prefix.js"
NPX_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npx-cli.js"
-NPM_PREFIX=`"$NODE_EXE" "$NPM_PREFIX_JS"`
+NPM_PREFIX=$("$NODE_EXE" "$NPM_PREFIX_JS")
if [ $? -ne 0 ]; then
no_node_dir
fi
@@ -55,8 +55,8 @@ NPX_WSL_PATH="/.."
# WSL can run Windows binaries, so we have to give it the win32 path
# however, WSL bash tests against posix paths, so we need to construct that
# to know if npm is installed globally.
-if [ "$IS_WSL" == "true" ]; then
- NPX_WSL_PATH=`wslpath "$NPM_PREFIX_NPX_CLI_JS"`
+if [ "$IS_WSL" = "true" ]; then
+ NPX_WSL_PATH=$(wslpath "$NPM_PREFIX_NPX_CLI_JS")
fi
if [ -f "$NPM_PREFIX_NPX_CLI_JS" ] || [ -f "$NPX_WSL_PATH" ]; then
NPX_CLI_JS="$NPM_PREFIX_NPX_CLI_JS"
diff --git a/deps/npm/docs/content/commands/npm-root.md b/deps/npm/docs/content/commands/npm-root.md
index 8f4825b..97abfb3 100644
--- a/deps/npm/docs/content/commands/npm-root.md
+++ b/deps/npm/docs/content/commands/npm-root.md
@@ -20,7 +20,7 @@ Useful for using npm in shell scripts that do things with the `node_modules` fol
For example:
```bash
-#!/bin/bash
+#!/bin/sh
global_node_modules="$(npm root --global)"
echo "Global packages installed in: ${global_node_modules}"
```
diff --git a/deps/npm/lib/utils/completion.sh b/deps/npm/lib/utils/completion.sh
index a3e5143..99c79ee 100755
--- a/deps/npm/lib/utils/completion.sh
+++ b/deps/npm/lib/utils/completion.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
###-begin-npm-completion-###
#
# npm command completion script
diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1
index 537d4c3..781bed9 100644
--- a/deps/npm/man/man1/npm-root.1
+++ b/deps/npm/man/man1/npm-root.1
@@ -18,7 +18,7 @@ Useful for using npm in shell scripts that do things with the \fBnode_modules\fR
.P
.RS 2
.nf
-#!/bin/bash
+#!/bin/sh
global_node_modules="$(npm root --global)"
echo "Global packages installed in: ${global_node_modules}"
.fi
diff --git a/deps/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh b/deps/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh
index e1e9894..fffd88a 100644
--- a/deps/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh
+++ b/deps/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh
@@ -1,12 +1,10 @@
-#!/bin/bash
+#!/bin/sh
-pkgs=(
- "com.apple.pkg.DeveloperToolsCLILeo" # standalone
- "com.apple.pkg.DeveloperToolsCLI" # from XCode
- "com.apple.pkg.CLTools_Executables" # Mavericks
-)
-
-for pkg in "${pkgs[@]}"; do
+for pkg in \
+ "com.apple.pkg.DeveloperToolsCLILeo" \
+ "com.apple.pkg.DeveloperToolsCLI" \
+ "com.apple.pkg.CLTools_Executables"
+do
output=$(/usr/sbin/pkgutil --pkg-info "$pkg" 2>/dev/null)
if [ "$output" ]; then
version=$(echo "$output" | grep 'version' | cut -d' ' -f2)
diff --git a/deps/openssl/openssl/crypto/chacha/asm/chacha-armv8-sve.pl b/deps/openssl/openssl/crypto/chacha/asm/chacha-armv8-sve.pl
index 62a8be6..bcef08b 100755
--- a/deps/openssl/openssl/crypto/chacha/asm/chacha-armv8-sve.pl
+++ b/deps/openssl/openssl/crypto/chacha/asm/chacha-armv8-sve.pl
@@ -921,7 +921,7 @@ sub create_verifier {
my $filename="./compile_sve.sh";
$scripts = <<___;
-#! /bin/bash
+#! /bin/sh
set -e
CROSS_COMPILE=\${CROSS_COMPILE:-'aarch64-none-linux-gnu-'}
diff --git a/deps/openssl/openssl/util/find-unused-errs b/deps/openssl/openssl/util/find-unused-errs
index 467ef25..691b9c0 100755
--- a/deps/openssl/openssl/util/find-unused-errs
+++ b/deps/openssl/openssl/util/find-unused-errs
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/sh
# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
@@ -33,22 +33,22 @@ case "$1" in
esac
cd include/openssl || exit 1
-grep "$PAT" * | grep -v ERR_FATAL_ERROR | awk '{print $3;}' | sort -u >$X1
+grep "$PAT" * | grep -v ERR_FATAL_ERROR | awk '{print $3;}' | sort -u >"$X1"
cd ../..
-for F in `cat $X1` ; do
- git grep -l --full-name -F $F >$X2
- NUM=`wc -l <$X2`
- test $NUM -gt 2 && continue
- if grep -q $F crypto/err/openssl.ec ; then
+while IFS= read -r F; do
+ git grep -l --full-name -F "$F" >"$X2"
+ NUM=$(wc -l <"$X2")
+ test "$NUM" -gt 2 && continue
+ if grep -q "$F" crypto/err/openssl.ec; then
echo Possibly unused $F found in openssl.ec
continue
fi
- echo $F
- for FILE in `cat $X2` ; do
- grep -v -w $F <$FILE >$FILE.new
- mv $FILE.new $FILE
- done
-done
+ echo "$F"
+ while IFS= read -r FILE; do
+ grep -v -w "$F" <"$FILE" >"$FILE.new"
+ mv "$FILE.new" "$FILE"
+ done <"$X2"
+done <"$X1"
-rm $X1 $X2
+rm "$X1" "$X2"
diff --git a/deps/v8/third_party/abseil-cpp/CMake/install_test_project/test.sh b/deps/v8/third_party/abseil-cpp/CMake/install_test_project/test.sh
index 962bc8d..1a70722 100755
--- a/deps/v8/third_party/abseil-cpp/CMake/install_test_project/test.sh
+++ b/deps/v8/third_party/abseil-cpp/CMake/install_test_project/test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright 2019 The Abseil Authors.
#
@@ -16,8 +16,8 @@
#
# Unit and integration tests for Abseil LTS CMake installation
-# Fail on any error. Treat unset variables an error. Print commands as executed.
-set -euox pipefail
+# Fail on any error. Treat unset variables as an error. Print commands as executed.
+set -eux
absl_dir=/abseil-cpp
absl_build_dir=/buildfs
@@ -33,51 +33,54 @@ fi
# Build and install GoogleTest
mkdir "${googletest_builddir}"
-pushd "${googletest_builddir}"
-curl -L "${ABSL_GOOGLETEST_DOWNLOAD_URL}" --output "${googletest_archive}"
-tar -xz -f "${googletest_archive}"
-pushd "googletest-${ABSL_GOOGLETEST_VERSION}"
-mkdir build
-pushd build
-cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS="${build_shared_libs}" ..
-make -j $(nproc)
-make install
-ldconfig
-popd
-popd
-popd
+(
+ cd "${googletest_builddir}"
+ curl -L "${ABSL_GOOGLETEST_DOWNLOAD_URL}" --output "${googletest_archive}"
+ tar -xz -f "${googletest_archive}"
+ cd "googletest-${ABSL_GOOGLETEST_VERSION}"
+ mkdir build
+ cd build
+ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS="${build_shared_libs}" ..
+ make -j "$(nproc)"
+ make install
+ ldconfig
+)
# Run the LTS transformations
./create_lts.py 99998877
# Build and install Abseil
-pushd "${absl_build_dir}"
-cmake "${absl_dir}" \
- -DABSL_USE_EXTERNAL_GOOGLETEST=ON \
- -DABSL_FIND_GOOGLETEST=ON \
- -DCMAKE_BUILD_TYPE=Release \
- -DABSL_BUILD_TESTING=ON \
- -DBUILD_SHARED_LIBS="${build_shared_libs}"
-make -j $(nproc)
-ctest -j $(nproc) --output-on-failure
-make install
-ldconfig
-popd
+(
+ cd "${absl_build_dir}"
+ cmake "${absl_dir}" \
+ -DABSL_USE_EXTERNAL_GOOGLETEST=ON \
+ -DABSL_FIND_GOOGLETEST=ON \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DABSL_BUILD_TESTING=ON \
+ -DBUILD_SHARED_LIBS="${build_shared_libs}"
+ make -j "$(nproc)"
+ ctest -j "$(nproc)" --output-on-failure
+ make install
+ ldconfig
+)
# Test the project against the installed Abseil
mkdir -p "${project_build_dir}"
-pushd "${project_build_dir}"
-cmake "${project_dir}"
-cmake --build . --target simple
-
-output="$(${project_build_dir}/simple "printme" 2>&1)"
-if [[ "${output}" != *"Arg 1: printme"* ]]; then
- echo "Faulty output on simple project:"
- echo "${output}"
- exit 1
-fi
-
-popd
+(
+ cd "${project_build_dir}"
+ cmake "${project_dir}"
+ cmake --build . --target simple
+
+ output="$(${project_build_dir}/simple "printme" 2>&1)"
+ case "${output}" in
+ *"Arg 1: printme"*) ;;
+ *)
+ echo "Faulty output on simple project:"
+ echo "${output}"
+ exit 1
+ ;;
+ esac
+)
if ! grep absl::strings "/usr/local/lib/cmake/absl/abslTargets.cmake"; then
cat "/usr/local/lib/cmake/absl/abslTargets.cmake"
@@ -85,8 +88,9 @@ if ! grep absl::strings "/usr/local/lib/cmake/absl/abslTargets.cmake"; then
exit 1
fi
-pushd "${HOME}"
-cat > hello-abseil.cc << EOF
+(
+cd "${HOME}"
+cat > hello-abseil.cc <<'EOF'
#include <cstdlib>
#include "absl/strings/str_format.h"
@@ -98,16 +102,13 @@ int main(int argc, char **argv) {
EOF
if [ "${LINK_TYPE:-}" != "DYNAMIC" ]; then
- pc_args=($(pkg-config --cflags --libs --static absl_str_format))
- g++ -static -o hello-abseil hello-abseil.cc "${pc_args[@]}"
+ g++ -static -o hello-abseil hello-abseil.cc $(pkg-config --cflags --libs --static absl_str_format)
else
- pc_args=($(pkg-config --cflags --libs absl_str_format))
- g++ -o hello-abseil hello-abseil.cc "${pc_args[@]}"
+ g++ -o hello-abseil hello-abseil.cc $(pkg-config --cflags --libs absl_str_format)
fi
hello="$(./hello-abseil)"
-[[ "${hello}" == "Hello Abseil!" ]]
-
-popd
+[ "${hello}" = "Hello Abseil!" ]
+)
echo "Install test complete!"
exit 0
diff --git a/deps/v8/third_party/markupsafe/get_markupsafe.sh b/deps/v8/third_party/markupsafe/get_markupsafe.sh
index d268832..5acd3d5 100755
--- a/deps/v8/third_party/markupsafe/get_markupsafe.sh
+++ b/deps/v8/third_party/markupsafe/get_markupsafe.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Download and extract MarkupSafe
# Homepage:
# https://github.com/mitsuhiko/markupsafe
@@ -12,20 +12,19 @@ CHROMIUM_FILES="README.chromium OWNERS get_markupsafe.sh"
EXTRA_FILES='LICENSE AUTHORS'
REMOVE_FILES='tests.py'
-SRC_URL='https://pypi.python.org/packages/source/'
-SRC_URL+="${PACKAGE:0:1}/$PACKAGE/$PACKAGE-$VERSION.tar.gz"
+SRC_URL="https://pypi.python.org/packages/source/${PACKAGE%${PACKAGE#?}}/$PACKAGE/$PACKAGE-$VERSION.tar.gz"
FILENAME="$(basename $SRC_URL)"
MD5_FILENAME="$FILENAME.md5"
SHA512_FILENAME="$FILENAME.sha512"
-CHROMIUM_FILES+=" $MD5_FILENAME $SHA512_FILENAME"
+CHROMIUM_FILES="$CHROMIUM_FILES $MD5_FILENAME $SHA512_FILENAME"
BUILD_DIR="$PACKAGE-$VERSION"
-THIRD_PARTY="$(dirname $(realpath $(dirname "${BASH_SOURCE[0]}")))"
+THIRD_PARTY="$(dirname "$(realpath "$(dirname "$0")")")"
INSTALL_DIR="$THIRD_PARTY/$PACKAGE_DIR"
OUT_DIR="$INSTALL_DIR/$BUILD_DIR/$PACKAGE_DIR"
OLD_DIR="$THIRD_PARTY/$PACKAGE_DIR.old"
-function check_hashes {
+check_hashes() {
# Hashes generated via:
# FILENAME=MarkupSafe-0.18.tar.gz
# md5sum "$FILENAME" > "$FILENAME.md5"
diff --git a/deps/v8/tools/android-sync.sh b/deps/v8/tools/android-sync.sh
index cbe68f2..25320f7 100755
--- a/deps/v8/tools/android-sync.sh
+++ b/deps/v8/tools/android-sync.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -42,14 +42,14 @@ OUTDIR=$2
HOST_V8=$3
ANDROID_V8=$4
-function LINUX_MD5 {
- local HASH=$(md5sum $1)
- echo ${HASH%% *}
+LINUX_MD5() {
+ HASH=$(md5sum "$1")
+ echo "${HASH%% *}"
}
-function DARWIN_MD5 {
- local HASH=$(md5 $1)
- echo ${HASH} | cut -f2 -d "=" | cut -f2 -d " "
+DARWIN_MD5() {
+ HASH=$(md5 "$1")
+ echo "$HASH" | cut -f2 -d "=" | cut -f2 -d " "
}
host_os=$(uname -s)
@@ -61,37 +61,37 @@ case "${host_os}" in
MD5=DARWIN_MD5
;;
*)
- echo "$0: Host platform ${host_os} is not supported" >& 2
+ echo "$0: Host platform ${host_os} is not supported" >&2
exit 1
esac
-function sync_file {
- local FILE=$1
- local ANDROID_HASH=$(adb shell "md5 \"$ANDROID_V8/$FILE\"")
- local HOST_HASH=$($MD5 "$HOST_V8/$FILE")
+sync_file() {
+ FILE=$1
+ ANDROID_HASH=$(adb shell "md5 \"$ANDROID_V8/$FILE\"")
+ HOST_HASH=$($MD5 "$HOST_V8/$FILE")
if [ "${ANDROID_HASH%% *}" != "${HOST_HASH}" ]; then
- adb push "$HOST_V8/$FILE" "$ANDROID_V8/$FILE" &> /dev/null
+ adb push "$HOST_V8/$FILE" "$ANDROID_V8/$FILE" >/dev/null 2>&1
fi
- echo -n "."
+ printf '.'
}
-function sync_dir {
- local DIR=$1
- echo -n "sync to $ANDROID_V8/$DIR"
+sync_dir() {
+ DIR=$1
+ printf 'sync to %s' "$ANDROID_V8/$DIR"
for FILE in $(find "$HOST_V8/$DIR" -not -path "*.svn*" -type f); do
- local RELATIVE_FILE=${FILE:${#HOST_V8}}
+ RELATIVE_FILE=${FILE#"$HOST_V8"}
sync_file "$RELATIVE_FILE"
done
echo ""
}
-echo -n "sync to $ANDROID_V8/$OUTDIR/$ARCH_MODE"
+printf 'sync to %s' "$ANDROID_V8/$OUTDIR/$ARCH_MODE"
sync_file "$OUTDIR/$ARCH_MODE/cctest"
sync_file "$OUTDIR/$ARCH_MODE/d8"
sync_file "$OUTDIR/$ARCH_MODE/snapshot_blob.bin"
sync_file "$OUTDIR/$ARCH_MODE/v8_unittests"
echo ""
-echo -n "sync to $ANDROID_V8/tools"
+printf 'sync to %s' "$ANDROID_V8/tools"
sync_file tools/arguments.mjs
sync_file tools/codemap.mjs
sync_file tools/consarray.mjs
diff --git a/deps/v8/tools/bash-completion.sh b/deps/v8/tools/bash-completion.sh
index ab6ea9b..521140f 100755
--- a/deps/v8/tools/bash-completion.sh
+++ b/deps/v8/tools/bash-completion.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
diff --git a/deps/v8/tools/check-inline-includes.sh b/deps/v8/tools/check-inline-includes.sh
index 6def974..9604989 100755
--- a/deps/v8/tools/check-inline-includes.sh
+++ b/deps/v8/tools/check-inline-includes.sh
@@ -1,9 +1,9 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2015 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
+v8_root=$(readlink -f "$(dirname "$0")/../")
directories="src test/cctest test/unittests"
for directory in $directories; do
diff --git a/deps/v8/tools/check-static-initializers.sh b/deps/v8/tools/check-static-initializers.sh
index e59b5c8..2bebb2f 100755
--- a/deps/v8/tools/check-static-initializers.sh
+++ b/deps/v8/tools/check-static-initializers.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -37,9 +37,9 @@
# See https://crbug.com/1177324 for more.
expected_static_init_count=3
-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
+v8_root=$(readlink -f "$(dirname "$0")/../")
-if [ -n "$1" ] ; then
+if [ -n "${1:-}" ] ; then
d8="${v8_root}/$1"
else
d8="${v8_root}/d8"
diff --git a/deps/v8/tools/check-unused-bailouts.sh b/deps/v8/tools/check-unused-bailouts.sh
index 68c2c91..04ea32d 100755
--- a/deps/v8/tools/check-unused-bailouts.sh
+++ b/deps/v8/tools/check-unused-bailouts.sh
@@ -1,9 +1,9 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2015 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
+v8_root=$(readlink -f "$(dirname "$0")/../")
bailouts=$(
grep \
--only-matching \
diff --git a/deps/v8/tools/check-unused-symbols.sh b/deps/v8/tools/check-unused-symbols.sh
index 0348938..cbb023c 100755
--- a/deps/v8/tools/check-unused-symbols.sh
+++ b/deps/v8/tools/check-unused-symbols.sh
@@ -1,9 +1,9 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
+v8_root=$(readlink -f "$(dirname "$0")/../")
symbols=$(
grep \
--only-matching \
diff --git a/deps/v8/tools/clusterfuzz/js_fuzzer/gen_exceptions.sh b/deps/v8/tools/clusterfuzz/js_fuzzer/gen_exceptions.sh
index b2a90b8..32025d0 100755
--- a/deps/v8/tools/clusterfuzz/js_fuzzer/gen_exceptions.sh
+++ b/deps/v8/tools/clusterfuzz/js_fuzzer/gen_exceptions.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2020 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/deps/v8/tools/clusterfuzz/js_fuzzer/package.sh b/deps/v8/tools/clusterfuzz/js_fuzzer/package.sh
index 6a40391..878cdd8 100755
--- a/deps/v8/tools/clusterfuzz/js_fuzzer/package.sh
+++ b/deps/v8/tools/clusterfuzz/js_fuzzer/package.sh
@@ -1,32 +1,32 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2020 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+DIR="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
OS="linux"
OS_LABEL="Linux"
SUFFIX=""
-if [[ -n "$1" && $1 == "win" ]]; then
+if [ -n "${1:-}" ] && [ "$1" = "win" ]; then
OS="win"
OS_LABEL="Windows"
SUFFIX=".exe"
-elif [[ -n "$1" && $1 == "macos" ]]; then
+elif [ -n "${1:-}" ] && [ "$1" = "macos" ]; then
OS="macos"
OS_LABEL="MacOS"
fi
echo "Building and packaging for $OS_LABEL..."
-(set -x; $DIR/node_modules/.bin/pkg -t node18-$OS-x64 $DIR)
+(set -x; "$DIR/node_modules/.bin/pkg" -t "node18-$OS-x64" "$DIR")
-rm -rf $DIR/output > /dev/null 2>&1 || true
-rm $DIR/output.zip > /dev/null 2>&1 || true
+rm -rf "$DIR/output" >/dev/null 2>&1 || true
+rm -f "$DIR/output.zip" >/dev/null 2>&1 || true
-mkdir $DIR/output
-cd $DIR/output
+mkdir "$DIR/output"
+cd "$DIR/output"
ln -s ../db db
-ln -s ../ochang_js_fuzzer$SUFFIX run$SUFFIX
+ln -s "../ochang_js_fuzzer$SUFFIX" "run$SUFFIX"
ln -s ../foozzie_launcher.py foozzie_launcher.py
echo "Creating $DIR/output.zip"
-(set -x; zip -r $DIR/output.zip * > /dev/null)
+(set -x; zip -r "$DIR/output.zip" * >/dev/null)
diff --git a/deps/v8/tools/collect_deprecation_stats.sh b/deps/v8/tools/collect_deprecation_stats.sh
index aa3f413..76d283b 100755
--- a/deps/v8/tools/collect_deprecation_stats.sh
+++ b/deps/v8/tools/collect_deprecation_stats.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Collect the number of [[deprecated]] calls detected when compiling V8.
# Requires "v8_deprecate_get_isolate = true" to be useful.
@@ -6,7 +6,7 @@
set -e
if [ -z "$1" ]; then
- (>&2 echo "Usage: collect_deprecation_stats.sh [<outdir>|<log>]")
+ echo "Usage: collect_deprecation_stats.sh [<outdir>|<log>]" >&2
exit 1
fi
@@ -22,14 +22,12 @@ fi
FILTERED_LOG=/tmp/filtered_isolate_deprecation.log
UNIQUE_WARNINGS_LOG=/tmp/unique_warnings.log
-grep "warning:" "$FULL_LOG" | sed $'
-s|^\.\./\.\./||;
-s/: warning: \'/: /;
+grep "warning:" "$FULL_LOG" | sed \
+ -e 's|^\.\./\.\./||' \
+ -e "s/: warning: '/: /" \
+ -e "s/\(<.*>\)\\?'.*//" > "$FILTERED_LOG"
-# strip everything after deprecated function name (including template param).
-s/\(<.*>\)\\?\'.*//' > $FILTERED_LOG
-
-sort -u $FILTERED_LOG > $UNIQUE_WARNINGS_LOG
+sort -u "$FILTERED_LOG" > "$UNIQUE_WARNINGS_LOG"
echo "Total deprecated calls: $(wc -l < $UNIQUE_WARNINGS_LOG)"
-cut -f2 -d' ' $UNIQUE_WARNINGS_LOG | sort | uniq -c
+cut -f2 -d' ' "$UNIQUE_WARNINGS_LOG" | sort | uniq -c
diff --git a/deps/v8/tools/cpu.sh b/deps/v8/tools/cpu.sh
index 5634cac..c48bb6b 100755
--- a/deps/v8/tools/cpu.sh
+++ b/deps/v8/tools/cpu.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -9,19 +9,23 @@ MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}')
set_governor() {
echo "Setting CPU frequency governor to \"$1\""
- for (( i=0; i<=$MAXID; i++ )); do
- echo "$1" > $CPUPATH/cpu$i/cpufreq/scaling_governor
+ i=0
+ while [ "$i" -le "$MAXID" ]; do
+ echo "$1" > "$CPUPATH/cpu$i/cpufreq/scaling_governor"
+ i=$((i + 1))
done
}
enable_cores() {
# $1: How many cores to enable.
- for (( i=1; i<=$MAXID; i++ )); do
+ i=1
+ while [ "$i" -le "$MAXID" ]; do
if [ "$i" -lt "$1" ]; then
- echo 1 > $CPUPATH/cpu$i/online
+ echo 1 > "$CPUPATH/cpu$i/online"
else
- echo 0 > $CPUPATH/cpu$i/online
+ echo 0 > "$CPUPATH/cpu$i/online"
fi
+ i=$((i + 1))
done
}
@@ -72,7 +76,7 @@ case "$1" in
echo "Usage $0 limit_cores <num>"
exit 1
fi
- limit_cores $2
+ limit_cores "$2"
;;
*)
echo "Usage: $0 fast|slow|default|singlecore|dualcore|all|limit_cores"
diff --git a/deps/v8/tools/dev/update-vscode.sh b/deps/v8/tools/dev/update-vscode.sh
index 64f5db0..e927f91 100755
--- a/deps/v8/tools/dev/update-vscode.sh
+++ b/deps/v8/tools/dev/update-vscode.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2020 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -11,21 +11,20 @@
# Basic checking of arguments: want at least one, and it's not --help.
VERSION="$1"
-[ -z "$VERSION" -o \
- "$VERSION" == "-h" -o \
- "$VERSION" == "--help" -o \
- "$VERSION" == "help" ] && {
+case "$VERSION" in
+ ''|-h|--help|help)
echo "Usage: $0 <version>"
echo "<version> may be --auto for auto-detecting the latest available."
exit 1
-}
+ ;;
+esac
die() {
echo "Error: $1"
exit 1
}
-if [ "$VERSION" == "--auto" -o "$VERSION" == "auto" ]; then
+if [ "$VERSION" = "--auto" ] || [ "$VERSION" = "auto" ]; then
echo "Searching online for latest available version..."
# Where to find the latest available version.
AVAILABLE_PACKAGES_URL="https://packages.microsoft.com/repos/vscode/dists/stable/main/binary-amd64/Packages.gz"
@@ -70,17 +69,19 @@ DOWNLOAD_URL="https://update.code.visualstudio.com/$VERSION/linux-x64/stable"
CODE_BIN="$VSCODE_DIR/bin/code"
# Check for "code" in $PATH; create a symlink if we can find a good place.
-SYMLINK=$(which code)
+SYMLINK=$(command -v code 2>/dev/null || true)
if [ -z "$SYMLINK" ]; then
- IFS=':' read -ra PATH_ARRAY <<< "$PATH"
- for P in "${PATH_ARRAY[@]}"; do
- if [ "$P" == "$HOME/bin" -o \
- "$P" == "$HOME/local/bin" -o \
- "$P" == "$HOME/.local/bin" ]; then
+ old_IFS=$IFS
+ IFS=':'
+ for P in $PATH; do
+ if [ "$P" = "$HOME/bin" ] || \
+ [ "$P" = "$HOME/local/bin" ] || \
+ [ "$P" = "$HOME/.local/bin" ]; then
LOCALBIN="$P"
break
fi
done
+ IFS=$old_IFS
if [ -n "$LOCALBIN" ]; then
echo "Adding symlink to $LOCALBIN..."
if [ ! -d "$LOCALBIN" ]; then
@@ -129,7 +130,7 @@ if [ -d "$VSCODE_DIR" ]; then
INSTALLED=$(grep '"version":' "$PACKAGE_JSON" \
| sed 's/[^0-9]*\([0-9.]*\).*/\1/')
echo "Detected installed version: $INSTALLED"
- if [ "$VERSION" == "$INSTALLED" ] ; then
+ if [ "$VERSION" = "$INSTALLED" ] ; then
echo "You already have that version."
exit 0
else
diff --git a/deps/v8/tools/draw_instruction_graph.sh b/deps/v8/tools/draw_instruction_graph.sh
index 549380b..97a4f82 100755
--- a/deps/v8/tools/draw_instruction_graph.sh
+++ b/deps/v8/tools/draw_instruction_graph.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright 2013 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
@@ -42,14 +42,14 @@ file=${1:-$defaultfile}
out=${2:-$defaultout}
# Check input file exists.
-if [ ! -e $file ]; then
+if [ ! -e "$file" ]; then
echo "Input file not found: $file."
echo "Usage: draw_instruction_graph.sh <input csv> <output png>"
exit 1
fi
# Search for an error message, and if found, exit.
-error=`grep -m1 '# Error:' $file`
+error=$(grep -m1 '# Error:' "$file")
if [ -n "$error" ]; then
echo "Error message in input file:"
echo " $error"
@@ -58,10 +58,10 @@ fi
# Sample period - period over which numbers for each category of instructions is
# counted.
-sp=`grep -m1 '# sample_period=' $file | cut -d= -f2`
+sp=$(grep -m1 '# sample_period=' "$file" | cut -d= -f2)
# Get number of counters in the CSV file.
-nc=`grep -m1 '# counters=' $file | cut -d= -f2`
+nc=$(grep -m1 '# counters=' "$file" | cut -d= -f2)
# Find the annotation arrows. They appear as comments in the CSV file, in the
# format:
@@ -69,14 +69,14 @@ nc=`grep -m1 '# counters=' $file | cut -d= -f2`
# Where xx is a two character annotation identifier, and yyyyy is the
# position in the executed instruction stream that generated the annotation.
# Turn these locations into labelled arrows.
-arrows=`sed '/^[^#]/ d' $file | \
- perl -pe "s/^# .. @ (\d+)/set arrow from \1, graph 0.9 to \1, $sp/"`;
-labels=`sed '/^[^#]/d' $file | \
+arrows=$(sed '/^[^#]/ d' "$file" | \
+ perl -pe "s/^# .. @ (\d+)/set arrow from \1, graph 0.9 to \1, $sp/")
+labels=$(sed '/^[^#]/d' "$file" | \
sed -r 's/^# (..) @ (.+)/set label at \2, graph 0.9 "\1" \
- center offset 0,0.5 font "FreeSans, 8"/'`;
+ center offset 0,0.5 font "FreeSans, 8"/')
# Check for gnuplot, and warn if not available.
-if [ ! -e $gnuplot ]; then
+if [ ! -e "$gnuplot" ]; then
echo "Can't find gnuplot at $gnuplot."
echo "Gnuplot version 4.6.3 or later required."
exit 3
diff --git a/deps/v8/tools/eval_gc_time.sh b/deps/v8/tools/eval_gc_time.sh
index 33cc300..5d4c27e 100755
--- a/deps/v8/tools/eval_gc_time.sh
+++ b/deps/v8/tools/eval_gc_time.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright 2015 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
@@ -28,7 +28,7 @@ CSV=""
LOGFILE=/dev/stdin
PERCENTILES=""
-while [[ $# -ge 1 ]]
+while [ $# -ge 1 ]
do
key="$1"
case $key in
@@ -73,7 +73,7 @@ do
shift
done
-if [[ $# -ne 0 ]]; then
+if [ $# -ne 0 ]; then
echo "Unknown option(s): $@"
echo ""
print_usage_and_die
@@ -119,7 +119,7 @@ INTERESTING_OLD_GEN_KEYS="\
sweep.old \
"
-if [[ "$TOP_LEVEL" = "yes" ]]; then
+if [ "$TOP_LEVEL" = "yes" ]; then
INTERESTING_OLD_GEN_KEYS="\
${INTERESTING_OLD_GEN_KEYS} \
clear \
@@ -135,12 +135,12 @@ if [[ "$TOP_LEVEL" = "yes" ]]; then
"
fi
-BASE_DIR=$(dirname $0)
+BASE_DIR=$(dirname "$0")
case $OP in
new-gen-rank)
- cat $LOGFILE | grep "gc=s" \
- | $BASE_DIR/eval_gc_nvp.py \
+ cat "$LOGFILE" | grep "gc=s" \
+ | "$BASE_DIR/eval_gc_nvp.py" \
--no-histogram \
--rank $RANK_MODE \
$CSV \
@@ -148,8 +148,8 @@ case $OP in
${INTERESTING_NEW_GEN_KEYS}
;;
old-gen-rank)
- cat $LOGFILE | grep "gc=ms" \
- | $BASE_DIR/eval_gc_nvp.py \
+ cat "$LOGFILE" | grep "gc=ms" \
+ | "$BASE_DIR/eval_gc_nvp.py" \
--no-histogram \
--rank $RANK_MODE \
$CSV \
diff --git a/deps/v8/tools/find-builtin b/deps/v8/tools/find-builtin
index 29cb0f4..4edc866 100755
--- a/deps/v8/tools/find-builtin
+++ b/deps/v8/tools/find-builtin
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
-set -euo pipefail
+set -eu
BUILTIN_NAME="$1"
-if ! which rg >/dev/null ; then
+if ! command -v rg >/dev/null 2>&1; then
echo >&2 "This tool requires 'rg', install it with 'sudo apt install ripgrep'"
exit 1
fi
diff --git a/deps/v8/tools/fix-inl-header-includes.sh b/deps/v8/tools/fix-inl-header-includes.sh
index d31af37..6d1c4ad 100755
--- a/deps/v8/tools/fix-inl-header-includes.sh
+++ b/deps/v8/tools/fix-inl-header-includes.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2025 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
@@ -7,10 +7,11 @@
echo 'Finding inl headers with corresponding non-inl header, and making'
echo 'sure that the inl header includes the non-inl header first.'
-while read inlh; do
+find src -name '*-inl.h' -and -not -name 'macro-assembler-*-inl.h' |
+while IFS= read -r inlh; do
h=${inlh%-inl.h}.h
- [[ -f $h ]] || continue
- echo -n .
+ [ -f "$h" ] || continue
+ printf '.'
awk '
BEGIN {
i=0
@@ -31,13 +32,8 @@ BEGIN {
print $0;
}
}
- ' $inlh >$inlh.new && mv $inlh.new $inlh
-done < <(
- # Exclude macro-assembler-<ARCH>-inl.h headers because they have special
- # include rules (arch-specific macro assembler headers must be included
- # via the general macro-assembler.h).
- find src -name '*-inl.h' -and -not -name 'macro-assembler-*-inl.h'
-)
+ ' "$inlh" >"$inlh.new" && mv "$inlh.new" "$inlh"
+done
echo
echo 'Done. Make sure to run "git cl format" and check "git diff".'
diff --git a/deps/v8/tools/fuzz-harness.sh b/deps/v8/tools/fuzz-harness.sh
index 01f0353..bd066c8 100755
--- a/deps/v8/tools/fuzz-harness.sh
+++ b/deps/v8/tools/fuzz-harness.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -35,10 +35,10 @@
JSFUNFUZZ_URL="https://bugzilla.mozilla.org/attachment.cgi?id=310631"
JSFUNFUZZ_MD5="d0e497201c5cd7bffbb1cdc1574f4e32"
-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
+v8_root=$(readlink -f "$(dirname "$0")/../")
jsfunfuzz_dir="$v8_root/tools/jsfunfuzz"
-if [ -n "$1" ]; then
+if [ -n "${1:-}" ]; then
d8="${v8_root}/$1"
else
d8="${v8_root}/d8"
@@ -52,16 +52,16 @@ fi
# Deprecated download method. A prepatched archive is downloaded as a hook
# if jsfunfuzz=1 is specified as a gyp flag. Requires google.com authentication
# for google storage.
-if [ "$3" == "--download" ]; then
+if [ "${3:-}" = "--download" ]; then
jsfunfuzz_file="$v8_root/tools/jsfunfuzz.zip"
if [ ! -f "$jsfunfuzz_file" ]; then
echo "Downloading $jsfunfuzz_file ..."
- wget -q -O "$jsfunfuzz_file" $JSFUNFUZZ_URL || exit 1
+ wget -q -O "$jsfunfuzz_file" "$JSFUNFUZZ_URL" || exit 1
fi
jsfunfuzz_sum=$(md5sum "$jsfunfuzz_file" | awk '{ print $1 }')
- if [ $jsfunfuzz_sum != $JSFUNFUZZ_MD5 ]; then
+ if [ "$jsfunfuzz_sum" != "$JSFUNFUZZ_MD5" ]; then
echo "Failed to verify checksum!"
exit 1
fi
@@ -99,7 +99,7 @@ else
archive=fuzz-results-$(date +%Y%m%d%H%M%S).tar.bz2
fi
echo "Creating archive $archive"
-tar -cjf $archive err-* w*
+tar -cjf "$archive" err-* w*
rm -f err-* w*
echo "Total failures: $exit_code"
diff --git a/deps/v8/tools/gcmole/bootstrap.sh b/deps/v8/tools/gcmole/bootstrap.sh
index 35407a9..f052051 100755
--- a/deps/v8/tools/gcmole/bootstrap.sh
+++ b/deps/v8/tools/gcmole/bootstrap.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# Copyright 2013 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
@@ -48,9 +48,9 @@ OS="$(uname -s)"
# Xcode and clang don't get along when predictive compilation is enabled.
# http://crbug.com/96315
-if [[ "${OS}" = "Darwin" ]] && xcodebuild -version | grep -q 'Xcode 3.2' ; then
+if [ "${OS}" = "Darwin" ] && xcodebuild -version | grep -q 'Xcode 3.2' ; then
XCONF=com.apple.Xcode
- if [[ "${GYP_GENERATORS}" != "make" ]] && \
+ if [ "${GYP_GENERATORS:-}" != "make" ] && \
[ "$(defaults read "${XCONF}" EnablePredictiveCompilation)" != "0" ]; then
echo
echo " HEARKEN!"
@@ -63,7 +63,7 @@ if [[ "${OS}" = "Darwin" ]] && xcodebuild -version | grep -q 'Xcode 3.2' ; then
fi
SUB_VERSION=$(xcodebuild -version | sed -Ene 's/Xcode 3\.2\.([0-9]+)/\1/p')
- if [[ "${SUB_VERSION}" < 6 ]]; then
+ if [ "${SUB_VERSION}" -lt 6 ]; then
echo
echo " YOUR LD IS BUGGY!"
echo "Please upgrade Xcode to at least 3.2.6."
@@ -84,7 +84,7 @@ fi
set -x
NUM_JOBS=3
-if [[ "${OS}" = "Linux" ]]; then
+if [ "${OS}" = "Linux" ]; then
if [[ -e "/proc/cpuinfo" ]]; then
NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)"
else
@@ -105,7 +105,7 @@ cmake -GNinja -DCMAKE_CXX_FLAGS="-static-libstdc++" -DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_Z3_SOLVER=OFF "${LLVM_PROJECT_DIR}/llvm"
MACOSX_DEPLOYMENT_TARGET=10.5 ninja -j"${NUM_JOBS}" clang
-if [[ "${BUILD_TYPE}" = "Release" ]]; then
+if [ "${BUILD_TYPE}" = "Release" ]; then
# Strip the clang binary.
STRIP_FLAGS=
if [ "${OS}" = "Darwin" ]; then
@@ -114,7 +114,7 @@ if [[ "${BUILD_TYPE}" = "Release" ]]; then
fi
strip ${STRIP_FLAGS} bin/clang
fi
-cd -
+cd "${THIS_DIR}"
# Build libgcmole.so
make -C "${THIS_DIR}" clean
diff --git a/deps/v8/tools/gcmole/package.sh b/deps/v8/tools/gcmole/package.sh
index 0b9949a..41635df 100755
--- a/deps/v8/tools/gcmole/package.sh
+++ b/deps/v8/tools/gcmole/package.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# Copyright 2019 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
@@ -14,7 +14,7 @@ PACKAGE_DIR="${THIS_DIR}/gcmole-tools"
PACKAGE_FILE="${THIS_DIR}/gcmole-tools.tar.gz"
PACKAGE_SUM="${THIS_DIR}/gcmole-tools.tar.gz.sha1"
BUILD_DIR="${THIS_DIR}/bootstrap/build"
-V8_ROOT_DIR= `realpath "${THIS_DIR}/../.."`
+V8_ROOT_DIR=$(realpath "${THIS_DIR}/../..")
# Echo all commands
set -x
diff --git a/deps/v8/tools/jsfunfuzz/fuzz-harness.sh b/deps/v8/tools/jsfunfuzz/fuzz-harness.sh
index fa4f9d9..9ed344a 100755
--- a/deps/v8/tools/jsfunfuzz/fuzz-harness.sh
+++ b/deps/v8/tools/jsfunfuzz/fuzz-harness.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -12,11 +12,11 @@
JSFUNFUZZ_URL="https://bugzilla.mozilla.org/attachment.cgi?id=310631"
JSFUNFUZZ_MD5="d0e497201c5cd7bffbb1cdc1574f4e32"
-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../../)
+v8_root=$(readlink -f "$(dirname "$0")/../../")
jsfunfuzz_dir="$v8_root/tools/jsfunfuzz"
cd "$jsfunfuzz_dir"
-if [ -n "$1" ]; then
+if [ -n "${1:-}" ]; then
d8="${v8_root}/$1"
else
d8="${v8_root}/d8"
@@ -30,16 +30,16 @@ fi
# Deprecated download method. A prepatched archive is downloaded as a hook
# if jsfunfuzz=1 is specified as a gyp flag. Requires google.com authentication
# for google storage.
-if [ "$3" == "--download" ]; then
+if [ "${3:-}" = "--download" ]; then
jsfunfuzz_file="$v8_root/tools/jsfunfuzz.zip"
if [ ! -f "$jsfunfuzz_file" ]; then
echo "Downloading $jsfunfuzz_file ..."
- wget -q -O "$jsfunfuzz_file" $JSFUNFUZZ_URL || exit 1
+ wget -q -O "$jsfunfuzz_file" "$JSFUNFUZZ_URL" || exit 1
fi
jsfunfuzz_sum=$(md5sum "$jsfunfuzz_file" | awk '{ print $1 }')
- if [ $jsfunfuzz_sum != $JSFUNFUZZ_MD5 ]; then
+ if [ "$jsfunfuzz_sum" != "$JSFUNFUZZ_MD5" ]; then
echo "Failed to verify checksum!"
exit 1
fi
@@ -92,7 +92,7 @@ else
archive=fuzz-results-$(date +%Y%m%d%H%M%S).tar.bz2
fi
echo "Creating archive $archive"
-tar -cjf $archive err-* w*
+tar -cjf "$archive" err-* w*
rm -f err-* w*
echo "Total failures: $exit_code"
diff --git a/deps/v8/tools/mb/mb b/deps/v8/tools/mb/mb
index d3a0cdf..bac79bf 100755
--- a/deps/v8/tools/mb/mb
+++ b/deps/v8/tools/mb/mb
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/deps/v8/tools/profiling/android-ll-prof.sh b/deps/v8/tools/profiling/android-ll-prof.sh
index 436f262..8314777 100755
--- a/deps/v8/tools/profiling/android-ll-prof.sh
+++ b/deps/v8/tools/profiling/android-ll-prof.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -42,7 +42,7 @@ MODE=$1
RUN_ARGS=$2
LL_PROF_ARGS=$3
-BASE=`cd $(dirname "$0")/..; pwd`
+BASE=$(cd "$(dirname "$0")/.." && pwd)
DEPLOY="$BASE/deploy"
set +e
diff --git a/deps/v8/tools/profiling/linux-perf-chrome-renderer-cmd.sh b/deps/v8/tools/profiling/linux-perf-chrome-renderer-cmd.sh
index b50dcc6..bafce15 100755
--- a/deps/v8/tools/profiling/linux-perf-chrome-renderer-cmd.sh
+++ b/deps/v8/tools/profiling/linux-perf-chrome-renderer-cmd.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# Copyright 2022 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -84,9 +84,9 @@ done
SAMPLE_TRIGGER=""
if [ -n "${PERF_COUNT}" ]; then
- SAMPLE_TRIGGER+="--count=${PERF_COUNT}"
+ SAMPLE_TRIGGER="--count=${PERF_COUNT}"
elif [ -n "${PERF_FREQ}" ]; then
- SAMPLE_TRIGGER+=" --freq=${PERF_FREQ}"
+ SAMPLE_TRIGGER="--freq=${PERF_FREQ}"
else
SAMPLE_TRIGGER="--freq=${PERF_FREQ_DEFAULT}"
fi
diff --git a/deps/v8/tools/system-analyzer/local-server.sh b/deps/v8/tools/system-analyzer/local-server.sh
index 3e5748e..6a59e52 100755
--- a/deps/v8/tools/system-analyzer/local-server.sh
+++ b/deps/v8/tools/system-analyzer/local-server.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2022 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
@@ -27,26 +27,29 @@ if ! npm list local-web-server > /dev/null; then
exit
fi
-TOOLS_DIR=`readlink "$0"` || TOOLS_DIR="$0";
-TOOLS_DIR=`dirname "$TOOLS_DIR"`;
+TOOLS_DIR=$(readlink "$0") || TOOLS_DIR="$0"
+TOOLS_DIR=$(dirname "$TOOLS_DIR")
cd "$TOOLS_DIR/.."
-TOOLS_DIR=`pwd -P`
+TOOLS_DIR=$(pwd -P)
# Check if port 8000 is in use
-if [[ "$OSTYPE" == "msys" ]]; then
+case "$(uname -s)" in
+ MINGW*|MSYS*)
if netstat -ano | findstr :8000 > /dev/null; then
echo "localhost:8000 is already in use. You can kill it with:"
echo "netstat -aon | findstr :8000"
echo "taskkill /PID <PID>"
exit 1
fi
-else
+ ;;
+ *)
if lsof -t -i TCP:8000; then
echo "localhost:8000 is already in use. You can kill it with:"
echo "lsof -t -i TCP:8000 | xargs kill"
exit 1
fi
-fi
+ ;;
+esac
echo "Starting local symbol server"
npm run start-webserver -- \
@@ -56,7 +59,7 @@ npm run start-webserver -- \
lws-index & PID=$!
# Kill server after 1h
-for i in `seq 3600`; do
+for i in $(seq 3600); do
if ps -p $PID > /dev/null 2>&1; then
sleep 1;
fi
diff --git a/deps/v8/tools/turbolizer/deploy.sh b/deps/v8/tools/turbolizer/deploy.sh
index 184f40a..c45edc8 100755
--- a/deps/v8/tools/turbolizer/deploy.sh
+++ b/deps/v8/tools/turbolizer/deploy.sh
@@ -1,24 +1,24 @@
-#!/bin/bash
+#!/bin/sh
DEST=$1
if [ ! -d "$DEST" ]; then
- echo -e "Destination \"$DEST\" is not a directory. Run\n\tnpm deploy -- [destination-directory]"
+ printf 'Destination "%s" is not a directory. Run\n\tnpm deploy -- [destination-directory]\n' "$DEST"
exit 1
fi
-function copy() {
- echo -n "."
+copy() {
+ printf '.'
cp "$@"
}
-echo -n "Deploying..."
-copy *.png $DEST/
-copy index.html $DEST/
-copy info-view.html $DEST/
-copy -R build $DEST/
-copy -R img $DEST/
-copy -R css $DEST/
+printf 'Deploying...'
+copy *.png "$DEST/"
+copy index.html "$DEST/"
+copy info-view.html "$DEST/"
+copy -R build "$DEST/"
+copy -R img "$DEST/"
+copy -R css "$DEST/"
echo "done!"
echo "Deployed to $DEST/."
diff --git a/deps/v8/tools/wasm/update-wasm-fuzzers.sh b/deps/v8/tools/wasm/update-wasm-fuzzers.sh
index 3f1ac6d..51bc882 100755
--- a/deps/v8/tools/wasm/update-wasm-fuzzers.sh
+++ b/deps/v8/tools/wasm/update-wasm-fuzzers.sh
@@ -1,11 +1,11 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -ex
-cd "$( dirname "${BASH_SOURCE[0]}" )"
+cd "$(dirname "$0")"
cd ../..
BUILD_DIR=out/mk_wasm_fuzzer_corpus
diff --git a/deps/v8/tools/wasm/update-wasm-spec-tests.sh b/deps/v8/tools/wasm/update-wasm-spec-tests.sh
index 7445dc8..29c380f 100755
--- a/deps/v8/tools/wasm/update-wasm-spec-tests.sh
+++ b/deps/v8/tools/wasm/update-wasm-spec-tests.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -9,17 +9,13 @@ set -e
# Treat unset variables as an error when substituting.
set -u
-# return value of a pipeline is the status of the last command to exit with a
-# non-zero status, or zero if no command exited with a non-zero status
-set -o pipefail
-
log() {
- echo ">>" $*
+ echo ">>" "$@"
}
log_and_run() {
- log $*
- if ! $*; then
+ log "$@"
+ if ! "$@"; then
echo "sub-command failed: $*"
exit 1
fi
@@ -39,8 +35,9 @@ copy_file_relative() {
echo "Incorrect usage of copy_file_relative: ${SRC_FILE} is not within ${SRC_DIR}"
exit 1
fi
- [[ -d $(dirname ${DST_FILE}) ]] || log_and_run mkdir -pv $(dirname ${DST_FILE})
- log_and_run cp -v ${SRC_FILE} ${DST_FILE}
+ dst_parent=$(dirname "${DST_FILE}")
+ [ -d "$dst_parent" ] || log_and_run mkdir -pv "$dst_parent"
+ log_and_run cp -v "${SRC_FILE}" "${DST_FILE}"
}
# Copy files from $1 to $2 under their relative name within $2.
@@ -67,7 +64,7 @@ new_section() {
# Setup directories.
###############################################################################
-TOOLS_WASM_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
+TOOLS_WASM_DIR=$(cd "$(dirname "$0")" && pwd)
V8_DIR=$(cd ${TOOLS_WASM_DIR}/../.. && pwd)
SPEC_TEST_DIR=${V8_DIR}/test/wasm-spec-tests
TMP_DIR=$(mktemp -d)
diff --git a/deps/zlib/google/test/data/create_test_zip.sh b/deps/zlib/google/test/data/create_test_zip.sh
index 620e8f6..0b27cf5 100755
--- a/deps/zlib/google/test/data/create_test_zip.sh
+++ b/deps/zlib/google/test/data/create_test_zip.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright 2011 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
@@ -7,11 +7,10 @@
# Run this script in its directory to recreate test.zip, test_nocompress.zip,
# and test_encrypted.zip
-rm test.zip
-rm test_nocompress.zip
-rm test_encrypted.zip
-pushd test
+rm -f test.zip
+rm -f test_nocompress.zip
+rm -f test_encrypted.zip
+cd test || exit 1
zip -r ../test.zip .
zip -r -0 ../test_nocompress.zip .
zip -P "fake_password" -r ../test_encrypted.zip .
-popd
diff --git a/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh b/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh
index c40046d..8a862eb 100755
--- a/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh
+++ b/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh
@@ -1,8 +1,7 @@
-#!/usr/bin/env bash
-set -euo pipefail
-shopt -s inherit_errexit
+#!/bin/sh
+set -eu
-cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
+cd -- "$(dirname -- "$0")"
if [ ! -f key.pem ]; then
openssl genrsa -out key.pem 2048
diff --git a/test/fixtures/run-script/node_modules/.bin/custom-env b/test/fixtures/run-script/node_modules/.bin/custom-env
index e6f291c..1430f2e 100755
--- a/test/fixtures/run-script/node_modules/.bin/custom-env
+++ b/test/fixtures/run-script/node_modules/.bin/custom-env
@@ -1,2 +1,2 @@
-#!/bin/bash
+#!/bin/sh
echo "$CUSTOM_ENV"
diff --git a/test/fixtures/run-script/node_modules/.bin/positional-args b/test/fixtures/run-script/node_modules/.bin/positional-args
index 2d80923..3dc5314 100755
--- a/test/fixtures/run-script/node_modules/.bin/positional-args
+++ b/test/fixtures/run-script/node_modules/.bin/positional-args
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/bin/sh
echo "Arguments: '$@'"
echo "The total number of arguments are: $#"
diff --git a/tools/create_android_makefiles b/tools/create_android_makefiles
index abf2ecf..6073bbd 100755
--- a/tools/create_android_makefiles
+++ b/tools/create_android_makefiles
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Run this script ONLY inside an Android build system
# and after you ran lunch command!
@@ -13,13 +13,13 @@ else
ARCH="$1"
fi
-if [ $ARCH = "x86" ]; then
+if [ "$ARCH" = "x86" ]; then
TARGET_ARCH="ia32"
else
TARGET_ARCH="$ARCH"
fi
-cd $(dirname $0)/..
+cd "$(dirname "$0")/.."
./configure \
--without-snapshot \
@@ -30,9 +30,9 @@ cd $(dirname $0)/..
export GYP_GENERATORS="android"
export GYP_GENERATOR_FLAGS="limit_to_target_all=true"
GYP_DEFINES="target_arch=$TARGET_ARCH"
-GYP_DEFINES+=" v8_target_arch=$TARGET_ARCH"
-GYP_DEFINES+=" android_target_arch=$ARCH"
-GYP_DEFINES+=" host_os=linux OS=android"
+GYP_DEFINES="$GYP_DEFINES v8_target_arch=$TARGET_ARCH"
+GYP_DEFINES="$GYP_DEFINES android_target_arch=$ARCH"
+GYP_DEFINES="$GYP_DEFINES host_os=linux OS=android"
export GYP_DEFINES
./deps/npm/node_modules/node-gyp/gyp/gyp \
@@ -43,4 +43,8 @@ export GYP_DEFINES
-Dlibrary=static_library \
node.gyp
-echo -e "LOCAL_PATH := \$(call my-dir)\n\ninclude \$(LOCAL_PATH)/GypAndroid.mk" > Android.mk
+cat > Android.mk <<'EOF'
+LOCAL_PATH := $(call my-dir)
+
+include $(LOCAL_PATH)/GypAndroid.mk
+EOF
diff --git a/tools/inspector_protocol/jinja2/get_jinja2.sh b/tools/inspector_protocol/jinja2/get_jinja2.sh
index bc6c4c3..13b6fea 100755
--- a/tools/inspector_protocol/jinja2/get_jinja2.sh
+++ b/tools/inspector_protocol/jinja2/get_jinja2.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Download and extract Jinja2
# Homepage:
# http://jinja.pocoo.org/
@@ -18,15 +18,15 @@ REMOVE_FILES='testsuite'
FILENAME="$(basename $SRC_URL)"
MD5_FILENAME="$FILENAME.md5"
SHA512_FILENAME="$FILENAME.sha512"
-CHROMIUM_FILES+=" $MD5_FILENAME $SHA512_FILENAME"
+CHROMIUM_FILES="$CHROMIUM_FILES $MD5_FILENAME $SHA512_FILENAME"
BUILD_DIR="$PACKAGE-$VERSION"
-THIRD_PARTY="$(dirname $(realpath $(dirname "${BASH_SOURCE[0]}")))"
+THIRD_PARTY="$(dirname "$(realpath "$(dirname "$0")")")"
INSTALL_DIR="$THIRD_PARTY/$PACKAGE_DIR"
OUT_DIR="$INSTALL_DIR/$BUILD_DIR/$PACKAGE_DIR"
OLD_DIR="$THIRD_PARTY/$PACKAGE_DIR.old"
-function check_hashes {
+check_hashes() {
# Hashes generated via:
# FILENAME=Jinja2-2.8.tar.gz
# md5sum "$FILENAME" > "$FILENAME.md5"
diff --git a/tools/inspector_protocol/markupsafe/get_markupsafe.sh b/tools/inspector_protocol/markupsafe/get_markupsafe.sh
index d268832..5acd3d5 100755
--- a/tools/inspector_protocol/markupsafe/get_markupsafe.sh
+++ b/tools/inspector_protocol/markupsafe/get_markupsafe.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Download and extract MarkupSafe
# Homepage:
# https://github.com/mitsuhiko/markupsafe
@@ -12,20 +12,19 @@ CHROMIUM_FILES="README.chromium OWNERS get_markupsafe.sh"
EXTRA_FILES='LICENSE AUTHORS'
REMOVE_FILES='tests.py'
-SRC_URL='https://pypi.python.org/packages/source/'
-SRC_URL+="${PACKAGE:0:1}/$PACKAGE/$PACKAGE-$VERSION.tar.gz"
+SRC_URL="https://pypi.python.org/packages/source/${PACKAGE%${PACKAGE#?}}/$PACKAGE/$PACKAGE-$VERSION.tar.gz"
FILENAME="$(basename $SRC_URL)"
MD5_FILENAME="$FILENAME.md5"
SHA512_FILENAME="$FILENAME.sha512"
-CHROMIUM_FILES+=" $MD5_FILENAME $SHA512_FILENAME"
+CHROMIUM_FILES="$CHROMIUM_FILES $MD5_FILENAME $SHA512_FILENAME"
BUILD_DIR="$PACKAGE-$VERSION"
-THIRD_PARTY="$(dirname $(realpath $(dirname "${BASH_SOURCE[0]}")))"
+THIRD_PARTY="$(dirname "$(realpath "$(dirname "$0")")")"
INSTALL_DIR="$THIRD_PARTY/$PACKAGE_DIR"
OUT_DIR="$INSTALL_DIR/$BUILD_DIR/$PACKAGE_DIR"
OLD_DIR="$THIRD_PARTY/$PACKAGE_DIR.old"
-function check_hashes {
+check_hashes() {
# Hashes generated via:
# FILENAME=MarkupSafe-0.18.tar.gz
# md5sum "$FILENAME" > "$FILENAME.md5"