Travis Whitton | 1 Apr 2004 02:39

IO.seek behaving strangely on FreeBSD 4.9

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 <at> aop:~$ uname -a
FreeBSD aop.intranet 4.9-RELEASE-p4 FreeBSD 4.9-RELEASE-p4
#0: Wed Mar 17 16:55:09 EST 2004
root <at> aop.intranet:/usr/obj/usr/src/sys/MYKERNEL  i386

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

travis <at> 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 <at> 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

(Continue reading)

Simon Strandgaard | 1 Apr 2004 02:59
Picon

Exception#set_backtrace doesn't have any effect

I want to attach debug information to some of my exceptions, however I
have problems transfering the backtrace array from the original to the new
exception. It seems as #set_backtrace doesn't have any effect?  
What am I doing wrong?

Any suggestions how to do such thing?

I would have expected the output of following snippet to contain
these a:0:A b:1:B c:2:C entries.. but that doesn't happen.

server> ruby a.rb
a.rb:17:in `mk_problem': we got nuked (TolerantError)
        from a.rb:19
server> expand -t2 a.rb 
def trigger
  raise "dodge this"
end
def dropbomb
  trigger
end
def transportbomb
  dropbomb
end
class TolerantError < StandardError; end
def mk_problem
  transportbomb
rescue => e
  #p e.backtrace
  error = TolerantError.new("we got nuked")
  error.set_backtrace(%w(a:0:A b:1:B c:2:C))
(Continue reading)

Sam Roberts | 1 Apr 2004 03:02
Favicon

Re: Representing Time Ranges (Difference)

Quoteing cc1 <at> cec.wustl.edu, on Thu, Apr 01, 2004 at 07:44:25AM +0900:
> Hmm, perhaps I scanned it too quickly, but this feels more like a 
> library to manipulate date ranges, as opposed to formatting a time span. 
>  Basically I want to be able to represent time spans in a more 
> meaningful manner then individual seconds.  I know all I need to do is 
> do a bunch of divide / modulus operations to find this out, but I was 
> wondering if there was a prewritten module to nicely format time spans 
> and allow easy access to the number of months, days, hours, seconds in 
> between to time or date objects.

Well, I've been meaning to do this, for the same reasons (I have
durations in seconds, and I want to print them in more human units).

I hacked this up. It works OK, but only up to days.

I could extend it to years, but it turns out months is hard to do. Given
a span in seconds, you don't know how many months that is, unless you
know the date at one end of the span.

So, maybe it would be possible to add a Duration.difference(t0, t1),
where t0 and t1 are either Time, Date, or DateTime, and then it would
be possible to break down the duration into years, months, days, ...

But, this hack will do me for now. If you get something better going,
pls share it around!

Cheers,
Sam

=begin
(Continue reading)

Mehr, Assaph (Assaph | 1 Apr 2004 03:23
Favicon

Re: Syntax: eval( "a = !a) != eval( "a = not a")

>> x = 23 == 23 && ! y = 42 == 23     #=> false
>> [x,y]                              #=> [false, true]
>> x = 23 == 23 and not y = 42 == 23  #=> false
>> [x,y]                              #=> [true, true]

... a coding style that personally gives me the hibby-jibbies, but at
least you have the option of playing with it.

Dick Davies | 1 Apr 2004 03:26
Gravatar

Re: Dormant projects (was Status of AOP in Ruby)

Kero wrote:

> The Software we're talking about, by its very nature, is written in
> people's free time, for no compensation but the scratching of their own
> itch, can be left alone for extended periods of time for many reasons.
> That doesn't mean it's ditched, so don't go about assuming that.

> After the question is raised about a project being dead, you'll have to
> wait for, dunno, half a year? more? to give the owner time to respond.

Hear, hear. I can think of a dozen ruby packages I use on a regular 
basis that haven't been
updated for a couple of years. Either they're 'finished', or maybe the 
guys who wrote them
  are in prison? I don't care, they work well.

Asking someone to 'ping' RAA once a fortnight is unreasonable IMO.

> PS2: Tools like bitkeeper 

ACK! Heresy!

I like SubVersion myself :)

Simon Strandgaard | 1 Apr 2004 03:29
Picon

Re: IO.seek behaving strangely on FreeBSD 4.9

On Thu, 01 Apr 2004 01:29:47 +0000, Travis Whitton wrote:
> 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 <at> aop:~$ uname -a
> FreeBSD aop.intranet 4.9-RELEASE-p4 FreeBSD 4.9-RELEASE-p4
> #0: Wed Mar 17 16:55:09 EST 2004
> root <at> aop.intranet:/usr/obj/usr/src/sys/MYKERNEL  i386
> 
> travis <at> aop:~$ ruby -v
> ruby 1.8.1 (2003-12-25) [i386-freebsd4]
> 
> travis <at> 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 <at> 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

(Continue reading)

Yukihiro Matsumoto | 1 Apr 2004 03:55
Favicon
Gravatar

Re: Exception#set_backtrace doesn't have any effect

Hi,

In message "Exception#set_backtrace doesn't have any effect"
    on 04/04/01, Simon Strandgaard <neoneye <at> adslhome.dk> writes:

|I want to attach debug information to some of my exceptions, however I
|have problems transfering the backtrace array from the original to the new
|exception. It seems as #set_backtrace doesn't have any effect?  
|What am I doing wrong?
|
|Any suggestions how to do such thing?

It's a bug fixed in the latest CVS.

							matz.

Simon Strandgaard | 1 Apr 2004 04:04
Picon

Re: Exception#set_backtrace doesn't have any effect

On Thu, 01 Apr 2004 11:55:27 +0900, Yukihiro Matsumoto wrote:
> In message "Exception#set_backtrace doesn't have any effect"
>     on 04/04/01, Simon Strandgaard <neoneye <at> adslhome.dk> writes:
> 
> |I want to attach debug information to some of my exceptions, however I
> |have problems transfering the backtrace array from the original to the new
> |exception. It seems as #set_backtrace doesn't have any effect?  
> |What am I doing wrong?
> |
> |Any suggestions how to do such thing?
> 
> It's a bug fixed in the latest CVS.
> 
> 							matz.

Thanks.. I better use cvs-head ;-) 

--
Simon Strandgaard

Ara.T.Howard | 1 Apr 2004 04:09
Picon

Re: tk bind help

On Thu, 1 Apr 2004, Ferenc Engard wrote:

> > and i want to configure 'page down', 'page up', 'down arrow', 'up arrow, etc.
> > events to do the sensible thing
> > 
> > this seems to do nothing...
> > 
> >    <at> text.bind 'Down', proc{puts 'Down'}
> >    <at> text.bind 'downarrow', proc{puts 'downarrow'}
> 
> The following writes out "Down" when you press the down arrow:
> 
> txt=TkText.new()
> txt.bind("Down", proc {puts "Down"})
> 
> The PgDn/PgUp keys normally are referred as 'Next' and 'Prior' key
> symbols.
> 
> For real scrolling, you just have to use the 'see' method of TkText
> (check out man 3tk text).
> 
> Ferenc

thanks. that worked.

-a
--

-- 
===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
(Continue reading)

Travis Whitton | 1 Apr 2004 04:19

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?


Gmane