[pacman-dev] [PATCH 3/3] makepkg: fix pkgver() function not aborting on errors
Allan McRae
allan at archlinux.org
Wed Aug 29 04:58:21 UTC 2018
On 14/08/18 11:20, Eli Schwartz wrote:
> `run_function_safe pkgver` is evaluated in a subshell and therefore does
> not abort when it should. Explicitly check the return outside of the
> subshell and abort if necessary.
>
> Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
> ---
> scripts/makepkg.sh.in | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index bb24c633..1ab2ea3c 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -188,6 +188,9 @@ enter_fakeroot() {
> # Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
> update_pkgver() {
> newpkgver=$(run_function_safe pkgver)
> + if (( $? != 0 )); then
> + error_function pkgver
> + fi
> if ! check_pkgver "$newpkgver"; then
> error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver"
> exit $E_PKGBUILD_ERROR
>
OK.
Also, this looks like another reason to special case running pkgver()
which would allow us to cature its output only.
A
More information about the pacman-dev
mailing list