Subject: | Uses buffered reads |
Date: | Sat, 15 Jun 2019 11:36:31 +0200 |
To: | bug-Crypt-URandom [...] rt.cpan.org |
From: | Raphael Geissert <geissert [...] debian.org> |
Hi,
Crypt::URandom's use of FileHandle means the reads of /dev/urandom are
buffered, but this is not documented. A quick look with strace:
openat(AT_FDCWD, "/dev/urandom", O_RDONLY|O_CLOEXEC) = 3
read(3, "\247ws\30\352\\\274\212]-\305?`\221\232qi\303\333O\304-\310\0\303o\314\2667\250.h"...,
8192) = 8192
So 8192 bytes were read for a code that only asked for 10 bytes of the
urandom PRNG.
It would be great if the reads were not buffered, but documenting the
behaviour should be the least that could be done.
Thanks in advance!
Cheers,
--
Raphael Geissert - Debian Developer
www.debian.org