From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: Re: Guile 2.0.0 cannot open /dev/urandom Date: Sun, 27 Feb 2011 23:47:33 +0100 Message-ID: References: <201102172258.33666.martin@gkc.org.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1298847706 14427 80.91.229.12 (27 Feb 2011 23:01:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 27 Feb 2011 23:01:46 +0000 (UTC) Cc: bug-guile@gnu.org, Mike Gran To: Martin Ward Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Feb 28 00:01:40 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PtpcN-0005W2-6t for guile-bugs@m.gmane.org; Mon, 28 Feb 2011 00:01:35 +0100 Original-Received: from localhost ([127.0.0.1]:58565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtpO5-0003Qc-PU for guile-bugs@m.gmane.org; Sun, 27 Feb 2011 17:46:49 -0500 Original-Received: from [140.186.70.92] (port=39806 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtpND-0002pw-Cg for bug-guile@gnu.org; Sun, 27 Feb 2011 17:46:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PtpJl-0003dY-3L for bug-guile@gnu.org; Sun, 27 Feb 2011 17:42:26 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:52023 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PtpJk-0003dT-SG for bug-guile@gnu.org; Sun, 27 Feb 2011 17:42:21 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 8A50E4010; Sun, 27 Feb 2011 17:43:36 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=ul2500rYyApXTt2Zb5P5X4uvEMY=; b=xM/nwg y3o0lWw7fojTwppo+JmJjZHCdDXVA7a1Wq44JUrGKIAD1TpiC384HOYkZFf03bS/ Wh6RXZQBP97zrdQcLelK0RXsB1UOFd0Qc9JT+rQMzwM18V0UBFAjSGw/2Rgh5jcm VqVAf307X2uuPP6Dge83J5mFzuR900coZwm8w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=JBDAue1zcHrfG2w+42O404SWYcej5tig aQtjlgsYt4Y0+/uHfZE3nIwbOZLaYd1CP6phR9V+GfkHzA6D5oJ9XZneyOsCZs2y 3if88VE0Q4vuSQUksGOuhySu21ESzdVtRpjLtmbtQ3lBGBig5LjkDQ9MMdMQ1cIw ypkbcV3Os20= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 3F88C400F; Sun, 27 Feb 2011 17:43:34 -0500 (EST) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 43DF3400E; Sun, 27 Feb 2011 17:43:30 -0500 (EST) In-Reply-To: <201102172258.33666.martin@gkc.org.uk> (Martin Ward's message of "Thu, 17 Feb 2011 22:58:33 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 02166856-42C3-11E0-AF3F-AF401E47CF6F-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5244 Archived-At: Hi Martin, On Thu 17 Feb 2011 23:58, Martin Ward writes: > scheme@(guile-user)> (open-input-file "/dev/urandom") > ERROR: In procedure open-file: > ERROR: In procedure fport_end_input: Invalid argument Good catch! The relevant part of the C backtrace is: #22 0x00007ffff7cd83f6 in scm_syserror (subr=0x7ffff7d8008e "fport_end_input") at error.c:177 #23 0x00007ffff7ce174c in fport_end_input (port=, offset=) at fports.c:838 #24 0x00007ffff7ce1817 in fport_seek (port=, offset=, whence=) at fports.c:709 #25 0x00007ffff7d13d65 in scm_seek (fd_port=0x118cec0, offset=0x2, whence=) at ports.c:1768 #26 0x00007ffff7d1f5a9 in scm_i_scan_for_encoding (port=0x118cec0) at read.c:1672 #27 0x00007ffff7ce250b in scm_open_file (filename=0x11659e0, mode=0x7676c0) at fports.c:463 It seems that Guile is scanning the first few lines of the file for a "coding" declaration. This is because it is being opened in textual mode; if you open with (open-file "/dev/urandom" "rb") you will probably get what you want. It should not be erroring out here. In fact the error appears to proceed from an attempt to seek in the port after reading out the first N bytes to scan them for a coding directive; hummm. Mike, it seems that we should unget bytes onto the port instead of seeking; does that sound right to you? Martin, note that with Guile 1.8 and earlier, byte IO masquerading as character IO was all you have. Now with 2.0 you really want to be dealing with binary ports and bytevectors and such. Thanks for the report, Andy -- http://wingolog.org/