Re: Question about PERL_NO_DEV_RANDOM
[email protected] (Scott Baker)
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <[email protected]> |
Dang... thanks for sanity checking me. It would have been a nice clean-up. -- Scott On 1/22/2026 8:02 PM, Tony Cook wrote: > On Thu, Jan 22, 2026 at 06:47:24PM -0800, Scott Baker wrote: >> As part of my clean up for Perl_seed() I see we have this weird define >> PERL_NO_DEV_RANDOM. Grepping the source code the ONLY place I see that >> defined is in *dosish.h* which appears to be a config file for building Perl >> for old DOS systems. Do we use *dosish.h *for any modern supported systems? >> >> The only thing this define does is tell Perl_seed() skip trying to read from >> */dev/urandom*. Since this is for older DOS systems which I don't think we >> support (?) can this check be removed? Without that define in place, even on >> DOS systems, the code will fail to read from */dev/urandom* (because it >> doesn't exist) and fail back to hashing state variables instead. > Win32 is considered DOSISH and dosish.h is included on Win32, from > perl.h: > > /* define this once if either system, instead of cluttering up the src */ > #if defined(WIN32) > #define DOSISH 1 > #endif > ... > #ifdef DOSISH > # if defined(OS2) > # include "os2ish.h" > # else > # include "dosish.h" > # endif > #elif defined(VMS) > ... > > Someone building perl on Configure based systems can add > -Accflags=-DPERL_NO_DEV_RANDOM to skip trying /dev/urandom. > >> Nothing would change in the codepath, it would just make the code cleaner >> and more readable by having one less obscure define. > It's still in use, so it should stay. > > Tony >