[Rake-devel] Fix for infinite loop bug
Jim Weirich
jim at weirichhouse.org
Mon May 2 13:34:01 EDT 2005
Daniel Berger said:
> Hi all,
>
> The following change fixes the infinite loop on Win32 systems. The
> logic is simple - if the dir length is the same in two iterations, it
> means we've reached the "root" directory and it's not going to get any
> smaller.
Excellent! It is even simplier that the original. I love it.
[... patch elided ...]
> I ran testtasks.rb on Solaris after this to make sure it worked:
>
> >ruby test/testtasks.rb
> Loaded suite test/testtasks
> Started
> ......................F......
> Finished in 3.564708 seconds.
>
> 1) Failure:
> test_create(TestTask) [test/testtasks.rb:19]:
> <false> is not true.
>
> 29 tests, 66 assertions, 1 failures, 0 errors
>
> The failure you see occurs with or without this change, so it's
> unrelated. The test in question is:
>
> assert t.prerequisites.is_a?(FileList)
Thanks ... I'll check this.
> I haven't provided any test cases yet because it appears there are still
> other places where rake.rb goes into an infinite loop (running
> testtasks.rb confirms this). I think it's coming from
> create_timed_files atm.
Yes. The issue is this. I need to create to files with known relative
time differences to test the file based prerequisite triggering. So I
create one file and then then second. If the second has the same time as
the first, I delete it, sleep a bit and recreate it. Eventually the time
of the second file will be different.... except in windows the time of the
the file never changes, causing an infinite loop.
> I'll patch 'em as I see 'em.
I'd love to get clean unit tests on windows. Any patches will be
gleefully accepted.
--
-- Jim Weirich jim at weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
More information about the Rake-devel
mailing list