[pacman-dev] [PATCH] makepkg: quote arrays in order to preserve spaces in array items

Cedric Staniewski cedric at gmx.ca
Fri Nov 6 11:16:57 EST 2009


Isaac Good wrote:
>> Fixes FS#16871.
>>
>> Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
>> ---
>>  scripts/makepkg.sh.in |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 92b0454..8ca89e1 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -1315,7 +1315,7 @@ devel_update() {
>>  backup_package_variables() {
>>      for var in ${splitpkg_overrides[@]}; do
>>          indirect="${var}_backup"
>> -        eval "${indirect}=(\${$var[@]})"
>> +        eval "${indirect}=(\"\${$var[@]}\")"
>>      done
>>  }
>> @@ -1323,7 +1323,7 @@ restore_package_variables() {
>>      for var in ${splitpkg_overrides[@]}; do
>>          indirect="${var}_backup"
>>          if [ -n "${!indirect}" ]; then
>> -            eval "${var}=(\${$indirect[@]})"
>> +            eval "${var}=(\"\${$indirect[@]}\")"
>>          else
>>              unset ${var}
>>          fi
> 
> I'm not familiar with this segment of the code, but I feel compelled to point out that, while making a patch to fix issues with spaces in arrays, you fail to preserve spaces in splitpkg_overrides. The code should have:
> 
> -      for var in ${splitpkg_overrides[@]}; do
> +      for var in "${splitpkg_overrides[@]}"; do

I thought about that too, but decided against it because I suspect we will never have variable names which contain spaces. So it does not matter, but feel free to 'fix' it in a add-quotes-everywhere-patch.

> splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \
>                     'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \
>                     'backup' 'options' 'install' 'changelog')


More information about the pacman-dev mailing list