unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Mark Harig <idirectscm@aim.com>
To: martin@gkc.org.uk, bug-guile@gnu.org
Subject: Re: Guile 2.0.0 cannot open /dev/urandom
Date: Thu, 17 Feb 2011 23:44:50 -0500	[thread overview]
Message-ID: <8CD9D3DB635ABF2-C18-1679C@webmail-m079.sysops.aol.com> (raw)
In-Reply-To: <201102172258.33666.martin@gkc.org.uk>

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.

--



  reply	other threads:[~2011-02-18  4:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-17 22:58 Guile 2.0.0 cannot open /dev/urandom Martin Ward
2011-02-18  4:44 ` Mark Harig [this message]
2011-02-27 22:47 ` Andy Wingo
2011-03-03 11:57   ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8CD9D3DB635ABF2-C18-1679C@webmail-m079.sysops.aol.com \
    --to=idirectscm@aim.com \
    --cc=bug-guile@gnu.org \
    --cc=martin@gkc.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).