Andrew Dunstan <and...@dunslane.net> writes: > On 11/29/2015 04:28 PM, Noah Misch wrote: >> Never mutate the filesystem in a BEGIN block, because "perl -c" runs BEGIN >> blocks. (Likewise for the BEGIN block this patch adds to TestLib.)
> Yeah, those two lines might belong in an INIT block. "perldoc perlmod" > for details. BTW, if we consider that gospel, why has PostgresNode.pm got this in its BEGIN block? # PGHOST is set once and for all through a single series of tests when # this module is loaded. $test_pghost = $TestLib::windows_os ? "127.0.0.1" : TestLib::tempdir_short; $ENV{PGHOST} = $test_pghost; On non-Windows machines, the call of tempdir_short will result in filesystem activity, ie creation of a directory. Offhand it looks like all of the activity in this BEGIN block could go to an INIT block instead. I'm also bemused by why there was any question about this being wrong: # XXX: Should this use PG_VERSION_NUM? $last_port_assigned = 90600 % 16384 + 49152; If that's not a hard-coded PG version number then I don't know what it is. Maybe it would be better to use random() instead, but surely this isn't good as-is. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers