From a720feba2fec5cde96542ecda1fdc73aa5cf0558 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sun, 16 Jul 2023 18:34:31 +0330 Subject: [PATCH] Meta: Pass -- to sudo instead of '$SHELL -c' in build scripts fddbd11baa97295d903834bacf7280857256b1ba made it so the command executed read `sh -c -- '"script" args*'`, the -- in this command is redundant as the script name never starts with a dash and can never be interpreted as an option or a flag. The actually meaningful placement for -- here is after `$SUDO`, to make sure `$SUDO` does not incorrectly treat `-c` as an option to itself, and `$SHELL` cannot be interpreted as an option/flag in the extremely unlikely event that it starts with a dash. --- Meta/build-image-extlinux.sh | 2 +- Meta/build-image-grub.sh | 2 +- Meta/build-image-limine.sh | 2 +- Meta/build-image-qemu.sh | 4 ++-- Meta/build-native-partition.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Meta/build-image-extlinux.sh b/Meta/build-image-extlinux.sh index a45ab456896..f6af37224bc 100755 --- a/Meta/build-image-extlinux.sh +++ b/Meta/build-image-extlinux.sh @@ -8,7 +8,7 @@ script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) if [ "$(id -u)" != 0 ]; then set +e - ${SUDO} "${SHELL}" -c -- "\"$0\" $* || exit 42" + ${SUDO} -- "${SHELL}" -c "\"$0\" $* || exit 42" case $? in 1) die "this script needs to run as root" diff --git a/Meta/build-image-grub.sh b/Meta/build-image-grub.sh index 6d26e3a3e6f..89e8d0ab070 100755 --- a/Meta/build-image-grub.sh +++ b/Meta/build-image-grub.sh @@ -8,7 +8,7 @@ script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) if [ "$(id -u)" != 0 ]; then set +e - ${SUDO} "${SHELL}" -c -- "\"$0\" $* || exit 42" + ${SUDO} -- "${SHELL}" -c "\"$0\" $* || exit 42" case $? in 1) die "this script needs to run as root" diff --git a/Meta/build-image-limine.sh b/Meta/build-image-limine.sh index c3fd17e835d..10246c30fbd 100755 --- a/Meta/build-image-limine.sh +++ b/Meta/build-image-limine.sh @@ -17,7 +17,7 @@ fi if [ "$(id -u)" != 0 ]; then set +e - ${SUDO} "${SHELL}" -c -- "\"$0\" $* || exit 42" + ${SUDO} -- "${SHELL}" -c "\"$0\" $* || exit 42" case $? in 1) die "this script needs to run as root" diff --git a/Meta/build-image-qemu.sh b/Meta/build-image-qemu.sh index 49c5e1262cb..16b3310760b 100755 --- a/Meta/build-image-qemu.sh +++ b/Meta/build-image-qemu.sh @@ -12,7 +12,7 @@ if [ "$(id -u)" != 0 ]; then USE_FUSE2FS=1 else set +e - ${SUDO} "${SHELL}" -c -- "\"$0\" $* || exit 42" + ${SUDO} -- "${SHELL}" -c "\"$0\" $* || exit 42" case $? in 1) die "this script needs to run as root" @@ -70,7 +70,7 @@ nearest_power_of_2() { echo $p } if [ "$SERENITY_ARCH" = "aarch64" ] || { [ -n "$SERENITY_USE_SDCARD" ] && [ "$SERENITY_USE_SDCARD" -eq 1 ]; }; then - # SD cards must have a size that is a power of 2. The Aarch64 port loads from an SD card. + # SD cards must have a size that is a power of 2. The Aarch64 port loads from an SD card. DISK_SIZE_BYTES=$(nearest_power_of_2 "$DISK_SIZE_BYTES") fi diff --git a/Meta/build-native-partition.sh b/Meta/build-native-partition.sh index c79f6a052a5..2cc62f5dae6 100755 --- a/Meta/build-native-partition.sh +++ b/Meta/build-native-partition.sh @@ -16,7 +16,7 @@ cleanup() { if [ "$(id -u)" != 0 ]; then set +e - ${SUDO} "${SHELL}" -c -- "\"$0\" $* || exit 42" + ${SUDO} -- "${SHELL}" -c "\"$0\" $* || exit 42" case $? in 1) die "this script needs to run as root"