qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] fix incorrect bracket in tracetool


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] fix incorrect bracket in tracetool
Date: Fri, 16 Mar 2012 08:56:20 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

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   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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