Page 1 of 2

with-open-file problem of sbcl

Posted: Wed Aug 27, 2008 3:41 pm
by deftsp

Code: Select all

(with-open-file (in  #P"/sys/class/net/eth0/statistics/rx_bytes" :direction :input)
  (read in))
This code can work with clisp but sbcl fail.

I copy file sys/class/net/eth0/statistics/rx_bytes to my home folder, and with-open-file works.

I don't know why? Is this sbcl's bug?

Re: with-open-file problem of sbcl

Posted: Wed Aug 27, 2008 6:51 pm
by findinglisp
Hmm... good question. When I try it, SBCL just hangs. I can interrupt it with C-c in a term window, but it never returns. A simple "cat /sys/class/net/eth0/statistics/rx_bytes" works just fine. This is with SBCL 1.0.17 on Fedora 8 (2.6.25.11 kernel).

Re: with-open-file problem of sbcl

Posted: Wed Aug 27, 2008 7:05 pm
by deftsp
findinglisp wrote:Hmm... good question. When I try it, SBCL just hangs. I can interrupt it with C-c in a term window, but it never returns. A simple "cat /sys/class/net/eth0/statistics/rx_bytes" works just fine. This is with SBCL 1.0.17 on Fedora 8 (2.6.25.11 kernel).
SBCL 1.0.18 1.0.19 on Debian sid (2.6.26-1-686) suck too.

Re: with-open-file problem of sbcl

Posted: Wed Aug 27, 2008 8:26 pm
by findinglisp
I would post it to the SBCL developer's mailing list and see what they have to say.

Re: with-open-file problem of sbcl

Posted: Thu Aug 28, 2008 6:38 am
by metageek
A simpler test case:

Code: Select all

(let
    ((f (open #P"/sys/class/net/eth0/statistics/rx_bytes" :direction :input)))
  (read-char f))
This hangs for me, which shows that the bug isn't tied specifically to (with-open-file) or (read).

Re: with-open-file problem of sbcl

Posted: Fri Aug 29, 2008 7:10 am
by deftsp
findinglisp wrote:I would post it to the SBCL developer's mailing list and see what they have to say.
Have you posted it to sbcl mailing list. I haven't see at gmane.lisp.steel-bank.devel.

Re: with-open-file problem of sbcl

Posted: Mon Sep 01, 2008 8:05 am
by Exolon
Does it happen with other weird 'virtual' mounted files - i.e. in /dev, /proc?

Re: with-open-file problem of sbcl

Posted: Tue Sep 02, 2008 3:48 am
by deftsp
Exolon wrote:Does it happen with other weird 'virtual' mounted files - i.e. in /dev, /proc?
I test"/proc/stat" for read read-line with sbcl 1.0.20, it works.

"/sys/class/net/eth0/statistics/rx_bytes" still hang. :?

Re: with-open-file problem of sbcl

Posted: Tue Sep 02, 2008 3:50 pm
by smithzv
I think this is a bug, and a known issue for the sbcl people. In fact, I have a recollection of reading something about this and sbcl-devel a few months ago. I have searched throught the archives and found this,

http://sourceforge.net/mailarchive/mess ... hacker.com

So maybe snoop around that thread.

If you really need to access that data, you might go through the shell. Using trivial shell, something like this would work:

Code: Select all

(read-from-string
   (trivial-shell:shell-command
      "cat /sys/class/net/eth0/statistics/rx_bytes" ))
But, really this is a kludge at best.


Zach

Re: with-open-file problem of sbcl

Posted: Tue Sep 02, 2008 5:29 pm
by deftsp
Thank you very very much!
smithzv wrote:I think this is a bug, and a known issue for the sbcl people. In fact, I have a recollection of reading something about this and sbcl-devel a few months ago. I have searched throught the archives and found this,

http://sourceforge.net/mailarchive/mess ... hacker.com

So maybe snoop around that thread.

If you really need to access that data, you might go through the shell. Using trivial shell, something like this would work:

Code: Select all

(read-from-string
   (trivial-shell:shell-command
      "cat /sys/class/net/eth0/statistics/rx_bytes" ))
But, really this is a kludge at best.


Zach