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

Support --enable-load-relative inside binstubs #2929

Merged
merged 4 commits into from Jan 14, 2022

Conversation

deivid-rodriguez
Copy link
Member

@deivid-rodriguez deivid-rodriguez commented Sep 25, 2019

Description:

ruby setup.rb was broken probably since #2782. Requiring openssl fixes it.

Closes #2928.

When ruby has been compiled with the --enable-load-relative configuration, ruby core generates binstub files with some bash code on top, making gem install not detect them as rubygems binstubs.

Closes #5245.

Tasks:

  • Describe the problem / feature
  • Write tests
  • Write code to solve the problem
  • Get code review from coworkers / friends

I will abide by the code of conduct.

.github/workflows/macos.yml Outdated Show resolved Hide resolved
lib/rubygems/specification.rb Outdated Show resolved Hide resolved
@deivid-rodriguez
Copy link
Member Author

Ok, so this PR surfaced an unrelated bug in rubygems installer.

On MacOS 2.6.3 ruby seems compiled with the --enable-load-relative configure option. That generates the following bundler binstub upon installation:

#!/bin/sh
# -*- ruby -*-
_=_\
=begin
bindir="${0%/*}"
exec "$bindir/ruby" "-x" "$0" "$@"
=end
#!/usr/bin/env ruby
#
# This file was generated by RubyGems.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Rubygems installer does not support this kind of binstub and thinks it's not a bundler binstub.

This is a related ruby-core ticket: https://bugs.ruby-lang.org/issues/13997

@bronzdoc
Copy link
Member

bronzdoc commented Sep 30, 2019

@deivid-rodriguez can this be closed now that #2937 was merged?

@deivid-rodriguez deivid-rodriguez changed the title Fix ruby setup.rb Add a test to make sure that ruby setup.rb works Oct 1, 2019
@deivid-rodriguez
Copy link
Member Author

I guess the test could still be useful, so I changed the title to reflect that new scope and will work on it.

@simi
Copy link
Member

simi commented May 1, 2020

If I understand well, ruby setup.rb is there to install RubyGems without any dependencies (like rake). Anyway we do already test rake install on CI. Wouldn't be useful to unify ruby setup.rb and rake install and test that on CI? We can call setup.rb in rake install for example.

@deivid-rodriguez
Copy link
Member Author

This PR started as the title title suggests but then deviated to fixing the issue manifested by a test failure.

So I'm going to rename the PR and will try to rebase it to see how it was going.

Regarding the ruby setup.rb test, I don't think it's necessary anymore, since as you point out we already test rake install. rake install ends up running ruby setup.rb under the hood. It'ss essentially the same thing, but includes building a rubygems-update package so it's more similar to reality.

@deivid-rodriguez deivid-rodriguez changed the title Add a test to make sure that ruby setup.rb works Support --enable-load-relative inside binstubs May 1, 2020
@deivid-rodriguez
Copy link
Member Author

I verified manually that this fixes #5245 so I will merge it.

@deivid-rodriguez deivid-rodriguez merged commit c0cacf0 into master Jan 14, 2022
@deivid-rodriguez deivid-rodriguez deleted the fix_ruby_setup_rb branch January 14, 2022 15:00
@nobu
Copy link
Contributor

nobu commented Jan 15, 2022

TestGem#test_looks_for_gemdeps_files_automatically_from_binstubs and TestGem#test_looks_for_gemdeps_files_automatically_from_binstubs_in_parent_dir now fail because the installed directory doesn't contain ruby executable.

I think the symlink at the directory (or installing full set) could fix the failures, but it may not be a good way in the tests.

@deivid-rodriguez
Copy link
Member Author

How do they fail? Everything seems green both here and in ruby-core, no?

@nobu
Copy link
Contributor

nobu commented Jan 15, 2022

https://github.com/nobu/ruby/runs/4826739682?check_suite_focus=true#step:16:132

/home/runner/work/ruby/ruby/build/tmp/test_rubygems_20220115-18636-37l1rc/gd-tmp/bin/foo: 6: exec: /home/runner/work/ruby/ruby/build/tmp/test_rubygems_20220115-18636-37l1rc/gd-tmp/bin/ruby: not found

It's green because there is no load-relative tests.

@deivid-rodriguez
Copy link
Member Author

Oh I see, you're running the whole RubyGems suite against a Ruby with --enable-load-relative. I see, well only a couple of failures seems quite good :), I'll try it and see if there's an easy fix.

deivid-rodriguez added a commit that referenced this pull request Jan 26, 2022
Support `--enable-load-relative` inside binstubs

(cherry picked from commit c0cacf0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to bypass RubyGems prompts in CI - bundler's executable "bundle" conflicts with ... ruby setup.rb failed
4 participants