From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=54010 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvYh7-0006F2-49 for qemu-devel@nongnu.org; Tue, 14 Sep 2010 12:49:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvYh5-0006Oa-A1 for qemu-devel@nongnu.org; Tue, 14 Sep 2010 12:49:20 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:47675) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvYh5-0006OU-7u for qemu-devel@nongnu.org; Tue, 14 Sep 2010 12:49:19 -0400 Received: by qwk4 with SMTP id 4so2301517qwk.4 for ; Tue, 14 Sep 2010 09:49:18 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4C8DE5AE.7040402@msgid.tls.msk.ru> References: <20100912112636.2648.27149.malonedeb@potassium.ubuntu.com> <1C12421B-DC91-471B-A285-7501CA61CE3E@web.de> <577C53A8-9AA7-4D71-98EF-A75F93A4F74B@web.de> <4C8DE5AE.7040402@msgid.tls.msk.ru> From: Blue Swirl Date: Tue, 14 Sep 2010 16:41:05 +0000 Message-ID: Subject: Re: [Qemu-devel] [Bug 636315] [NEW] configure and build errors on Solaris 10 due to /bin/sh usage Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: =?UTF-8?Q?Andreas_F=C3=A4rber?= , Bug 636315 <636315@bugs.launchpad.net>, qemu-devel@nongnu.org On Mon, Sep 13, 2010 at 8:49 AM, Michael Tokarev wrote: > 13.09.2010 01:05, Blue Swirl wrote: >> On Sun, Sep 12, 2010 at 5:58 PM, Andreas F=C3=A4rber wrote: >>> Am 12.09.2010 um 19:47 schrieb Blue Swirl: >>> >>>> On Sun, Sep 12, 2010 at 5:35 PM, Andreas F=C3=A4rber >>>> 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() >>>> { >>>> =C2=A0 =C2=A0local nfields field name >>>> =C2=A0 =C2=A0nfields=3D0 >>>> - =C2=A0 =C2=A0for field in $(get_args "$1"); do >>>> + =C2=A0 =C2=A0args=3Dget_args "$1" >>>> + =C2=A0 =C2=A0for field in "$args"; do >>> >>> This part yes. (I took the liberty of adding args to the local line abo= ve) > > Um. =C2=A0Are you sure it works as expected? =C2=A0I'm not at all shure. > There are 2 errors in the above patch: > > =C2=A0+ =C2=A0 =C2=A0args=3Dget_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. =C2=A0If it is not, at least > bash will complain that it can't execute command "". > > The proper way is to add backticks: > > =C2=A0+ =C2=A0 =C2=A0args=3D`get_args "$1"` > > In the second line: > > =C2=A0+ =C2=A0 =C2=A0for field in "$args"; do > > the double quotes ensure that all words in $args are > processed as single word, all at once. =C2=A0So 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.