IO.seek behaving strangely on FreeBSD 4.9

T

Travis Whitton

Hi,
Initially I thought that this was a bug with rubyzip, but it appears that
something is wrong with IO.seek on FreeBSD 4.9 (at least on my system).

travis@aop:~$ uname -a
FreeBSD aop.intranet 4.9-RELEASE-p4 FreeBSD 4.9-RELEASE-p4
#0: Wed Mar 17 16:55:09 EST 2004
(e-mail address removed):/usr/obj/usr/src/sys/MYKERNEL i386

travis@aop:~$ ruby -v
ruby 1.8.1 (2003-12-25) [i386-freebsd4]

travis@aop:~$ cat badseek.rb
f = File.new("somefile.txt", "w") # make an empty file
f.close
f = File.new("somefile.txt")
f.seek(-1, IO::SEEK_END)
f.read

travis@aop:~$ ruby badseek.rb
badseek.rb:3:in `seek': File too large - somefile.txt (Errno::EFBIG)
from badseek.rb:3

I know that the seek index is invalid, so I should get Errno::EINVAL, but why
am I getting Errno:EFBIG? This seems to be causing a problem preventing me
from using rubyzip on my machine when it tries to do a valid seek on a zipfile.

Thanks,
Travis Whitton
 
S

Simon Strandgaard

Initially I thought that this was a bug with rubyzip, but it appears that
something is wrong with IO.seek on FreeBSD 4.9 (at least on my system).

travis@aop:~$ uname -a
FreeBSD aop.intranet 4.9-RELEASE-p4 FreeBSD 4.9-RELEASE-p4
#0: Wed Mar 17 16:55:09 EST 2004
(e-mail address removed):/usr/obj/usr/src/sys/MYKERNEL i386

travis@aop:~$ ruby -v
ruby 1.8.1 (2003-12-25) [i386-freebsd4]

travis@aop:~$ cat badseek.rb
f = File.new("somefile.txt", "w") # make an empty file
f.close
f = File.new("somefile.txt")
f.seek(-1, IO::SEEK_END)
f.read

travis@aop:~$ ruby badseek.rb
badseek.rb:3:in `seek': File too large - somefile.txt (Errno::EFBIG)
from badseek.rb:3

I know that the seek index is invalid, so I should get Errno::EINVAL, but why
am I getting Errno:EFBIG? This seems to be causing a problem preventing me
from using rubyzip on my machine when it tries to do a valid seek on a zipfile.

Thanks,
Travis Whitton


I get the EINVAL error on freebsd5.1

server> rm somefile.txt
server> ruby b.rb
b.rb:4:in `seek': Invalid argument - somefile.txt (Errno::EINVAL)
from b.rb:4
server> cat b.rb
f = File.new("somefile.txt", "w") # make an empty file
f.close
f = File.new("somefile.txt")
f.seek(-1, IO::SEEK_END)
f.read
server> uname -a
FreeBSD server.neoneye.dk 5.1-RELEASE FreeBSD 5.1-RELEASE #0: Thu Jun 5 02:55:42 GMT 2003 (e-mail address removed):/usr/obj/usr/src/sys/GENERIC i386
server> ruby -v
ruby 1.8.1 (2003-12-22) [i386-freebsd5.1]
server>
 
T

Travis Whitton

I get the EINVAL error on freebsd5.1

Anybody here have a FreeBSD 4.9 system they can test on with ruby 1.8.1?
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: IO.seek behaving strangely on FreeBSD 4.9"

|> I get the EINVAL error on freebsd5.1
|
|Anybody here have a FreeBSD 4.9 system they can test on with ruby 1.8.1?

I did. It raises Errno::EFBIG.

matz.
 
T

Thomas Sondergaard

I did. It raises Errno::EFBIG.

Is this something the ruby interpreter will work around?
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: IO.seek behaving strangely on FreeBSD 4.9"

|> I did. It raises Errno::EFBIG.
|
|Is this something the ruby interpreter will work around?

We just can't provide every work around for every bad behavior on
every operating system. Most methods corresponding to system calls
raise exception according to their errno status. If FreeBSD current
reports EFBIG, the method would (and should) raise exception
accordingly, I guess.

matz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top