Fix globbing issue in lbmk

When doing e.g. $@ we should use double quotes to prevent globbing.

Thanks go to XRevan86 for pointing this out.

Signed-off-by: Leah Rowe <leah@libreboot.org>
master
Leah Rowe 2024-12-30 00:50:53 +00:00
parent c80cc0a00b
commit e565df94fd
4 changed files with 10 additions and 10 deletions

12
build
View File

@ -32,16 +32,16 @@ main()
case "${spath#script/}" in case "${spath#script/}" in
version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;; version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;;
release) shift 1; mkrelease $@ ;; release) shift 1; mkrelease "$@" ;;
inject) shift 1; vendor_inject $@ ;; inject) shift 1; vendor_inject "$@" ;;
download) shift 1; vendor_download $@ ;; download) shift 1; vendor_download "$@" ;;
roms) roms)
[ $# -gt 1 ] && [ "$2" = "serprog" ] && \ [ $# -gt 1 ] && [ "$2" = "serprog" ] && \
mk -b stm32-vserprog pico-serprog && return 0 mk -b stm32-vserprog pico-serprog && return 0
shift 1; x_ ./mk -b coreboot $@ ;; shift 1; x_ ./mk -b coreboot "$@" ;;
*) *)
[ -f "$spath" ] || $err "bad command" [ -f "$spath" ] || $err "bad command"
$shcmd; "$spath" $@ || $err "excmd: $spath $(echo "$@")" ;; $shcmd; "$spath" "$@" || $err "excmd: $spath $(echo "$@")" ;;
esac esac
set -u -e # some commands disable them. turn them on! set -u -e # some commands disable them. turn them on!
} }
@ -128,5 +128,5 @@ tmp_cleanup()
rm -f lock || return 1 rm -f lock || return 1
} }
main $@ main "$@"
tmp_cleanup || err_ "can't rm TMPDIR upon non-zero exit: $TMPDIR" tmp_cleanup || err_ "can't rm TMPDIR upon non-zero exit: $TMPDIR"

View File

@ -115,7 +115,7 @@ tmpclone()
git_am_patches "$3" "$5" git_am_patches "$3" "$5"
) || repofail="y" ) || repofail="y"
[ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone $@ retry [ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry
[ "$repofail" = "y" ] && $err "!clone $1 $2 $3 $4 $5"; : [ "$repofail" = "y" ] && $err "!clone $1 $2 $3 $4 $5"; :
} }

View File

@ -80,7 +80,7 @@ install_packages()
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; return 0 printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; return 0
} }
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
install_packages $@ || exit 1 install_packages "$@" || exit 1
exit 0 exit 0
fi fi
@ -119,7 +119,7 @@ expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \
1>/dev/null 2>/dev/null || export XBMK_THREADS=1 # user gave a non-integer 1>/dev/null 2>/dev/null || export XBMK_THREADS=1 # user gave a non-integer
x_() { x_() {
[ $# -lt 1 ] || $@ || \ [ $# -lt 1 ] || "$@" || \
$err "Unhandled non-zero exit: $(echo "$@")"; return 0 $err "Unhandled non-zero exit: $(echo "$@")"; return 0
} }

View File

@ -294,6 +294,6 @@ copy_elf()
done < "$listfile"; x_ make clean -C "$srcdir" $cleanargs done < "$listfile"; x_ make clean -C "$srcdir" $cleanargs
} }
main $@ || exit 0 main "$@" || exit 0
. "$mkhelpercfg" . "$mkhelpercfg"
$cmd $cmd