On 01/06/18 10:31, Eli Schwartz wrote:
> In commit 9e52a36794552b77ecf26f7f34b226d096978f1e the split package
> metadata backup/restore was refactored to use declare, which actually
> declares variables in a local scope when in a function. This did not
> play nicely with debug packages, which unset most metadata variables,
> thereby reverting to the global scope rather than resulting in unset
> metadata.
> 
> Fix by explicitly marking the variables as global.
> 

This requires bash-4.2.   We released pacman-5.1 with bash-4.1 as the
minimum required version.

This might work:

printf '%s\n' "printf -v \"$var\" \"${!var}\""


> Signed-off-by: Eli Schwartz <eschwa...@archlinux.org>
> ---
>  scripts/makepkg.sh.in | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 21737af8..fe3891ce 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1124,7 +1124,12 @@ check_build_status() {
>  backup_package_variables() {
>       local var
>       for var in ${splitpkg_overrides[@]}; do
> -             declare -p $var 2>/dev/null || printf '%s\n'  "unset $var"
> +             if [[ ${!var} ]]; then
> +                     printf '%s\n' "declare -g $var"
> +                     declare -p $var
> +             else
> +                     printf '%s\n'  "unset $var"
> +             fi
>       done
>  }
>  
> 

Reply via email to