[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile 2.0.0 cannot open /dev/urandom
From: |
Mark Harig |
Subject: |
Re: Guile 2.0.0 cannot open /dev/urandom |
Date: |
Thu, 17 Feb 2011 23:44:50 -0500 |
On Thu, Feb 17, 2011 at 10:58:33PM +0000, Martin Ward wrote:
Guile 1.8.6 can open /dev/urandom (which I use for seeding a random
number generator):
% guile
guile> (open-input-file "/dev/urandom")
#<input: /dev/urandom 9>
guile>
But guile 2.0.0 gives this error:
~/Documents/guile-2.0.0/meta/guile
GNU Guile 2.0.0
Copyright (C) 1995-2011 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (open-input-file "/dev/urandom")
ERROR: In procedure open-file:
ERROR: In procedure fport_end_input: Invalid argument
Entering a new prompt. Type `,bt' for a backtrace or `,q' to
continue.
scheme@(guile-user) [1]> ,bt
0 (open-file "/dev/urandom" "r")
scheme@(guile-user) [1]>
--
As a work-around until the Guile developers can decide how
this is going to be handled, specifying that the file is to be opened
in read-only, binary mode works on bothGuile 2.0 and Guile 1.8.
This requires that you use `open-file' instead of `open-input-file':
$ guile
GNU Guile 2.0.0
Copyright (C) 1995-2011 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (open-file "/dev/urandom" "rb")
$1 = #<input: /dev/urandom 108>
scheme@(guile-user)> ,q
$ /usr/bin/guile
guile> (version)
"1.8.7"
guile> (open-file "/dev/urandom" "rb")
#<input: /dev/urandom 9>
guile>
The file, /dev/urandom, will then be opened in read-only
mode for both versions of Guile.
--