[OpenBIOS] [PATCH] switch-arch: removes non-standard "local" keyword

Blue Swirl blauwirbel at gmail.com
Sun May 22 18:44:23 CEST 2011


On Sun, May 22, 2011 at 7:05 PM, Kenneth Salerno
<kennethsalerno at yahoo.com> wrote:
> ----- Original Message -----
>
> From: Blue Swirl <blauwirbel at gmail.com>
> To: The OpenBIOS Mailinglist <openbios at openbios.org>
> Cc:
> Sent: Sunday, May 22, 2011 5:39 AM
> Subject: Re: [OpenBIOS] Solaris anyone? Q2
>
> On Sun, May 22, 2011 at 2:11 AM, Kenneth Salerno
> <kennethsalerno at yahoo.com> wrote:
>> ----- Original Message -----
>>
>> From: Paul Brook <paul at nowt.org>
>> To: openbios at openbios.org
>> Cc: Nathan Kunkee <nkunkee42 at hotmail.com>
>> Sent: Wednesday, May 4, 2011 7:19 PM
>> Subject: Re: [OpenBIOS] Solaris anyone? Q2
>>
>>> >   crosscflags()
>>> >   {
>>> >
>>> > -    local host=$1
>>> > -    local target=$2
>>> > +    host=$1
>>> > +    target=$2
>>> >
>>>
>>> Confirmed; this produces the correct result with /bin/sh (ksh93), bash,
>>> and /usr/xpg4/bin/sh.
>>
>> Have you tried separating the declaration and the definition. i.e.:
>>
>> local host
>> host=$1
>>
>> IIRC there are sometimes issues when you combine the two.
>>
>> Paul
>>
>> --
>> OpenBIOS                 http://openbios.org/
>> Mailinglist:  http://lists.openbios.org/mailman/listinfo
>> Free your System - May the Forth be with you
>>
>>
>> Yes, I have tried that. Korn Shell '93 (ksh93) does not include the builtin "local", that is bash/zsh-specific:
>>
>> kens at sunos:~$ ken() {
>>> local kenny
>>> kenny=1
>>> }
>> kens at sunos:~$ ken
>> /bin/sh[2]: local: not found [No such file or directory]
>> kens at sunos:~$ type local
>> /bin/sh: whence: local: not found
>> kens at sunos:~$  ^D
>> 11:04 PM kens at sunos$ type local
>> local is a shell builtin
>>
>>
>> Also there really is no need to rename the variables from host and target because they're not used for any unrelated purposes elsewhere in switch-arch.
>>
>> The patch I had submitted is valid.
>
> It looks like 'local' is a non-standard extension:
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
>
> Please submit the patch with a description and Signed-off-by: line.
>
> --
> OpenBIOS                http://openbios.org/
> Mailinglist:  http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
>
>
>
> Description: removes the non-standard "local" keyword from within the crosscflags() function. This was not necessary since the variables "host" and "target" were not clobbered anywhere outside of the function, but the real motivation is to support shells such as ksh93 that do not have the "local" builtin like bash.

Thanks, applied.

In the future, please submit the patches separately without the
previous discussions. The idea is that it should be possible to use
'git am' without editing the message at all and the result should look
like a proper commit with a subject line and commit description.

>
> Signed-off-by: Kenneth Salerno <kennethsalerno at yahoo.com>
> ---
>
> --- switch-arch.orig    2011-05-02 20:54:43.312500000 -0400
> +++ switch-arch 2011-05-02 20:56:05.093750000 -0400
> @@ -19,8 +19,8 @@
>
>  crosscflags()
>  {
> -    local host=$1
> -    local target=$2
> +    host=$1
> +    target=$2
>
>      if test "$host" = "powerpc" -o "$host" = "ppc" \
>          -o "$host" = "mips" -o "$host" = "s390" \
>
>
> --
>
> Thanks,
> Ken
>
>
> --
> OpenBIOS                 http://openbios.org/
> Mailinglist:  http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
>



More information about the OpenBIOS mailing list