qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Bug 636315] [NEW] configure and build errors on Solari


From: Blue Swirl
Subject: Re: [Qemu-devel] [Bug 636315] [NEW] configure and build errors on Solaris 10 due to /bin/sh usage
Date: Tue, 14 Sep 2010 16:41:05 +0000

On Mon, Sep 13, 2010 at 8:49 AM, Michael Tokarev <address@hidden> wrote:
> 13.09.2010 01:05, Blue Swirl wrote:
>> On Sun, Sep 12, 2010 at 5:58 PM, Andreas Färber <address@hidden> wrote:
>>> Am 12.09.2010 um 19:47 schrieb Blue Swirl:
>>>
>>>> On Sun, Sep 12, 2010 at 5:35 PM, Andreas Färber <address@hidden>
>>>> wrote:
>>>>>
>>>>> Am 12.09.2010 um 19:22 schrieb Blue Swirl:
>>>>>
>>>>>> What is the output of "sh ./tracetool --nop --check-backend"?
>>>>>
>>>>> ./tracetool: syntax error at line 51: `$' unexpected
>>>>
>>>> Does this patch fix the problem?
>>>>
>>>> diff --git a/tracetool b/tracetool
>>>> index 534cc70..c7582bf 100755
>>>> --- a/tracetool
>>>> +++ b/tracetool
>>>> @@ -48,7 +48,8 @@ get_argnames()
>>>> {
>>>>    local nfields field name
>>>>    nfields=0
>>>> -    for field in $(get_args "$1"); do
>>>> +    args=get_args "$1"
>>>> +    for field in "$args"; do
>>>
>>> This part yes. (I took the liberty of adding args to the local line above)
>
> Um.  Are you sure it works as expected?  I'm not at all shure.
> There are 2 errors in the above patch:
>
>  +    args=get_args "$1"
>
> After this line, variable $args will contain one word: "get_args".
> Shell will try to execute a command or call a shell function which
> name is stored in $1, if it is assigned.  If it is not, at least
> bash will complain that it can't execute command "".
>
> The proper way is to add backticks:
>
>  +    args=`get_args "$1"`
>
> In the second line:
>
>  +    for field in "$args"; do
>
> the double quotes ensure that all words in $args are
> processed as single word, all at once.  So the for loop
> will be executed exactly one time, no matter how many
> arguments are given (even if there's none).
>
> So the right solution is to drop double quotes.

Do you see any bug with the original?

If the problem is in fact that Solaris' /bin/sh is not standards
compliant, we shouldn't fix the script but instead make sure that the
shell used to run tracetool is the compliant one.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]