I strace
'd a simple script using perl and bash.
$ strace perl -e 'echo "test";' 2>&1 | grep 'random'
open("/dev/urandom", O_RDONLY) = 3
$ strace bash 'echo "test"' 2>&1 | grep 'random'
$
Why does perl need the pseudorandom number generator for such a trivial script? I would expect opening /dev/urandom
only after the first use of random data.
Edit: I also tested python and ruby
$ strace python -c 'print "test"' 2>&1 | grep random
$
$ strace ruby -e 'print "test\n"' 2>&1 | grep random
open("/dev/urandom", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_CLOEXEC) = 3
Why do perl and ruby open it with different modes?