Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Bug or feature in Ruby (1.80.pre4)

Reply
Thread Tools

Bug or feature in Ruby (1.80.pre4)

 
 
Gour
Guest
Posts: n/a
 
      07-29-2003
Hi!

While attempting to compile and tweak extconf.rb for wxruby bindings
I've discovered that backticking gives different results in Linux and in
MinGW & MSYS environment.

Here is the result:

ggd@gaura:~> ruby -v
ruby 1.8.0 (2003-07-24) [i686-linux]
ggd@gaura:~> cat t.rb
puts `wx-config --cxx`
ggd@gaura:~> ruby t.rb
c++
ggd@gaura:~> irb
irb(main):001:0> `wx-config --cxx`
=> "c++\n"

The same is if I use:

ggd@gaura:~> cat t.rb
puts %x(wx-config --cxx)


However under Win platform & MSYS environment which uses POSIX notation:

ggd@GGD ~
$ ruby -v
ruby 1.8.0 (2003-07-24) [i386-mingw32]

ggd@GGD ~
$ ruby t.rb
t.rb:1:in ``': No such file or directory - wx-config --cxx (Errno::ENOENT)
from t.rb:1

ggd@GGD ~
$ irb
irb(main):001:0> `wx-config --cxx`
`wx-config --cxx`
Errno::ENOENT: No such file or directory - wx-config --cxx
from (irb):1:in ``'
from (irb):1

$ wx-config --cxx
c++


The same error if I use %x delimiter instead of backtick.

Is it a Ruby bug?

The Ruby cannot find shell script wx-config, although it is in the PATH (/mingw/bin).

Here is the output for PATH variable:

from MSYS (shell):

$ echo $PATH
.:/usr/local/bin:/mingw/bin:/bin:/mingw/BIN:/mingw/LIB:/j/DOS:/j/MERGE:/c/WINDOWS:/c/WINDOWS/COMMAND:.

from Ruby:

$ ruby t.rb
.;C:\MSYS\1.0\local\bin;c:\MinGW\bin;C:\MSYS\1.0\B IN;c:\MinGW\BIN;c:\MinGW\LIB;j:\DOS;j:\MERGE;c:\WI NDOWS;c:\WINDOWS\COMMAND;.


from irb:

$ irb
irb(main):001:0> ENV['PATH']
ENV['PATH']
=> ".;C:\\MSYS\\1.0\\local\\bin;c:\\MinGW\\bin;C:\\MS YS\\1.0\\BIN;c:\\MinGW\\BIN;c:\\MinGW\\LIB;j:\\DOS ;j:\\MERGE;c:\\WINDOWS;c:\\WINDOWS\\COMMAND;."
irb(main):002:0>

Is it normal behaviour?

Under Linux, all three cases gives identical result.

Sincerely,
Gour

--
Gour

Registered Linux User #278493


 
Reply With Quote
 
 
 
 
WATANABE Hirofumi
Guest
Posts: n/a
 
      07-29-2003
Hi,

Gour <> writes:

> However under Win platform & MSYS environment which uses POSIX notation:
>
> ggd@GGD ~
> $ ruby -v
> ruby 1.8.0 (2003-07-24) [i386-mingw32]
>
> ggd@GGD ~
> $ ruby t.rb
> t.rb:1:in ``': No such file or directory - wx-config --cxx (Errno::ENOENT)
> from t.rb:1
>
> ggd@GGD ~
> $ irb
> irb(main):001:0> `wx-config --cxx`
> `wx-config --cxx`
> Errno::ENOENT: No such file or directory - wx-config --cxx
> from (irb):1:in ``'
> from (irb):1
>
> $ wx-config --cxx
> c++
>
>
> The same error if I use %x delimiter instead of backtick.
>
> Is it a Ruby bug?


No. MinGW ruby is a navite win32 application. It does not
recognize shell script like mswin32 ruby.

watanabe@PORTER ~/ruby/msys
$ ruby -v
ruby 1.8.0 (2003-07-29) [i386-mingw32]

watanabe@PORTER ~/ruby/msys
$ printf "#! /bin/sh\necho Hello" >/bin/foo

watanabe@PORTER ~/ruby/msys
$ foo
Hello

watanabe@PORTER ~/ruby/msys
$ ruby -e 'p `foo`'
-e:1:in ``': No such file or directory - foo (Errno::ENOENT)
from -e:1

watanabe@PORTER ~/ruby/msys
$ ruby -e 'p `sh foo`'
"Hello\n"

--
eban

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ruby 1.9 splat in return statement, bug or feature? Gary Wright Ruby 3 06-03-2009 06:30 AM
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
When does a bug turn into a design feature? Or, what is a "bug"? robic0 Perl Misc 7 01-24-2006 05:48 AM
Bug or Feature - Bookmark Toolbar collapses Jim Y. Firefox 5 11-18-2004 05:12 AM
bug or feature? Pedro Graca Firefox 3 01-02-2004 06:42 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57