From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US5kG-0004qA-SM for qemu-devel@nongnu.org; Tue, 16 Apr 2013 09:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1US5k8-0000Dr-EB for qemu-devel@nongnu.org; Tue, 16 Apr 2013 09:16:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US5k8-0000DB-8W for qemu-devel@nongnu.org; Tue, 16 Apr 2013 09:16:16 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3GDGFnT027751 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 16 Apr 2013 09:16:15 -0400 Date: Tue, 16 Apr 2013 15:16:11 +0200 From: Stefan Hajnoczi Message-ID: <20130416131611.GA25650@stefanha-thinkpad.redhat.com> References: <1366105701-7968-1-git-send-email-kwolf@redhat.com> <516D437E.7000907@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <516D437E.7000907@redhat.com> Subject: Re: [Qemu-devel] [PATCH] qemu-iotests: Fix _filter_qemu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , qemu-devel@nongnu.org On Tue, Apr 16, 2013 at 06:26:38AM -0600, Eric Blake wrote: > On 04/16/2013 03:48 AM, Kevin Wolf wrote: > > $QEMU_PROG happens to be 'qemu' in my setup, so this sed command > > replaces a bit too much. Restrict it to the start of the line and to > > when it's followed by a colon, i.e. the form used by error messages. > > > > Signed-off-by: Kevin Wolf > > --- > > tests/qemu-iotests/common.filter | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter > > index bc5f250..a7f889a 100644 > > --- a/tests/qemu-iotests/common.filter > > +++ b/tests/qemu-iotests/common.filter > > @@ -155,7 +155,7 @@ _filter_qemu_io() > > # replace occurrences of QEMU_PROG with "qemu" > > _filter_qemu() > > { > > - sed -e "s#$(basename $QEMU_PROG)#QEMU_PROG#g" > > + sed -e "s#^$(basename $QEMU_PROG):#QEMU_PROG:#g" > > Why spawn a basename process, when you can use shell to do the same? > Also, the g modifier is worthless once you have a ^ anchor, since sed > can only replace one ^ per line. And you don't need sed's -e option for > a single script. sed -e is the convention in qemu-iotests. Dropping the 'g' would be nice. The problem with the POSIX shell string replacement is that the syntax is horrible. I can never remember what ${%}, ${%%}, ${#} and %{##} do. $(basename $QEMU_PROG) is clear (although it doesn't handle spaces in the filename!). Reviewed-by: Stefan Hajnoczi