FW: [Rake-devel] the origin of the strange bug on win2k

Hi all,

I've forwarded this from the Rake dev mailing list in the hopes that
someone can help out. There appears to be a shell problem, and we're
not sure what the proper way is to handle this on Win32.

Any ideas?

Thanks,

Dan

···

-----Original Message-----
From: rake-devel-bounces@rubyforge.org
[mailto:rake-devel-bounces@rubyforge.org] On Behalf Of Lionel Thiry
Sent: Wednesday, May 04, 2005 8:15 PM
To: Rake Development and Discussion
Subject: [Rake-devel] the origin of the strange bug on win2k

Hello!

By strange bug, I mean:
----8<----
-e:1:in `exit': no implicit conversion from nil to integer (TypeError)
         from -e:1
----8<----
that appeared /while/ unittests of rake were running.

I think it is because comspec (the win2k shell) doesn't substitute
variables the
same way as unix shell does.

----8<----
C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>set RAKE_TEST_RUBY=123

C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>echo $RAKE_TEST_RUBY
$RAKE_TEST_RUBY

C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>echo %RAKE_TEST_RUBY%
123

C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>ruby -e "exit
$RAKE_TEST_RUBY" -e:1:in `exit': no implicit conversion from nil to
integer (TypeError)
         from -e:1

C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>ruby -e "puts
%RAKE_TEST_RUBY%" 123
----8<----

Concerning the tests, the problem lies in test/testfileutils.rb at line
99:
----8<----
ruby %{-e "exit $RAKE_TEST_RUBY"} do |ok, status|
  assert(!ok)
  assert_equal 123, status.exitstatus
  block_run = true
end
----8<----

Unfortunatly, replacing $RAKE_TEST_RUBY with %RAKE_TEST_RUBY% doesn't
work. I've
conducted some tests to see what could work, see the attachment. ... But
I don't
find any solution yet.

--
Lionel Thiry

Personal website: http://users.skynet.be/lthiry/

Berger, Daniel wrote:

Concerning the tests, the problem lies in test/testfileutils.rb at line
99:
----8<----
ruby %{-e "exit $RAKE_TEST_RUBY"} do |ok, status|
  assert(!ok)
  assert_equal 123, status.exitstatus
  block_run = true
end
----8<----

Unfortunatly, replacing $RAKE_TEST_RUBY with %RAKE_TEST_RUBY% doesn't
work. I've conducted some tests to see what could work, see the attachment. ... But
I don't find any solution yet.

Can't you just do "exit ENV['RAKE_TEST_RUBY']"?

ENV['RAKE_TEST_RUBY'] = "123"

> ruby %{-e "exit $RAKE_TEST_RUBY"} do |ok, status|
> assert(!ok)
> assert_equal 123, status.exitstatus
> block_run = true
> end

[...]

Can't you just do "exit ENV['RAKE_TEST_RUBY']"?

You can ... but that won't test the expansion of environment variables in a
rake process.

I'm thinking that if I want rake to be able to support environment variable
expansion across all platforms, I will have to expand the variables myself.
There is just too much difference between systems.

···

On Thursday 05 May 2005 11:06 am, Florian Groß wrote:

--
-- Jim Weirich jim@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)