qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] scripts: Add a script to check for bug URLs


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCH v2] scripts: Add a script to check for bug URLs in the git log
Date: Wed, 14 Sep 2016 23:02:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

On 14.09.2016 16:44, Eric Blake wrote:
> On 09/14/2016 05:35 AM, Thomas Huth wrote:
>> Erik,
> 
> It's Eric, but don't sweat it (you're not the first, and probably not
> the last, to typo names)

Oops, big sorry! I must have been confused by the German spelling of
that name :-(

>>>>> +while [ $# -ge 1 ]; do
>>>>> +   case "$1" in
>>>>> +    -s)  START="$2" ; shift ;;
>>>>
>>>> POSIX recommends that short options with arguments be parseable both as
>>>> '-s foo' and '-sfoo'.  I don't care that you aren't POSIX compliant, but
>>>> using getopt(1) or getopts(1) may make it easier to comply.
>>
>> OK. After googling a little bit, it sounds like getopts is the way to
>> go, e.g. http://mywiki.wooledge.org/BashFAQ/035#getopts says that getopt
>> should not be used.
> 
> getopts(1) is POSIX, but not universally present. I _think_ your script
> was portable to /bin/sh, but it may be easier to write by relying on
> bashisms and changing line one to /bin/bash, at which point we know
> getopts is present.

Well, /bin/bash is also not really portable ... I've seen systems in the
past where bash was installed in another directory or not at all...

Anyway, FYI, I've found two more nice ways to check for POSIX compliance:

- There is a program called checkbashisms which reports bash related
  style

- "posh" is a very minimalistic POSIX compliant shell which hardly
  supports any of the bash extras

And indeed, both pointed me to another bashism in my script: The
"function" keyword is not portable and should be avoided... oh well. Not
sure whether I really should do a v3 of my patch, convert it to python
or just give up the idea of releasing such a script to the public...

 Thomas


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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