qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Lee Essen" <lee.essen@nowonline.co.uk>,
	"Andreas Färber" <andreas.faerber@web.de>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] fix incorrect bracket in tracetool
Date: Fri, 16 Mar 2012 08:56:20 -0600	[thread overview]
Message-ID: <4F635494.30208@redhat.com> (raw)
In-Reply-To: <4F633DA0.2090900@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1399 bytes --]

On 03/16/2012 07:18 AM, Paolo Bonzini wrote:
> Il 16/03/2012 13:29, Lee Essen ha scritto:
>> @@ -123,7 +123,7 @@ get_argc()
>>  # Get the format string including double quotes for a trace event
>>  get_fmt()
>>  {
>> -    puts "${1#*)}"

This says to call puts with the first argument of get_fmt, except with
the shortest prefix ending in ) omitted.  Or are you complaining that
there is a shell treating this as a syntax error?

>> +    puts "${1#*}"

This says to omit the shortest prefix that matches the glob '*', but
that is always the empty string, so you might as well write it "$1".

>>  }
>>  
> 
> Eric, can you look at this?  Is it a bashism or a Solaris bug?

Solaris /bin/sh lacks support for ${var#pattern}, but POSIX requires it.
 If this is using #!/bin/sh, you aren't portable.

> 
> I would write it, to be entirely safe, as
> 
>    local fmt

local is not portable.

>    fmt=${1#*\)}
>    puts "$fmt"

This looks reasonable, if you were hitting syntax errors on an unquoted
), and if you are sure that you have a POSIX rather than Solaris /bin/sh.

> 
> where I'm using the extra variable to avoid the ambiguity of quoting the
> parentheses within quotes; variable assignments are always implicitly
> quoted.
> 
> Paolo
> 

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

  reply	other threads:[~2012-03-16 14:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16 12:29 [Qemu-devel] [PATCH] fix incorrect bracket in tracetool Lee Essen
2012-03-16 12:44 ` Andreas Färber
2012-03-16 13:00   ` Lee Essen
2012-03-16 13:19     ` Paolo Bonzini
2012-03-16 13:28       ` Andreas Färber
2012-03-16 13:21     ` Andreas Färber
2012-03-16 13:18 ` Paolo Bonzini
2012-03-16 14:56   ` Eric Blake [this message]
2012-03-19 11:59 ` Stefan Hajnoczi
2012-03-19 12:05   ` Lee Essen
2012-03-19 12:32     ` Stefan Hajnoczi
2012-03-19 12:32     ` Andreas Färber
2012-03-19 13:35       ` Lee Essen
2012-03-20 16:59         ` Stefan Hajnoczi
2012-03-20 17:11           ` Lee Essen
2012-03-21  9:52             ` Stefan Hajnoczi
2012-03-19 12:40     ` Stefan Weil
2012-03-19 12:49       ` Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F635494.30208@redhat.com \
    --to=eblake@redhat.com \
    --cc=andreas.faerber@web.de \
    --cc=lee.essen@nowonline.co.uk \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).