Bug #4731

ruby -S irb fails with mingw/msys vanilla builds

Added by Roger Pack almost 3 years ago. Updated about 1 year ago.

[ruby-core:36316]
Status:Assigned
Priority:Normal
Assignee:Luis Lavena
Category:-
Target version:-
ruby -v:- Backport:

Description

as reported originally with http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/36285
basically mingw builds fail with $ ruby -S irb and always have, at least for the 1.9 branches.

$ ruby -S irb
ruby: No such file or directory -- irb (LoadError)

History

#1 Updated by Koichi Sasada almost 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to Nobuyoshi Nakada

#2 Updated by Nobuyoshi Nakada almost 3 years ago

  • Status changed from Assigned to Feedback

I can't reproduce it.
Is irb only a batch file, or an exe file?

#3 Updated by Luis Lavena almost 3 years ago

Nobuyoshi Nakada wrote:

I can't reproduce it.
Is irb only a batch file, or an exe file?

After make install the end result in the indicated prefix is a series of batch files like: irb.bat which contains a mix of windows commands and the Ruby script in it, which is then fired using ruby -x

On RubyInstaller we replaced that with plain stubs and the original scripts from Ruby's source code, see here:

https://github.com/oneclick/rubyinstaller/blob/master/recipes/interpreter/ruby19.rake#L146-149
https://github.com/oneclick/rubyinstaller/blob/master/recipes/interpreter/ruby19.rake#L156-161
https://github.com/oneclick/rubyinstaller/blob/master/recipes/interpreter/ruby19.rake#L182-191

This workaround was implemented so ruby -S irb works.

#4 Updated by Nobuyoshi Nakada almost 3 years ago

  • ruby -v changed from ruby 1.9.3dev (2011-05-18 trunk 31614) [i386-mingw32] to -

Hi,

At Fri, 15 Jul 2011 21:28:50 +0900,
Luis Lavena wrote in :

On RubyInstaller we replaced that with plain stubs and the
original scripts from Ruby's source code, see here:

I see. There is only irb.bat, not irb sans the suffix. In
that sense, it's natural to fail, but maybe unexpected
behavior. Now I'm thinking to make -S option search with .bat
(and .cmd too) suffix if it is not found. How do you feel
about this?

diff --git a/ruby.c b/ruby.c
index 93b12d8..b8258ea 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1288,14 +1288,42 @@ processoptions(int argc, char **argv, struct
cmdline
options *opt)
}
else if (opt->do_search) {
char *path

#5 Updated by Luis Lavena almost 3 years ago

On Sat, Jul 16, 2011 at 7:46 AM, Nobuyoshi Nakada nobu@ruby-lang.org wrote:

I see.  There is only irb.bat, not irb sans the suffix.  In
that sense, it's natural to fail, but maybe unexpected
behavior.  Now I'm thinking to make -S option search with .bat
(and .cmd too) suffix if it is not found.  How do you feel
about this?

Thank you Nakada-san, I see a few drawbacks with this approach:

  • For a missing script (e.g. foo), system will attempt to find two
    extra "foo.bat" and "foo.cmd" in all portions of PATH, which will be
    expensive.

  • It will introduce a platform-specific discrepancy that other
    implementations will either need to implement or indicate that are not
    compatible.

    I would like to understand why original script is merged with the
    batchfile stub in tools/rbinstall.rb

    Perhaps we can remove that?

    The only reason I see with this is PowerShell, which finds the
    extensionless script prior the .bat one and attempts to execute it
    (dunno why, but that is what it tries).

    For users with PowerShell I've always recommend them use "ruby -S
    script" instead.

    Thank you for your time.

    Luis Lavena

    AREA 17

    Perfection in design is achieved not when there is nothing more to add,
    but rather when there is nothing more to take away.
    Antoine de Saint-Exupéry

#6 Updated by Nobuyoshi Nakada almost 3 years ago

Hi,

At Sun, 17 Jul 2011 05:22:32 +0900,
Luis Lavena wrote in :

I would like to understand why original script is merged with the
batchfile stub in tools/rbinstall.rb

Perhaps we can remove that?

Removing the stub, or splitting to a batch file and a script
file?

The only reason I see with this is PowerShell, which finds the
extensionless script prior the .bat one and attempts to execute it
(dunno why, but that is what it tries).

The reason is just that one file is handier than two files.
I know nothing about PowerShell.

--
Nobu Nakada

#7 Updated by Luis Lavena almost 3 years ago

On Thu, Jul 21, 2011 at 11:07 AM, Nobuyoshi Nakada nobu@ruby-lang.org wrote:

Hi,

At Sun, 17 Jul 2011 05:22:32 +0900,
Luis Lavena wrote in :

I would like to understand why original script is merged with the
batchfile stub in tools/rbinstall.rb

Perhaps we can remove that?

Removing the stub, or splitting to a batch file and a script
file?

Splitting to back and script file.

The only reason I see with this is PowerShell, which finds the
extensionless script prior the .bat one and attempts to execute it
(dunno why, but that is what it tries).

The reason is just that one file is handier than two files.

What particular thing are you doing with the files? If I move I move
the entire directory.

Thank you.
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

#8 Updated by Eric Hodel about 1 year ago

Luis, Nobu, what is the status of this?

#9 Updated by Luis Lavena about 1 year ago

  • Status changed from Feedback to Assigned
  • Assignee changed from Nobuyoshi Nakada to Luis Lavena

drbrain (Eric Hodel) wrote:

Luis, Nobu, what is the status of this?

I proposed an alternate rbinstall.rb method in #6769 that will correct this issue.

However, workload has been high and code in rbinstall.rb is not very clear.

Also available in: Atom PDF