[pacman-dev] [PATCH 2/2] makepkg: allow to substitute with existing vars

Dave Reisner d at falconindy.com
Thu Oct 3 08:08:16 EDT 2013


On Thu, Oct 03, 2013 at 03:49:34PM +0800, Techlive Zheng wrote:
> ---
>  scripts/makepkg.sh.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index f6d884f..1736dc7 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -2809,7 +2809,7 @@ fi
>  
>  # override settings from extra variables on commandline, if any
>  if (( ${#extra_environment[*]} )); then
> -	export "${extra_environment[@]}"
> +	eval export "${extra_environment[@]}"

NAK. The intention was for the extra args on the commandline to be
treated exactly as make treats them. Doing this introduces an
(undocumented) layer of indirection that would not be easily discernable
at a glance, and probably result in some very unexpected behavior.

Simple example: your change has no regard for whitespace, so something
like CFLAGS='-O2 -g' will abort strangely:

/home/noclaf/src/up/pacman/scripts/makepkg: line 2851: export:
`-Wnotvalid': not a valid identifier

You'd need to pass CFLAGS='-O2\ -g' which is unexpected and potentially
awkward. Consider the case where the value comes from somewhere other
than a string literal.

The whitespace concerns could be fixed, but I really don't think this is
generally a road we want to go down.

>  fi
>  
>  # set pkgdir to something "sensible" for (not recommended) use during build()
> -- 
> 1.8.4
> 
> 


More information about the pacman-dev mailing list