Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows generated .bat commands broken for JRuby on RubyGems 3 / Bundler 2 #2873

Closed
1 of 5 tasks
karlhe opened this issue Aug 13, 2019 · 8 comments
Closed
1 of 5 tasks

Comments

@karlhe
Copy link

karlhe commented Aug 13, 2019

I'm having a problem or would like to suggest a feature.

My current problem is the bundle command does not work as expected with JRuby on Windows.

Filed an issue against JRuby a while back (jruby/jruby#5632), but I don't think it's a problem on the JRuby side.

C:\jruby-9.2.8.0\bin>bundle
'"C:\jruby-9.2.8.0\bin\ruby.exe"' is not recognized as an internal or external command,
operable program or batch file.

It simply appears as if the .bat files are not generated correctly. The contents of bundler.bat/bundle.bat are:

@ECHO OFF
@"%~dp0ruby.exe" "%~dpn0" %*

For comparison, it looks like this in my JRuby 9.2 folder (which is using older Rubygems/Bundler):

@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"C:\jruby-9.2.0.0\bin\jruby.exe" "C:/jruby-9.2.0.0/bin/bundle" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"C:\jruby-9.2.0.0\bin\jruby.exe" "%~dpn0" %*

On the surface jbundle seems to work but then rails.bat, rake.bat, etc are still defined like this:

@ECHO OFF
@"%~dp0ruby.exe" "%~dpn0" %*

So any command other than jbundle install will end up failing anyway.

This issue is related to:

  • Network problems
  • Installing a library
  • Publishing a library
  • The command line gem
  • Other

Here are my current environment details:

$ gem env version
3.0.4

Bundler: 2.0.4
JRuby 9.2.8.0
Windows Server 2016 Standard

I will abide by the code of conduct.

@deivid-rodriguez
Copy link
Member

This seems caused by #2119.

@MSP-Greg Could you have a look at it?

@MSP-Greg
Copy link
Contributor

@deivid-rodriguez

See PR #2876. Uses the same logic as Gem.ruby for the exe file name.

@deivid-rodriguez
Copy link
Member

Thanks @MSP-Greg!

@karlhe I think you can double check that @MSP-Greg's fix works by manually applying his patch to your rubygems installation (it's very simple), and then reinstalling bundler (gem install bundler).

You can revert to your previous rubygems if you want after you confirm the fix with gem update --system 3.0.4 (or whatever).

@karlhe
Copy link
Author

karlhe commented Aug 15, 2019

Replaced the file at lib\ruby\stdlib\rubygems\installer.rb

bundle.bat and rake.bat both look correct, and seem to work as expected.

Thanks!

ghost pushed a commit that referenced this issue Aug 16, 2019
2876: installer.rb - fix #windows_stub_script r=hsbt a=MSP-Greg

Use ruby_exe in heredocs (scripts) instead of ruby.exe.  Currently, binstubs only work for standard MRI exe ('ruby.exe').

See Issue #2873

# Tasks:

- [X] Describe the problem / feature
- [ ] Write tests
- [X] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).

Co-authored-by: MSP-Greg <msp-greg@users.noreply.github.com>
@hsbt
Copy link
Member

hsbt commented Aug 17, 2019

@karlhe I released 3.0.6 with #2876 . Can you confirm to resolve this issue?

@karlhe
Copy link
Author

karlhe commented Aug 20, 2019

It still seems to be the same behavior, I don't think the PR actually made it into 3.0.6?

@"%~dp0ruby.exe" "%~dpn0" %*

Still looks like the old one

@hsbt hsbt added this to the 3.0.7 milestone Aug 20, 2019
@hsbt
Copy link
Member

hsbt commented Aug 20, 2019

Ah, Sorry. I missed this at 3.0.5 and 3.0.6, I will release with 3.0.7.

hsbt pushed a commit that referenced this issue Feb 18, 2020
2876: installer.rb - fix #windows_stub_script r=hsbt a=MSP-Greg

Use ruby_exe in heredocs (scripts) instead of ruby.exe.  Currently, binstubs only work for standard MRI exe ('ruby.exe').

See Issue #2873

# Tasks:

- [X] Describe the problem / feature
- [ ] Write tests
- [X] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).

Co-authored-by: MSP-Greg <msp-greg@users.noreply.github.com>
@hsbt
Copy link
Member

hsbt commented Feb 18, 2020

Relased https://blog.rubygems.org/2020/02/18/3.0.7-released.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants