Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkYNb-0003zM-W3 for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Jan 2019 17:56:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gkYNa-0000ve-MS for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Jan 2019 17:56:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkYNa-0000vX-Fa for pgsql-hackers@lists.postgresql.org; Fri, 18 Jan 2019 17:56:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkYNY-0007U4-0n for pgsql-hackers@lists.postgresql.org; Fri, 18 Jan 2019 17:56:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x0IHuMk9029226; Fri, 18 Jan 2019 12:56:23 -0500 From: Tom Lane To: Fabien COELHO cc: PostgreSQL Developers Subject: Re: PSA: we lack TAP test coverage on NetBSD and OpenBSD In-reply-to: References: <9427.1547701450@sss.pgh.pa.us> <21538.1547770868@sss.pgh.pa.us> <4615.1547792324@sss.pgh.pa.us> Comments: In-reply-to Fabien COELHO message dated "Fri, 18 Jan 2019 09:37:26 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29224.1547834182.1@sss.pgh.pa.us> Date: Fri, 18 Jan 2019 12:56:22 -0500 Message-ID: <29225.1547834182@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Fabien COELHO writes: >> all is explained here: >> https://man.openbsd.org/srandom >> Or at least most is explained there. > Yep. They try to be more serious than other systems about PRNG, which is > not bad in itself. > Maybe on OpenBSD pg should switch srandom to srandom_deterministic? Dunno. I'm fairly annoyed by their idea that they're smarter than POSIX. However, for most of our uses of srandom, this behavior isn't awful; it's only pgbench that has an expectation that the platform random() can be made to behave deterministically. And TBH I think that's just an expectation that's going to bite us. I'd suggest that maybe we should get rid of the use of both random() and srandom() in pgbench, and go over to letting set_random_seed() fill the pg_erand48 state directly. In the integer-seed case you could use something equivalent to pg_srand48. (In the other cases probably you could do better, certainly the strong-random case could just fill all 6 bytes directly.) That would get us to a place where the behavior of --random-seed=N is not only deterministic but platform-independent, which seems like an improvement. regards, tom lane