diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-05-07 21:37:41 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-05-07 21:37:41 +0000 |
commit | 10ea6cc8b454565df086dad5f05c7ff29661880a (patch) | |
tree | 4aff3a7b23e7c5b7afe7abe4bbe842681fbc6dfa | |
parent | 5809ec2a674c4e3d47b5430e208d422286eb382f (diff) | |
parent | 986e73f10f1db4ef3731186905518dff1f341588 (diff) | |
download | extras-10ea6cc8b454565df086dad5f05c7ff29661880a.tar.gz |
Merge "tools/check_elf_alignment.sh: Use double quotes" into main
-rwxr-xr-x | tools/check_elf_alignment.sh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/check_elf_alignment.sh b/tools/check_elf_alignment.sh index 4183c790..b74f34ae 100755 --- a/tools/check_elf_alignment.sh +++ b/tools/check_elf_alignment.sh @@ -40,12 +40,12 @@ if ! [ -f "${dir}" -o -d "${dir}" ]; then exit 1 fi -if [[ ${dir} == *.apk ]]; then +if [[ "${dir}" == *.apk ]]; then trap 'cleanup_trap' EXIT if { zipalign --help 2>&1 | grep -q "\-P <pagesize_kb>"; }; then echo "=== APK zip-alignment ===" - zipalign -v -c -P 16 4 ${dir} | egrep 'lib/arm64-v8a|lib/x86_64|Verification' + zipalign -v -c -P 16 4 "${dir}" | egrep 'lib/arm64-v8a|lib/x86_64|Verification' echo "=========================" else echo "NOTICE: Zip alignment check requires build-tools version 35.0.0-rc3 or higher." @@ -55,10 +55,10 @@ if [[ ${dir} == *.apk ]]; then echo " sdkmanager \"build-tools;35.0.0-rc3\"" fi - dir_filename=$(basename ${dir}) - tmp=$(mktemp -d -t ${dir_filename%.apk}_out_XXXXX) - unzip ${dir} lib/* -d ${tmp} >/dev/null 2>&1 - dir=${tmp} + dir_filename=$(basename "${dir}") + tmp=$(mktemp -d -t "${dir_filename%.apk}_out_XXXXX") + unzip "${dir}" lib/* -d "${tmp}" >/dev/null 2>&1 + dir="${tmp}" fi RED="\e[31m" @@ -70,7 +70,7 @@ unaligned_libs=() echo echo "=== ELF alignment ===" -matches="$(find ${dir} -name "*.so" -type f)" +matches="$(find "${dir}" -name "*.so" -type f)" IFS=$'\n' for match in $matches; do res="$(objdump -p ${match} | grep LOAD | awk '{ print $NF }' | head -1)" @@ -78,7 +78,7 @@ for match in $matches; do echo -e "${match}: ${GREEN}ALIGNED${ENDCOLOR} ($res)" else echo -e "${match}: ${RED}UNALIGNED${ENDCOLOR} ($res)" - unaligned_libs+=(${match}) + unaligned_libs+=("${match}") fi done |