Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: quote all bash variables when used (#8066)

Andrey Lushnikovb1b4d7b81907
diff --git a/browser_patches/checkout_build_archive_upload.sh b/browser_patches/checkout_build_archive_upload.sh
index 3227302a17..df42b840f2 100755
--- a/browser_patches/checkout_build_archive_upload.sh
+++ b/browser_patches/checkout_build_archive_upload.sh
@@ -4,7 +4,7 @@ set +x
set -o pipefail
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
- echo "usage: $(basename $0) [firefox-linux|firefox-win32|firefox-win64|webkit-gtk|webkit-wpe|webkit-gtk-wpe|webkit-win64|webkit-mac-10.14|webkit-mac-10.15] [-f|--force]"
+ echo "usage: $(basename "$0") [firefox-linux|firefox-win32|firefox-win64|webkit-gtk|webkit-wpe|webkit-gtk-wpe|webkit-win64|webkit-mac-10.14|webkit-mac-10.15] [-f|--force]"
echo
echo "Prepares checkout under browser folder, applies patches, builds, archives, and uploads if build is missing."
echo "Script will bail out early if the build for the browser version is already present."
@@ -17,7 +17,7 @@ fi
if [[ $# == 0 ]]; then
echo "missing build flavor!"
- echo "try './$(basename $0) --help' for more information"
+ echo "try './$(basename "$0") --help' for more information"
exit 1
fi
@@ -354,7 +354,7 @@ else
LOG_PATH="/tmp/log-$BROWSER_NAME.zip"
fi
-if [[ -f $ZIP_PATH ]]; then
+if [[ -f "$ZIP_PATH" ]]; then
echo "Archive $ZIP_PATH already exists - remove and re-run the script."
exit 1
fi
@@ -392,12 +392,12 @@ function generate_and_upload_browser_build {
fi
echo "-- archiving to $ZIP_PATH"
- if ! ./$BROWSER_NAME/archive.sh $ZIP_PATH "$EXTRA_ARCHIVE_ARGS"; then
+ if ! ./$BROWSER_NAME/archive.sh "$ZIP_PATH" "$EXTRA_ARCHIVE_ARGS"; then
return 23
fi
echo "-- uploading"
- if ! ./upload.sh $BUILD_BLOB_PATH $ZIP_PATH; then
+ if ! ./upload.sh "$BUILD_BLOB_PATH" "$ZIP_PATH"; then
return 24
fi
return 0
@@ -419,7 +419,7 @@ if generate_and_upload_browser_build 2>&1 | ./sanitize_and_compress_log.js $LOG_
(
for i in $(cat "${BROWSER_NAME}/${BUILDS_LIST}"); do
URL="https://playwright2.blob.core.windows.net/builds/${BROWSER_NAME}/${BUILD_NUMBER}/$i"
- if ! [[ $(curl -s -L -I $URL | head -1 | cut -f2 -d' ') == 200 ]]; then
+ if ! [[ $(curl -s -L -I "$URL" | head -1 | cut -f2 -d' ') == 200 ]]; then
# Exit subshell
echo "Missing build at ${URL}"
exit
@@ -448,7 +448,7 @@ else
FAILED_STEP="<unknown step>"
fi
# Upload logs only in case of failure and report failure.
- ./upload.sh ${LOG_BLOB_PATH} ${LOG_PATH} || true
+ ./upload.sh "${LOG_BLOB_PATH}" ${LOG_PATH} || true
send_telegram_message "$BUILD_ALIAS -- ${FAILED_STEP} failed! ❌ <a href='https://playwright.azureedge.net/builds/${LOG_BLOB_PATH}'>${LOG_BLOB_NAME}</a>"
exit 1
fi
diff --git a/browser_patches/chromium/archive.sh b/browser_patches/chromium/archive.sh
index bc858ba05e..6728a6a0cc 100755
--- a/browser_patches/chromium/archive.sh
+++ b/browser_patches/chromium/archive.sh
@@ -3,12 +3,12 @@ set -e
set +x
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
SCRIPT_PATH=$(pwd -P)
main() {
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
- echo "usage: $(basename $0) [output-absolute-path]"
+ echo "usage: $(basename "$0") [output-absolute-path]"
echo
echo "Generate distributable .zip archive from ./output folder that was previously downloaded."
echo
@@ -29,7 +29,7 @@ main() {
echo "ERROR: path $ZIP_PATH exists; can't do anything."
exit 1
fi
- if ! [[ -d $(dirname $ZIP_PATH) ]]; then
+ if ! [[ -d $(dirname "$ZIP_PATH") ]]; then
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
exit 1
fi
@@ -45,7 +45,7 @@ main() {
fi
cd "${SCRIPT_PATH}"
- cp output/build.zip $ZIP_PATH
+ cp output/build.zip "$ZIP_PATH"
}
function archive_compiled_chromium() {
diff --git a/browser_patches/chromium/build.sh b/browser_patches/chromium/build.sh
index fa5c123aa5..21dd4051ce 100755
--- a/browser_patches/chromium/build.sh
+++ b/browser_patches/chromium/build.sh
@@ -3,10 +3,10 @@ set -e
set +x
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
USAGE=$(cat<<EOF
- usage: $(basename $0) [--mirror|--mirror-linux|--mirror-win32|--mirror-win64|--mirror-mac|--compile-mac-arm64|--compile-linux|--compile-win32|--compile-win64|--compile-mac]
+ usage: $(basename "$0") [--mirror|--mirror-linux|--mirror-win32|--mirror-win64|--mirror-mac|--compile-mac-arm64|--compile-linux|--compile-win32|--compile-win64|--compile-mac]
Either compiles chromium or mirrors it from Chromium Continuous Builds CDN.
EOF
@@ -20,9 +20,9 @@ main() {
echo "$USAGE"
exit 0
elif [[ $1 == "--mirror"* ]]; then
- mirror_chromium $1
+ mirror_chromium "$1"
elif [[ $1 == "--compile"* ]]; then
- compile_chromium $1
+ compile_chromium "$1"
else
echo "ERROR: unknown first argument. Use --help for details."
exit 1
@@ -82,9 +82,9 @@ compile_chromium() {
if [[ $1 == "--compile-win"* ]]; then
if [[ -z "$USE_GOMA" ]]; then
- /c/Windows/System32/cmd.exe "/c $(cygpath -w ${SCRIPT_FOLDER}/buildwin.bat)"
+ /c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwin.bat)"
else
- /c/Windows/System32/cmd.exe "/c $(cygpath -w ${SCRIPT_FOLDER}/buildwingoma.bat)"
+ /c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwingoma.bat)"
fi
else
gn gen out/Default
@@ -144,4 +144,4 @@ mirror_chromium() {
unzip chromium-upstream.zip
}
-main $1
+main "$1"
diff --git a/browser_patches/chromium/clean.sh b/browser_patches/chromium/clean.sh
index aff22b0873..7b22fb259d 100755
--- a/browser_patches/chromium/clean.sh
+++ b/browser_patches/chromium/clean.sh
@@ -3,7 +3,7 @@ set -e
set +x
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
rm -rf output
if [[ ! -z "${CR_CHECKOUT_PATH}" ]]; then
diff --git a/browser_patches/chromium/goma.sh b/browser_patches/chromium/goma.sh
index 180d33255d..9a7a77cf59 100755
--- a/browser_patches/chromium/goma.sh
+++ b/browser_patches/chromium/goma.sh
@@ -3,7 +3,7 @@ set -e
set -x
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
if [[ ! -d ./electron-build-tools ]]; then
git clone --single-branch --branch master https://github.com/electron/build-tools/ electron-build-tools
@@ -19,7 +19,7 @@ cd electron-build-tools/third_party/goma
export GOMA_START_COMPILER_PROXY=true
if [[ $1 == "--help" ]]; then
- echo "$(basename $0) [login|start|stop|--help]"
+ echo "$(basename "$0") [login|start|stop|--help]"
exit 0
elif [[ $1 == "login" ]]; then
if [[ $(uname) == "MINGW"* ]]; then
@@ -35,7 +35,7 @@ elif [[ $1 == "start" ]]; then
fi
if [[ ! -f "$HOME/.goma_oauth2_config" ]]; then
echo "ERROR: goma is not logged in!"
- echo "run '$(basename $0) login'"
+ echo "run '$(basename "$0") login'"
exit 1
fi
if [[ $(uname) == "MINGW"* ]]; then
diff --git a/browser_patches/export.sh b/browser_patches/export.sh
index 7b8b4ef04e..dec6c8da11 100755
--- a/browser_patches/export.sh
+++ b/browser_patches/export.sh
@@ -110,16 +110,16 @@ else
fi
# Switch to git repository.
-cd $CHECKOUT_PATH
+cd "$CHECKOUT_PATH"
# Setting up |$REMOTE_BROWSER_UPSTREAM| remote and fetch the $BASE_BRANCH
if git remote get-url $REMOTE_BROWSER_UPSTREAM >/dev/null; then
if ! [[ $(git config --get remote.$REMOTE_BROWSER_UPSTREAM.url || echo "") == "$REMOTE_URL" ]]; then
- echo "ERROR: remote $REMOTE_BROWSER_UPSTREAM is not pointing to '$REMOTE_URL'! run `prepare_checkout.sh` first"
+ echo "ERROR: remote $REMOTE_BROWSER_UPSTREAM is not pointing to '$REMOTE_URL'! run 'prepare_checkout.sh' first"
exit 1
fi
else
- echo "ERROR: checkout does not have $REMOTE_BROWSER_UPSTREAM; run `prepare_checkout.sh` first"
+ echo "ERROR: checkout does not have $REMOTE_BROWSER_UPSTREAM; run 'prepare_checkout.sh' first"
exit 1
fi
@@ -131,17 +131,17 @@ else
echo "-- checking $FRIENDLY_CHECKOUT_PATH is clean - OK"
fi
-PATCH_NAME=$(ls -1 $EXPORT_PATH/patches)
+PATCH_NAME=$(ls -1 "$EXPORT_PATH"/patches)
if [[ -z "$PATCH_NAME" ]]; then
PATCH_NAME="bootstrap.diff"
OLD_DIFF=""
else
- OLD_DIFF=$(cat $EXPORT_PATH/patches/$PATCH_NAME)
+ OLD_DIFF=$(cat "$EXPORT_PATH"/patches/$PATCH_NAME)
fi
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
-NEW_BASE_REVISION=$(git merge-base $REMOTE_BROWSER_UPSTREAM/$BASE_BRANCH $CURRENT_BRANCH)
-NEW_DIFF=$(git diff --diff-algorithm=myers --full-index $NEW_BASE_REVISION $CURRENT_BRANCH -- . ":!${EXTRA_FOLDER_CHECKOUT_RELPATH}")
+NEW_BASE_REVISION=$(git merge-base $REMOTE_BROWSER_UPSTREAM/"$BASE_BRANCH" "$CURRENT_BRANCH")
+NEW_DIFF=$(git diff --diff-algorithm=myers --full-index "$NEW_BASE_REVISION" "$CURRENT_BRANCH" -- . ":!${EXTRA_FOLDER_CHECKOUT_RELPATH}")
# Increment BUILD_NUMBER
BUILD_NUMBER=$(curl ${BUILD_NUMBER_UPSTREAM_URL} | head -1)
@@ -149,10 +149,10 @@ BUILD_NUMBER=$((BUILD_NUMBER+1))
echo "REMOTE_URL=\"$REMOTE_URL\"
BASE_BRANCH=\"$BASE_BRANCH\"
-BASE_REVISION=\"$NEW_BASE_REVISION\"" > $EXPORT_PATH/UPSTREAM_CONFIG.sh
-echo "$NEW_DIFF" > $EXPORT_PATH/patches/$PATCH_NAME
-echo $BUILD_NUMBER > $EXPORT_PATH/BUILD_NUMBER
-echo "Changed: $(git config user.email) $(date)" >> $EXPORT_PATH/BUILD_NUMBER
+BASE_REVISION=\"$NEW_BASE_REVISION\"" > "$EXPORT_PATH"/UPSTREAM_CONFIG.sh
+echo "$NEW_DIFF" > "$EXPORT_PATH"/patches/$PATCH_NAME
+echo $BUILD_NUMBER > "$EXPORT_PATH"/BUILD_NUMBER
+echo "Changed: $(git config user.email) $(date)" >> "$EXPORT_PATH"/BUILD_NUMBER
echo "-- exporting standalone folder"
rm -rf "${EXTRA_FOLDER_PW_PATH}"
diff --git a/browser_patches/firefox-beta/archive.sh b/browser_patches/firefox-beta/archive.sh
index c3b66c8719..c23d782e0c 100755
--- a/browser_patches/firefox-beta/archive.sh
+++ b/browser_patches/firefox-beta/archive.sh
@@ -3,7 +3,7 @@ set -e
set +x
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
- echo "usage: $(basename $0) [output-absolute-path]"
+ echo "usage: $(basename "$0") [output-absolute-path]"
echo
echo "Generate distributable .zip archive from ./checkout folder that was previously built."
echo
@@ -23,13 +23,13 @@ if [[ -f $ZIP_PATH ]]; then
echo "ERROR: path $ZIP_PATH exists; can't do anything."
exit 1
fi
-if ! [[ -d $(dirname $ZIP_PATH) ]]; then
+if ! [[ -d $(dirname "$ZIP_PATH") ]]; then
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
exit 1
fi
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
SCRIPT_FOLDER="$(pwd -P)"
if [[ ! -z "${FF_CHECKOUT_PATH}" ]]; then
@@ -42,7 +42,7 @@ fi
OBJ_FOLDER="obj-build-playwright"
./mach package
-node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/$OBJ_FOLDER/dist/firefox
+node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/$OBJ_FOLDER/dist/firefox
if ! [[ -d $OBJ_FOLDER/dist/firefox ]]; then
echo "ERROR: cannot find $OBJ_FOLDER/dist/firefox folder in the checkout/. Did you build?"
@@ -57,4 +57,4 @@ fi
# tar resulting directory and cleanup TMP.
cd $OBJ_FOLDER/dist
-zip -r $ZIP_PATH firefox
+zip -r "$ZIP_PATH" firefox
diff --git a/browser_patches/firefox-beta/build.sh b/browser_patches/firefox-beta/build.sh
index f3275d7dbf..98623d7b9f 100755
--- a/browser_patches/firefox-beta/build.sh
+++ b/browser_patches/firefox-beta/build.sh
@@ -11,7 +11,7 @@ XCODE_VERSION_WITH_REQUIRED_SDK_VERSION="8.3.3"
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
SCRIPT_FOLDER="$(pwd -P)"
source "${SCRIPT_FOLDER}/../utils.sh"
@@ -118,8 +118,8 @@ if [[ $1 == "--juggler" ]]; then
fi
if [[ "$(uname)" == "Darwin" ]]; then
- node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/${OBJ_FOLDER}/dist
+ node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/${OBJ_FOLDER}/dist
else
- node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/${OBJ_FOLDER}/dist/bin
+ node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/${OBJ_FOLDER}/dist/bin
fi
diff --git a/browser_patches/firefox-beta/clean.sh b/browser_patches/firefox-beta/clean.sh
index bd76941453..ef80f7ea07 100755
--- a/browser_patches/firefox-beta/clean.sh
+++ b/browser_patches/firefox-beta/clean.sh
@@ -7,7 +7,7 @@ if [[ ! -z "${FF_CHECKOUT_PATH}" ]]; then
cd "${FF_CHECKOUT_PATH}"
echo "WARNING: checkout path from FF_CHECKOUT_PATH env: ${FF_CHECKOUT_PATH}"
else
- cd "$(dirname $0)"
+ cd "$(dirname "$0")"
cd "../firefox/checkout"
fi
diff --git a/browser_patches/firefox/archive.sh b/browser_patches/firefox/archive.sh
index 776891f358..a3bc22ddd6 100755
--- a/browser_patches/firefox/archive.sh
+++ b/browser_patches/firefox/archive.sh
@@ -3,7 +3,7 @@ set -e
set +x
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
- echo "usage: $(basename $0) [output-absolute-path]"
+ echo "usage: $(basename "$0") [output-absolute-path]"
echo
echo "Generate distributable .zip archive from ./checkout folder that was previously built."
echo
@@ -23,13 +23,13 @@ if [[ -f $ZIP_PATH ]]; then
echo "ERROR: path $ZIP_PATH exists; can't do anything."
exit 1
fi
-if ! [[ -d $(dirname $ZIP_PATH) ]]; then
+if ! [[ -d $(dirname "$ZIP_PATH") ]]; then
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
exit 1
fi
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
SCRIPT_FOLDER="$(pwd -P)"
if [[ ! -z "${FF_CHECKOUT_PATH}" ]]; then
@@ -42,7 +42,7 @@ fi
OBJ_FOLDER="obj-build-playwright"
./mach package
-node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/$OBJ_FOLDER/dist/firefox
+node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/$OBJ_FOLDER/dist/firefox
if ! [[ -d $OBJ_FOLDER/dist/firefox ]]; then
echo "ERROR: cannot find $OBJ_FOLDER/dist/firefox folder in the checkout/. Did you build?"
@@ -57,4 +57,4 @@ fi
# tar resulting directory and cleanup TMP.
cd $OBJ_FOLDER/dist
-zip -r $ZIP_PATH firefox
+zip -r "$ZIP_PATH" firefox
diff --git a/browser_patches/firefox/build.sh b/browser_patches/firefox/build.sh
index 157ddec523..8875c8f8f0 100755
--- a/browser_patches/firefox/build.sh
+++ b/browser_patches/firefox/build.sh
@@ -11,7 +11,7 @@ XCODE_VERSION_WITH_REQUIRED_SDK_VERSION="8.3.3"
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
SCRIPT_FOLDER="$(pwd -P)"
source "${SCRIPT_FOLDER}/../utils.sh"
@@ -118,8 +118,8 @@ if [[ $1 == "--juggler" ]]; then
fi
if [[ "$(uname)" == "Darwin" ]]; then
- node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/${OBJ_FOLDER}/dist
+ node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/${OBJ_FOLDER}/dist
else
- node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/${OBJ_FOLDER}/dist/bin
+ node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/${OBJ_FOLDER}/dist/bin
fi
diff --git a/browser_patches/firefox/clean.sh b/browser_patches/firefox/clean.sh
index 9b3a97c380..a849343d30 100755
--- a/browser_patches/firefox/clean.sh
+++ b/browser_patches/firefox/clean.sh
@@ -7,7 +7,7 @@ if [[ ! -z "${FF_CHECKOUT_PATH}" ]]; then
cd "${FF_CHECKOUT_PATH}"
echo "WARNING: checkout path from FF_CHECKOUT_PATH env: ${FF_CHECKOUT_PATH}"
else
- cd "$(dirname $0)"
+ cd "$(dirname "$0")"
cd "checkout"
fi
diff --git a/browser_patches/prepare_checkout.sh b/browser_patches/prepare_checkout.sh
index f27a323257..e0f9cefe4d 100755
--- a/browser_patches/prepare_checkout.sh
+++ b/browser_patches/prepare_checkout.sh
@@ -10,7 +10,7 @@ REMOTE_BROWSER_UPSTREAM="browser_upstream"
BUILD_BRANCH="playwright-build"
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
- echo "usage: $(basename $0) [firefox|firefox-beta|webkit] [custom_checkout_path]"
+ echo "usage: $(basename "$0") [firefox|firefox-beta|webkit] [custom_checkout_path]"
echo
echo "Prepares browser checkout. The checkout is a GIT repository that:"
echo "- has a '$REMOTE_BROWSER_UPSTREAM' remote pointing to a REMOTE_URL from UPSTREAM_CONFIG.sh"
@@ -23,7 +23,7 @@ fi
if [[ $# == 0 ]]; then
echo "missing browser: 'firefox' or 'webkit'"
- echo "try './$(basename $0) --help' for more information"
+ echo "try './$(basename "$0") --help' for more information"
exit 1
fi
@@ -139,11 +139,11 @@ if ! [[ -d $CHECKOUT_PATH ]]; then
echo "-- $FRIENDLY_CHECKOUT_PATH is missing - checking out.."
if [[ -n "$CI" ]]; then
# In CI environment, we re-checkout constantly, so we do a shallow checkout to save time.
- git clone --single-branch --depth 1 --branch $BASE_BRANCH $REMOTE_URL $CHECKOUT_PATH
+ git clone --single-branch --depth 1 --branch "$BASE_BRANCH" "$REMOTE_URL" "$CHECKOUT_PATH"
else
# In non-CI environment, do a full checkout. This takes time,
# but liberates from the `git fetch --unshallow`.
- git clone --single-branch --branch $BASE_BRANCH $REMOTE_URL $CHECKOUT_PATH
+ git clone --single-branch --branch "$BASE_BRANCH" "$REMOTE_URL" "$CHECKOUT_PATH"
fi
else
echo "-- checking $FRIENDLY_CHECKOUT_PATH folder - OK"
@@ -158,7 +158,7 @@ else
fi
# ============== SETTING UP GIT REPOSITORY ==============
-cd $CHECKOUT_PATH
+cd "$CHECKOUT_PATH"
# Bail out if git repo is dirty.
if [[ -n $(git status -s --untracked-files=no) ]]; then
@@ -169,7 +169,7 @@ fi
# Setting up |$REMOTE_BROWSER_UPSTREAM| remote and fetch the $BASE_BRANCH
if git remote get-url $REMOTE_BROWSER_UPSTREAM >/dev/null; then
echo "-- setting |$REMOTE_BROWSER_UPSTREAM| remote url to $REMOTE_URL"
- git remote set-url $REMOTE_BROWSER_UPSTREAM $REMOTE_URL
+ git remote set-url $REMOTE_BROWSER_UPSTREAM "$REMOTE_URL"
else
echo "-- adding |$REMOTE_BROWSER_UPSTREAM| remote to $REMOTE_URL"
git remote rename origin $REMOTE_BROWSER_UPSTREAM
@@ -179,7 +179,7 @@ fi
# If not, fetch from REMOTE_BROWSER_UPSTREAM and slowly fetch more and more commits
# until we find $BASE_REVISION.
# This technique allows us start with a shallow clone.
-if ! git cat-file -e $BASE_REVISION^{commit} 2>/dev/null; then
+if ! git cat-file -e "$BASE_REVISION"^{commit} 2>/dev/null; then
# Detach git head so that we can fetch into branch.
git checkout --detach >/dev/null 2>/dev/null
@@ -188,9 +188,9 @@ if ! git cat-file -e $BASE_REVISION^{commit} 2>/dev/null; then
SUCCESS="no"
while (( FETCH_DEPTH <= 8192 )); do
echo "Fetching ${FETCH_DEPTH} commits to find base revision..."
- git fetch --depth "${FETCH_DEPTH}" $REMOTE_BROWSER_UPSTREAM $BASE_BRANCH
+ git fetch --depth "${FETCH_DEPTH}" $REMOTE_BROWSER_UPSTREAM "$BASE_BRANCH"
FETCH_DEPTH=$(( FETCH_DEPTH * 2 ));
- if git cat-file -e $BASE_REVISION^{commit} >/dev/null; then
+ if git cat-file -e "$BASE_REVISION"^{commit} >/dev/null; then
SUCCESS="yes"
break;
fi
@@ -204,7 +204,7 @@ fi
echo "-- checking $FRIENDLY_CHECKOUT_PATH repo has BASE_REVISION (@$BASE_REVISION) commit - OK"
# Check out the $BASE_REVISION
-git checkout $BASE_REVISION
+git checkout "$BASE_REVISION"
# Create a playwright-build branch and apply all the patches to it.
if git show-ref --verify --quiet refs/heads/playwright-build; then
@@ -212,7 +212,7 @@ if git show-ref --verify --quiet refs/heads/playwright-build; then
fi
git checkout -b playwright-build
echo "-- applying patches"
-git apply --index --whitespace=nowarn $PATCHES_PATH/*
+git apply --index --whitespace=nowarn "$PATCHES_PATH"/*
if [[ ! -z "${WEBKIT_EXTRA_FOLDER_PATH}" ]]; then
echo "-- adding WebKit embedders"
@@ -222,8 +222,8 @@ if [[ ! -z "${WEBKIT_EXTRA_FOLDER_PATH}" ]]; then
echo "ERROR: $EMBEDDER_DIR already exists! Remove it and re-run the script."
exit 1
fi
- cp -r "${WEBKIT_EXTRA_FOLDER_PATH}" $EMBEDDER_DIR
- git add $EMBEDDER_DIR
+ cp -r "${WEBKIT_EXTRA_FOLDER_PATH}" "$EMBEDDER_DIR"
+ git add "$EMBEDDER_DIR"
elif [[ ! -z "${FIREFOX_EXTRA_FOLDER_PATH}" ]]; then
echo "-- adding juggler"
EMBEDDER_DIR="$PWD/juggler"
@@ -232,8 +232,8 @@ elif [[ ! -z "${FIREFOX_EXTRA_FOLDER_PATH}" ]]; then
echo "ERROR: $EMBEDDER_DIR already exists! Remove it and re-run the script."
exit 1
fi
- cp -r "${FIREFOX_EXTRA_FOLDER_PATH}" $EMBEDDER_DIR
- git add $EMBEDDER_DIR
+ cp -r "${FIREFOX_EXTRA_FOLDER_PATH}" "$EMBEDDER_DIR"
+ git add "$EMBEDDER_DIR"
fi
git commit -a --author="playwright-devops <[email protected]>" -m "chore($1): bootstrap build #$BUILD_NUMBER"
diff --git a/browser_patches/send_telegram_message.sh b/browser_patches/send_telegram_message.sh
index 7fb4bd248c..22155a0c3d 100644
--- a/browser_patches/send_telegram_message.sh
+++ b/browser_patches/send_telegram_message.sh
@@ -10,5 +10,5 @@ send_telegram_message() {
-X POST \
-H 'Content-Type: application/json' \
-d '{"disable_web_page_preview": true, "chat_id": "-1001225613794", "parse_mode": "html", "text": "'"$TEXT"'", "disable_notification": false}' \
- https://api.telegram.org/bot$TELEGRAM_BOT_KEY/sendMessage >/dev/null
+ https://api.telegram.org/bot"$TELEGRAM_BOT_KEY"/sendMessage >/dev/null
}
diff --git a/browser_patches/upload.sh b/browser_patches/upload.sh
index a7609efe5c..568f683029 100755
--- a/browser_patches/upload.sh
+++ b/browser_patches/upload.sh
@@ -6,9 +6,9 @@ trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
- echo "usage: $(basename $0) [BLOB-PATH] [--check|ZIP-PATH]"
+ echo "usage: $(basename "$0") [BLOB-PATH] [--check|ZIP-PATH]"
echo
- echo "Upload ZIP-PATH to BLOB-PATH in `builds` container."
+ echo "Upload ZIP-PATH to BLOB-PATH in 'builds' container."
echo
echo "--check pass |--check| as a second parameter instead of a zip-path to check for"
echo " existance of BLOB-PATH"
@@ -27,7 +27,7 @@ fi
if [[ $# < 2 ]]; then
echo "not enought arguments!"
- echo "try '$(basename $0) --help' for more information"
+ echo "try '$(basename "$0") --help' for more information"
exit 1
fi
@@ -35,7 +35,7 @@ BLOB_PATH="$1"
ZIP_PATH="$2"
if [[ ("$2" == '--check') ]]; then
- EXISTS=$(az storage blob exists -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -n "$BLOB_PATH" --query "exists")
+ EXISTS=$(az storage blob exists -c builds --account-key "$AZ_ACCOUNT_KEY" --account-name "$AZ_ACCOUNT_NAME" -n "$BLOB_PATH" --query "exists")
if [[ $EXISTS == "true" ]]; then
exit 0
else
@@ -53,11 +53,11 @@ if [[ "${ZIP_PATH}" != *.zip && "${ZIP_PATH}" != *.gz ]]; then
fi
if [[ $(uname) == MINGW* ]]; then
# Convert POSIX path to MSYS
- WIN_PATH=$({ cd $(dirname $ZIP_PATH) && pwd -W; } | sed 's|/|\\|g')
- WIN_PATH="${WIN_PATH}\\$(basename $ZIP_PATH)"
- az storage blob upload -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -f $WIN_PATH -n $BLOB_PATH
+ WIN_PATH=$({ cd $(dirname "$ZIP_PATH") && pwd -W; } | sed 's|/|\\|g')
+ WIN_PATH="${WIN_PATH}\\$(basename "$ZIP_PATH")"
+ az storage blob upload -c builds --account-key "$AZ_ACCOUNT_KEY" --account-name "$AZ_ACCOUNT_NAME" -f "$WIN_PATH" -n "$BLOB_PATH"
else
- az storage blob upload -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -f $ZIP_PATH -n "$BLOB_PATH"
+ az storage blob upload -c builds --account-key "$AZ_ACCOUNT_KEY" --account-name "$AZ_ACCOUNT_NAME" -f "$ZIP_PATH" -n "$BLOB_PATH"
fi
echo "UPLOAD SUCCESSFUL!"
diff --git a/browser_patches/webkit/archive.sh b/browser_patches/webkit/archive.sh
index 82668340ca..636eba7785 100755
--- a/browser_patches/webkit/archive.sh
+++ b/browser_patches/webkit/archive.sh
@@ -3,7 +3,7 @@ set -e
set +x
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
- echo "usage: $(basename $0) [output-absolute-path]"
+ echo "usage: $(basename "$0") [output-absolute-path]"
echo
echo "Generate distributable .zip archive from ./checkout folder that was previously built."
echo
@@ -23,7 +23,7 @@ if [[ -f $ZIP_PATH ]]; then
echo "ERROR: path $ZIP_PATH exists; can't do anything."
exit 1
fi
-if ! [[ -d $(dirname $ZIP_PATH) ]]; then
+if ! [[ -d $(dirname "$ZIP_PATH") ]]; then
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
exit 1
fi
@@ -53,27 +53,27 @@ main() {
createZipForLinux() {
# create a TMP directory to copy all necessary files
local tmpdir=$(mktemp -d -t webkit-deploy-XXXXXXXXXX)
- mkdir -p $tmpdir
+ mkdir -p "$tmpdir"
# copy runner
- cp -t $tmpdir $SCRIPTS_DIR/pw_run.sh
+ cp -t "$tmpdir" "$SCRIPTS_DIR"/pw_run.sh
# copy protocol
- node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json
+ node "$SCRIPTS_DIR"/concat_protocol.js > "$tmpdir"/protocol.json
# Generate and unpack MiniBrowser bundles for each port
for port in gtk wpe; do
WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/${port^^} Tools/Scripts/generate-bundle \
--bundle=MiniBrowser --release \
- --platform=${port} --destination=${tmpdir}
- unzip ${tmpdir}/MiniBrowser_${port}_release.zip -d ${tmpdir}/minibrowser-${port}
- rm -f ${tmpdir}/MiniBrowser_${port}_release.zip
+ --platform=${port} --destination="${tmpdir}"
+ unzip "${tmpdir}"/MiniBrowser_${port}_release.zip -d "${tmpdir}"/minibrowser-${port}
+ rm -f "${tmpdir}"/MiniBrowser_${port}_release.zip
done
# tar resulting directory and cleanup TMP.
- cd $tmpdir
- zip --symlinks -r $ZIP_PATH ./
+ cd "$tmpdir"
+ zip --symlinks -r "$ZIP_PATH" ./
cd -
- rm -rf $tmpdir
+ rm -rf "$tmpdir"
}
# see https://docs.microsoft.com/en-us/visualstudio/install/tools-for-managing-visual-studio-instances?view=vs-2019
@@ -90,25 +90,25 @@ printMSVCRedistDir() {
createZipForWindows() {
# create a TMP directory to copy all necessary files
local tmpdir="/tmp/webkit-deploy-$(date +%s)"
- mkdir -p $tmpdir
+ mkdir -p "$tmpdir"
- cp -t $tmpdir ./WebKitLibraries/win/bin64/*.dll
+ cp -t "$tmpdir" ./WebKitLibraries/win/bin64/*.dll
cd WebKitBuild/Release/bin64
- cp -r -t $tmpdir WebKit.resources
- cp -t $tmpdir JavaScriptCore.dll PlaywrightLib.dll WTF.dll WebKit2.dll libEGL.dll libGLESv2.dll
- cp -t $tmpdir Playwright.exe WebKitNetworkProcess.exe WebKitWebProcess.exe
+ cp -r -t "$tmpdir" WebKit.resources
+ cp -t "$tmpdir" JavaScriptCore.dll PlaywrightLib.dll WTF.dll WebKit2.dll libEGL.dll libGLESv2.dll
+ cp -t "$tmpdir" Playwright.exe WebKitNetworkProcess.exe WebKitWebProcess.exe
cd -
cd "$(printMSVCRedistDir)"
- cp -t $tmpdir msvcp140.dll vcruntime140.dll vcruntime140_1.dll msvcp140_2.dll
+ cp -t "$tmpdir" msvcp140.dll vcruntime140.dll vcruntime140_1.dll msvcp140_2.dll
cd -
# copy protocol
- node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json
+ node "$SCRIPTS_DIR"/concat_protocol.js > "$tmpdir"/protocol.json
# tar resulting directory and cleanup TMP.
- cd $tmpdir
- zip -r $ZIP_PATH ./
+ cd "$tmpdir"
+ zip -r "$ZIP_PATH" ./
cd -
- rm -rf $tmpdir
+ rm -rf "$tmpdir"
}
createZipForMac() {
@@ -116,28 +116,28 @@ createZipForMac() {
local tmpdir=$(mktemp -d)
# copy all relevant files
- ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.Networking.xpc
- ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.Plugin.64.xpc
- ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.WebContent.xpc
- ditto {./WebKitBuild/Release,$tmpdir}/JavaScriptCore.framework
- ditto {./WebKitBuild/Release,$tmpdir}/libANGLE-shared.dylib
- ditto {./WebKitBuild/Release,$tmpdir}/libwebrtc.dylib
- ditto {./WebKitBuild/Release,$tmpdir}/Playwright.app
- ditto {./WebKitBuild/Release,$tmpdir}/PluginProcessShim.dylib
- ditto {./WebKitBuild/Release,$tmpdir}/WebCore.framework
- ditto {./WebKitBuild/Release,$tmpdir}/WebInspectorUI.framework
- ditto {./WebKitBuild/Release,$tmpdir}/WebKit.framework
- ditto {./WebKitBuild/Release,$tmpdir}/WebKitLegacy.framework
- ditto {$SCRIPTS_DIR,$tmpdir}/pw_run.sh
+ ditto {./WebKitBuild/Release,"$tmpdir"}/com.apple.WebKit.Networking.xpc
+ ditto {./WebKitBuild/Release,"$tmpdir"}/com.apple.WebKit.Plugin.64.xpc
+ ditto {./WebKitBuild/Release,"$tmpdir"}/com.apple.WebKit.WebContent.xpc
+ ditto {./WebKitBuild/Release,"$tmpdir"}/JavaScriptCore.framework
+ ditto {./WebKitBuild/Release,"$tmpdir"}/libANGLE-shared.dylib
+ ditto {./WebKitBuild/Release,"$tmpdir"}/libwebrtc.dylib
+ ditto {./WebKitBuild/Release,"$tmpdir"}/Playwright.app
+ ditto {./WebKitBuild/Release,"$tmpdir"}/PluginProcessShim.dylib
+ ditto {./WebKitBuild/Release,"$tmpdir"}/WebCore.framework
+ ditto {./WebKitBuild/Release,"$tmpdir"}/WebInspectorUI.framework
+ ditto {./WebKitBuild/Release,"$tmpdir"}/WebKit.framework
+ ditto {./WebKitBuild/Release,"$tmpdir"}/WebKitLegacy.framework
+ ditto {"$SCRIPTS_DIR","$tmpdir"}/pw_run.sh
# copy protocol
- node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json
+ node "$SCRIPTS_DIR"/concat_protocol.js > "$tmpdir"/protocol.json
# Remove all broken symlinks. @see https://github.com/microsoft/playwright/issues/5472
find "${tmpdir}" -type l ! -exec test -e {} \; -print | xargs rm
# zip resulting directory and cleanup TMP.
- ditto -c -k $tmpdir $ZIP_PATH
- rm -rf $tmpdir
+ ditto -c -k "$tmpdir" "$ZIP_PATH"
+ rm -rf "$tmpdir"
}
trap "cd $(pwd -P)" EXIT
diff --git a/browser_patches/webkit/build.sh b/browser_patches/webkit/build.sh
index 25bd27f53f..1bcac55562 100755
--- a/browser_patches/webkit/build.sh
+++ b/browser_patches/webkit/build.sh
@@ -3,7 +3,7 @@ set -e
set +x
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
SCRIPT_FOLDER="$(pwd -P)"
source "${SCRIPT_FOLDER}/../utils.sh"
@@ -80,7 +80,7 @@ elif [[ "$(uname)" == "Linux" ]]; then
build_wpe
fi
elif [[ "$(uname)" == MINGW* ]]; then
- /c/Windows/System32/cmd.exe "/c $(cygpath -w ${SCRIPT_FOLDER}/buildwin.bat)"
+ /c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwin.bat)"
else
echo "ERROR: cannot upload on this platform!" 1>&2
exit 1;
diff --git a/browser_patches/webkit/clean.sh b/browser_patches/webkit/clean.sh
index e07f6ed152..df9e0467f3 100755
--- a/browser_patches/webkit/clean.sh
+++ b/browser_patches/webkit/clean.sh
@@ -3,7 +3,7 @@ set -e
set +x
trap "cd $(pwd -P)" EXIT
-cd "$(dirname $0)"
+cd "$(dirname "$0")"
if [[ ! -z "${WK_CHECKOUT_PATH}" ]]; then
cd "${WK_CHECKOUT_PATH}"