[Rubygems-developers] Reduce the gap between posix and Windows

Luis Lavena luislavena at gmail.com
Tue Apr 22 23:52:05 EDT 2008

On Tue, Apr 22, 2008 at 8:51 PM, Eric Hodel <drbrain at segment7.net> wrote:
> On Apr 22, 2008, at 13:51 PM, Luis Lavena wrote:
>  > Anyway, after this brief introduction, I want to ask and share
>  > something we (Gordon Thiesfeld and I) were discussing on rubyinstaller
>  > development list [1]: merge rubygems generated scripts and stubs into
>  > one and only file (gemname.bat).
>  Does this mean `gem install rake` would only produce a `rake.bat`
>  instead of both `rake` and `rake.bat`?
>  Or `gem install tinderbox` (which has two executables) would have a
>  `tinderbox.bat` that could invoke either executables via a subcommand?
>  (Would it be beneficial to add something like `gem execute rake` that
>  would run the rake executable?)

`gem install rake` will generate only `rake.bat` instead of `rake` and

That solves the problem of tools that need to add '.bat' when calling
stuff installed by rubygems under windows. (RubyInline and rubygems
itself for mkrf).

>  > Right now RubyGems generates the Windows stubs that call the extension
>  > less files (which contains the actual ruby script).
>  >
>  > This is good for running gems from the command line, but fails when
>  > using backticks or system calls from Ruby, since the look up method
>  > used in Ruby prioritize extension less files over executable
>  > (.bat/.cmd/.exe/.com) files. That's one of the reasons we are forced
>  > to add '.bat' to every rake or system call that fires other commands
>  > already installed by other gems.
>  >
>  > Ruby bundled scripts workaround this merging both stub (.bat) and
>  > script into the same file.
>  Ok, I think you mean the former.

You're correct :-)

>  > Another workaround will be hack what currently Ruby does, but that
>  > will require a lot of approval which I see will not came soon (or
>  > ever).
>  Whose approval?

ruby-core and ruby developers. It will require change the way
dln_find_1 (dln.c:1690) since is the responsible to look for rake.*
and prioritize rake (extensionless) over rake.bat.

The problem is around lines is the execution workflow, when asked for
'rake' it will find it at line 1785 and return it at that time, since
eaccess(fbuf, X_OK) will always return 0 on windows (there is no way
to know if a file is executable or not.

The actual check for the execution flag is actually processed starting
at 1802, but we never get there unless there is no file 'rake'

What do you think will be best? fix the ruby behavior? or change how
rubygems create stuff.

I see quite difficult some of these changes get approved and included,
since I don't get a lot of positive reactions to my comments on
ruby-core (you can say I can be just a pain in the butt).

Thanks for your time replying this.
Luis Lavena
Multimedia systems
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

More information about the Rubygems-developers mailing list