From owner-svn-src-head@FreeBSD.ORG Thu Aug 29 15:52:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 83DA511C; Thu, 29 Aug 2013 15:52:53 +0000 (UTC) (envelope-from eblake@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx1.freebsd.org (Postfix) with ESMTP id 61F6922E6; Thu, 29 Aug 2013 15:52:53 +0000 (UTC) Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7TFqqef028694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 29 Aug 2013 11:52:53 -0400 Received: from [10.3.113.179] (ovpn-113-179.phx2.redhat.com [10.3.113.179]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7TFqqpJ018046; Thu, 29 Aug 2013 11:52:52 -0400 Message-ID: <521F6E54.1070104@redhat.com> Date: Thu, 29 Aug 2013 09:52:52 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: svn-src-head@freebsd.org Subject: Re: [libvirt] FreeBSD, no gcc present libvirt build issue References: <521F63F4.4020406@redhat.com> <521F6C0F.9060007@redhat.com> In-Reply-To: <521F6C0F.9060007@redhat.com> X-Enigmail-Version: 1.5.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AQ4mVn6r2NRDXmguch35K5SJvc5saQ51h" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Cc: libvir-list , Jason Helfman X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Aug 2013 15:52:53 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AQ4mVn6r2NRDXmguch35K5SJvc5saQ51h Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/29/2013 09:43 AM, Eric Blake wrote: > On 08/29/2013 09:35 AM, Jason Helfman wrote: >=20 >>>> >>> stdlib.h:#define RAND_MAX 0x7fffffff >=20 > Good. >=20 >>> >>> -jgh >>> >> >> And on our current head release (10) it is this: >> >> #define RAND_MAX 0x7ffffffd >=20 > Huh? Why is this not 2**n-1? That violates assumptions we have made, > and is WHY your compile failed. It has nothing to do with clang vs. gc= c > (both compilers would fail), it has to do with your changed system > header resulting in violating assumptions that hold in ALL OTHER > IMPLEMENTATIONS, that random numbers are evenly distributed within a > range of a power of 2. >=20 http://lists.freebsd.org/pipermail/svn-src-head/2013-July/049076.html makes it look like the reduction in range was _intentional_? Yuck. A non-power-of-2 random generator adds needless complexity to the user. I think I can fix libvirt to work around the boneheaded decision; basically, since we cannot trust the full range of random_r to be evenly distributed, I will have to tweak libvirt's call to truncate every call to random_r to a subset of bits that are more likely to be evenly distributed (maybe by shifting off the most- and least-significant bits returned, and only using 28 instead of 31 bits of randomness per call). But I would MUCH rather prefer that FreeBSD revisit their decision, and guarantee that random output be evenly distributed across the full 31 bits to begin with. I also intend to open a bug against POSIX to request that RAND_MAX be required to be 2**n-1, rather than relying on the assumption that everyone so far, until FreeBSD 10, has happened to meet that requirement.= --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --AQ4mVn6r2NRDXmguch35K5SJvc5saQ51h Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSH25UAAoJEKeha0olJ0Nq/DoIAJOHji6KrYBkyzj8zGaWaHCA R+H1/LlJGYeTIVhdzuhEM1VTdRjU6Bw10ZFkpFadCJ8osGDUCwBmbIL8NPN88nq9 6uzXkmQKtCqieHPIPkT+crKvt0r08GF+H48jWBE+nuEtrum1ot1oB6D0zMXzgNOQ WHJAhHWoJwn0CUpi1n5vm34K0oyzMAjyFv936DI7kB2u2tQOkJxkC702TNxN5py+ coImNWAI8pRljW69RP1VAB3DFf9vp6crLjaBdOpOjLWV/v0yq/e79iwd4oBS3lSX DYU27jK/kZX+ypVR0Bh6WFq3RpgSk+f19aIwy7BZY8jj5AG34IYHD7qfyP5ueO8= =sv6h -----END PGP SIGNATURE----- --AQ4mVn6r2NRDXmguch35K5SJvc5saQ51h--