From: Eric Blake <eblake@redhat.com>
To: Kamil Rytarowski <n54@gmx.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH 0/3] Fix NetBSD build (don't build ivshmem tools)
Date: Thu, 13 Jul 2017 15:12:26 -0500 [thread overview]
Message-ID: <56d7a1c9-ad1f-3397-6885-c58239404dd5@redhat.com> (raw)
In-Reply-To: <b8786d81-4a28-952d-deba-d808ebf42656@gmx.com>
[-- Attachment #1: Type: text/plain, Size: 992 bytes --]
On 07/13/2017 01:40 PM, Kamil Rytarowski wrote:
>> MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM % 255 + 1))} gtester -k --verbose -m=quick tests/check-qdict
>> sh: arith: syntax error: "RANDOM % 255 + 1"
>>
>> likely because we're using a bashism there.
Yes, assuming that $RANDOM exists is a bashism.
>>
>
> This is an extension to a POSIX shell. We were lately adding it as an
> extension to our sh(1) in the distribution. Were also thinking about
> prompting POSIX to standarize it.
>
> $ echo $((RANDOM % 255))
> 52
>
> As of now, one portable solution is to parse /dev/urandom, or use a 3rd
> party tool like awk(1).
It's also portable (although less random) to do:
$(( ${RANDOM:-0} + 1))
(the whole idea of MALLOC_PERTURB_ only works on glibc anyways, so it
really doesn't matter what you set it to on other systems).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-07-13 20:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 17:03 [Qemu-devel] [PATCH 0/3] Fix NetBSD build (don't build ivshmem tools) Peter Maydell
2017-07-13 18:40 ` Kamil Rytarowski
2017-07-13 20:12 ` Eric Blake [this message]
2017-07-14 8:34 ` Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2017-07-14 8:33 Peter Maydell
2017-07-20 9:43 ` Peter Maydell
2017-07-20 11:20 ` Markus Armbruster
2017-07-20 15:35 ` Peter Maydell
2017-07-20 16:59 ` Kamil Rytarowski
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=56d7a1c9-ad1f-3397-6885-c58239404dd5@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=n54@gmx.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--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).