with-open-file problem of sbcl

Discussion of Common Lisp

with-open-file problem of sbcl

Postby deftsp » Wed Aug 27, 2008 3:41 pm

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?
deftsp
 
Posts: 6
Joined: Tue Aug 05, 2008 6:16 am

Re: with-open-file problem of sbcl

Postby findinglisp » Wed Aug 27, 2008 6:51 pm

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).
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
findinglisp
 
Posts: 440
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX

Re: with-open-file problem of sbcl

Postby deftsp » Wed Aug 27, 2008 7:05 pm

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.
deftsp
 
Posts: 6
Joined: Tue Aug 05, 2008 6:16 am

Re: with-open-file problem of sbcl

Postby findinglisp » Wed Aug 27, 2008 8:26 pm

I would post it to the SBCL developer's mailing list and see what they have to say.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
findinglisp
 
Posts: 440
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX

Re: with-open-file problem of sbcl

Postby metageek » Thu Aug 28, 2008 6:38 am

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).
metageek
 
Posts: 10
Joined: Fri Jul 25, 2008 8:01 am

Re: with-open-file problem of sbcl

Postby deftsp » Fri Aug 29, 2008 7:10 am

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.
deftsp
 
Posts: 6
Joined: Tue Aug 05, 2008 6:16 am

Re: with-open-file problem of sbcl

Postby Exolon » Mon Sep 01, 2008 8:05 am

Does it happen with other weird 'virtual' mounted files - i.e. in /dev, /proc?
Exolon
 
Posts: 49
Joined: Sat Jun 28, 2008 12:53 pm
Location: Ireland

Re: with-open-file problem of sbcl

Postby deftsp » Tue Sep 02, 2008 3:48 am

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. :?
deftsp
 
Posts: 6
Joined: Tue Aug 05, 2008 6:16 am

Re: with-open-file problem of sbcl

Postby smithzv » Tue Sep 02, 2008 3:50 pm

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
smithzv
 
Posts: 94
Joined: Wed Jul 23, 2008 11:36 am

Re: with-open-file problem of sbcl

Postby deftsp » Tue Sep 02, 2008 5:29 pm

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
deftsp
 
Posts: 6
Joined: Tue Aug 05, 2008 6:16 am

Next

Return to Common Lisp

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 4 guests

cron