qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Lee Essen <lee.essen@nowonline.co.uk>
Cc: "Stefan Hajnoczi" <stefanha@gmail.com>,
	"Alon Levy" <alevy@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Lluís Vilanova" <vilanova@ac.upc.edu>
Subject: Re: [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words
Date: Wed, 28 Mar 2012 10:38:25 -0600	[thread overview]
Message-ID: <4F733E81.4010805@redhat.com> (raw)
In-Reply-To: <901A5263-0998-4A6F-B5B2-0C9806B8CA1E@nowonline.co.uk>

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

On 03/28/2012 10:26 AM, Lee Essen wrote:

>> +        # 'limit', 'in' and 'next' are reserved keywords
>> +        if [ "$arg" = "limit" -o "$arg" = "in" -o "$arg" = "next" ]; then

[ ... -o ... ] is not portable.  POSIX says you must break it into:
[ ... ] || [ ... ]

or, more efficiently for this particular filtering, rewrite this as:

# munge reserved words
case $arg in
  limit | in | next ) arg=_$arg ;;
esac

> 
> Could we add 'self' to this list?

and using case makes it easier to add more reserved words:

case $arg in
  limit | in | next | self ) arg=_$arg ;;
esac

-- 
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-28 16:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-28  7:55 [Qemu-devel] [PATCH trivial] trace-events: don't use dtrace reserved words in and next Alon Levy
2012-03-28 12:55 ` Stefan Hajnoczi
2012-03-28 13:16   ` Alon Levy
2012-03-28 13:33     ` Alon Levy
2012-03-28 13:35       ` Stefan Hajnoczi
2012-03-28 14:26     ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Alon Levy
2012-03-28 14:26       ` [Qemu-devel] [PATCH 2/2] tracetool: dtrace: warn on reserved word usage Alon Levy
2012-03-28 16:26       ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Lee Essen
2012-03-28 16:38         ` Eric Blake [this message]
2012-03-28 16:43       ` Peter Maydell

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=4F733E81.4010805@redhat.com \
    --to=eblake@redhat.com \
    --cc=alevy@redhat.com \
    --cc=lee.essen@nowonline.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=vilanova@ac.upc.edu \
    /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).