1.5.97 first impression

Dave Peticolas dave@krondo.com
04 Jun 2001 01:55:22 -0700


On 04 Jun 2001 11:53:19 +0300, Richard Braakman wrote:
> On Sun, Jun 03, 2001 at 11:57:22PM -0700, Dave Peticolas wrote:
> > On 03 Jun 2001 23:55:49 -0700, Jeffrey W. Baker wrote:
> > > Right.  It is blocking on opening and reading /dev/random.  Perhaps an
> > > upgrade to Guile 1.4 will fix that.
> > 
> > Strange. This is guile reading from /dev/random?
> 
> I traced it down to guppi (version 0.35.5).  In src/libguppiuseful,
> file guppi-unique-id.c, there are several problems:
> 
> 1. init_unique_id() reads from /dev/random to seed the random number generator.
> I can't find any good reason for this -- surely /dev/urandom would be
> good enough.  Its fallback based on time and getpid is worse than /dev/urandom
> would be.
> 
> 2. guppi_unique_id() calls init_unique_id() if "initialized" is false,
> but it doesn't declare "initialized" as static.  This makes it call
> init_unique_id() for every id.  (This probably makes the ids non-unique
> as well.)
> 
> There are two problems which make the first worse.  They'll probably
> not be relevant if /dev/urandom is used instead:
> 
> 1a. init_unique_id() tries to read sizeof(unsigned) bytes from /dev/random,
> but if it gets less than that, it ignores what it got.  This is wasteful.
> 
> 1b. init_unique_id() has a fallback for /dev/random, but since it opens
> /dev/random in blocking mode, it won't use the fallback until after it
> gets at least one byte.  This could take a while.
> 
> I haven't checked if there's a guppi version that fixes these problems.
> If there isn't, I hope that this is enough information to fix it :-)

Definitely! Thank you, I will forward this to the guppi maintainers.

dave