[pacman-dev] [PATCH] makepkg: revert bash4-ism

Allan McRae allan at archlinux.org
Sun Jun 20 21:51:49 EDT 2010


On 21/06/10 03:31, Andres P wrote:
> On Sun, Jun 20, 2010 at 9:00 AM, Allan McRae<allan at archlinux.org>  wrote:
>> Commit 3d67d9b1 introduced a bash4 string manipulation.  Revert that
>> in order retain compatibility with bash-3.2 which is still widely
>> used.
>>
>> Signed-off-by: Allan McRae<allan at archlinux.org>
>> ---
>>
>> This is for the maint branch
>>
>>   scripts/makepkg.sh.in |    2 +-
>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index c6bc738..3bc6019 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -1665,7 +1665,7 @@ if (( CLEANCACHE )); then
>>                 echo -n "$(gettext "    Are you sure you wish to do this? ")"
>>                 echo -n "$(gettext "[y/N]")"
>>                 read answer
>> -               answer="${answer^^}"
>> +               answer=$(echo $answer | tr '[:lower:]' '[:upper:]')
>
> Before you change all of these to tr(1), please use a here-string
> instead of a less elegant `echo | foo` subshell.
>
> $ tr '[lower:]' '[upper:]'<<<"$answer"
>
> Notice that answer should be quoted because it's unfiltered user data...
>
> And also keep in mind that most situations were echo | foo would be
> used in makepkg are already using a here-string.
>
> here-strings (<<<) are bash32 compat.
>

patch adjusted on my working-maint branch.
Allan


More information about the pacman-dev mailing list