Bug or feature in Ruby (1.80.pre4)

Discussion in 'Ruby' started by Gour, Jul 29, 2003.

  1. Gour

    Gour Guest

    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\BIN;c:\MinGW\BIN;c:\MinGW\LIB;j:\DOS;j:\MERGE;c:\WINDOWS;c:\WINDOWS\COMMAND;.


    from irb:

    $ irb
    irb(main):001:0> ENV['PATH']
    ENV['PATH']
    => ".;C:\\MSYS\\1.0\\local\\bin;c:\\MinGW\\bin;C:\\MSYS\\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
     
    Gour, Jul 29, 2003
    #1
    1. Advertising

  2. 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
     
    WATANABE Hirofumi, Jul 29, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shel Blauman [MSFT]

    Re: feature or bug?

    Shel Blauman [MSFT], Aug 11, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    406
    Shel Blauman [MSFT]
    Aug 11, 2003
  2. Replies:
    14
    Views:
    1,478
  3. Chris Morris

    [ANN] clxmlserial 1.0.pre4

    Chris Morris, Dec 4, 2003, in forum: Ruby
    Replies:
    0
    Views:
    77
    Chris Morris
    Dec 4, 2003
  4. Gary Wright
    Replies:
    3
    Views:
    118
    Macario Ortega
    Jun 3, 2009
  5. robic0
    Replies:
    7
    Views:
    106
    Samwyse
    Jan 24, 2006
Loading...

Share This Page