[pacman-dev] [PATCH 3/3] makepkg: fix pkgver() function not aborting on errors

Eli Schwartz eschwartz at archlinux.org
Tue Aug 14 02:49:51 UTC 2018


On 8/13/18 10:13 PM, Luke Shumaker wrote:
> On Mon, 13 Aug 2018 21:20:58 -0400,
> Eli Schwartz wrote:
>> 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
> 
> Why bring $? in to it, why not:
> 
>     if ! newpkgver=$(run_function_safe pkgver); then
>         error_function pkgver
>     fi

Because that is a complex command and therefore forces errexit to be
ignored, hence it will always be successful.

Otherwise I would have simply used ||

Say thank you to http://austingroupbugs.net/view.php?id=537aa

-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20180813/d9d697a9/attachment-0001.asc>


More information about the pacman-dev mailing list