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

Specify pre-release string to development version #81

Open
hsbt opened this issue Jan 19, 2024 · 13 comments
Open

Specify pre-release string to development version #81

hsbt opened this issue Jan 19, 2024 · 13 comments

Comments

@hsbt
Copy link
Member

hsbt commented Jan 19, 2024

I understand to use development version policy like "stringio-3.1.1". But this policy is harmful for library developer who used master version of Ruby.

I ususally use master version that is ruby-dev definition of ruby-build and develop software. When I did bundle update on tdiary/tdiary-core, it seems working fine. But stringio-3.1.1 is not released on rubygems.org. So, we get preparation failure on GitHub Actions like:

https://github.com/tdiary/tdiary-core/actions/runs/7470853111/job/20330178338

Can you add .dev suffix to development version? .dev is example, I'm okay to any string that is prelease flag. After that, I easily find dev version of dependencies.

@kou
Copy link
Member

kou commented Jan 19, 2024

I'm OK with adding a suffix but it seems that it's a Bundler bug.

https://github.com/tdiary/tdiary-core/actions/runs/7470853111/job/20330178338#step:6:15

Your bundle is locked to stringio (3.1.1) from rubygems repository
https://rubygems.org/ or installed locally, but that version can no longer be
found in that source.

"that source" means "rubygems repository https://rubygems.org/ or installed locally" not "rubygems repository https://rubygems.org/", right?
If so, "stringio (3.1.1)" installed as a default gem should be used by Bundler. Because it exists in a local source.

@hsbt
Copy link
Member Author

hsbt commented Feb 5, 2024

If so, "stringio (3.1.1)" installed as a default gem should be used by Bundler. Because it exists in a local source.

I'm not sure what you mean. https://github.com/tdiary/tdiary-core/actions/runs/7470853111/job/20330178338#step:6:15 is not master/head version. Ruby 3.0 or other stable version don't have stringio-3.1.1 as default gems. Why is it Bundler's bug?

Bundler will not pick prerelease version in default. If stringio or other default gems is marked with prelease flag like .dev or .pre, We keep to safe version on lockfile for old versions of ruby.

@headius
Copy link
Contributor

headius commented Mar 6, 2024

Just noting that I was trying to update JRuby's copy of gems from CRuby master and ran into this for both stringio and strscan (3.1.1 referenced there but not released). I see other gems that are .dev and can skip them until they are released, but there's no way to know 3.1.1 isn't released without checking manually.

@joshuapinter
Copy link

I'm also running into this now. Seeing the following message when deploying:

Your bundle is locked to stringio (3.1.1) from rubygems repository https://rubygems.org/ or installed locally, but that version can no longer be found in that source. That means the author of stringio (3.1.1) has removed it. You'll need to update your bundle to a version other than stringio (3.1.1) that hasn't been removed in order to install.

It looks like running bundle update updates stringio to 3.1.1 but Rubygems doesn't have that version.

For reference, our only gem that depends on this is psych and it's not version specific:

psych (5.1.2)
      stringio

I'm not sure where it's finding 3.1.1 and trying to use that.

I will adjust manually for now but anything we can do to solve this longer-term?

Thanks,

Joshua

@yahonda
Copy link

yahonda commented Sep 2, 2024

Rails CI agaist Ruby master branch is getting the same You have already activated stringio 3.1.2.dev, but your Gemfile requires stringio 3.1.1. Since stringio is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports stringio as a default gem. (Gem::LoadError) error since ruby/ruby@32f134b

Refer to https://buildkite.com/rails/rails-nightly/builds/971#0191aa3d-c398-4c46-a32b-69de837da9e7/1259

For similar LoadErrors, we have applied workaround by updating Gemfile.lock explicitly for stringio 3.1.1, strscan 3.0.4, strscan 3.0.2 and psych 5.1.1.1 like rails/rails#52123 . However, this workaround does not work for stringio 3.1.2.dev . As far as I understand the original issue can be resolved once rubygems/rubygems#5535 or rubygems/rubygems#5535 is merged to RubyGems.

Steps to reproduce

rdoc is one of the RubyGems that is installed by Rails https://github.com/rails/rails/blob/8bac99ad7a403ef52a5c97e7afa73c7bbcc67110/Gemfile#L65

rdoc depends on psych that depends on stringio.

Install ruby 3.4.0dev that has https://github.com/ruby/ruby/commit/32f134bb8541b21b941c49c68b5bf91cf62c97dc

git clone https://github.com/yahonda/rep_rails_nightly_971
cd rep_rails_nightly_971
bundle install
cd subdir
bundle exec rake

Expected behavior

It should pass as it runs against Ruby 3.3.4.

$ ruby -v
ruby 3.3.4 (2024-07-09 revision be1089c8ec) [x86_64-linux]
$ bundle info stringio
  * stringio (3.1.1)
	Summary: Pseudo IO on String
	Homepage: https://github.com/ruby/stringio
	Path: /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/stringio-3.1.1
	Reverse Dependencies:
		psych (5.1.2) depends on stringio (>= 0)
$ bundle exec rake
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Run options: --seed 56666

# Running:

.

Finished in 0.000657s, 1521.0863 runs/s, 1521.0863 assertions/s.

1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
$

Actual behavior

It raises the following Gem::LoadError

$ ruby -v
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e) [x86_64-linux]
$ bundle info stringio
  * stringio (3.1.2.dev)
	Summary: Pseudo IO on String
	Homepage: https://github.com/ruby/stringio
	Path: /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/stringio-3.1.2.dev
	Default Gem: yes
	Reverse Dependencies:
		psych (5.1.2) depends on stringio (>= 0)
$ bundle exec rake
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler/runtime.rb:299:in 'Bundler::Runtime#check_for_activated_spec!': You have already activated stringio 3.1.2.dev, but your Gemfile requires stringio 3.1.1. Since stringio is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports stringio as a default gem. (Gem::LoadError)
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler/runtime.rb:25:in 'block in Bundler::Runtime#setup'
	from <internal:array>:53:in 'Array#each'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler/spec_set.rb:191:in 'Bundler::SpecSet#each'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler/runtime.rb:24:in 'Enumerable#map'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler/runtime.rb:24:in 'Bundler::Runtime#setup'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler/inline.rb:66:in 'block (2 levels) in Object#gemfile'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler/settings.rb:158:in 'Bundler::Settings#temporary'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler/inline.rb:51:in 'block in Object#gemfile'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler.rb:429:in 'block in Bundler.with_unbundled_env'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler.rb:684:in 'Bundler.with_env'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler.rb:429:in 'Bundler.with_unbundled_env'
	from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.4.0+0/gems/bundler-2.5.17/lib/bundler/inline.rb:42:in 'Object#gemfile'
	from test.rb:5:in '<main>'
+++ 💥 FAILED (exit 1)
$

@amatsuda
Copy link
Member

amatsuda commented Sep 2, 2024

I understand the original issue can be resolved once rubygems/rubygems#5535 or rubygems/rubygems#5535 is merged to RubyGems.

Perhaps you meant rubygems/rubygems#5529 or rubygems/rubygems#5535 ?

@yahonda
Copy link

yahonda commented Sep 2, 2024

My bad.

Perhaps you meant rubygems/rubygems#5529 or rubygems/rubygems#5535 ?

Right.

@kou
Copy link
Member

kou commented Sep 3, 2024

If so, "stringio (3.1.1)" installed as a default gem should be used by Bundler. Because it exists in a local source.

I'm not sure what you mean. https://github.com/tdiary/tdiary-core/actions/runs/7470853111/job/20330178338#step:6:15 is not master/head version. Ruby 3.0 or other stable version don't have stringio-3.1.1 as default gems. Why is it Bundler's bug?

Bundler will not pick prerelease version in default. If stringio or other default gems is marked with prelease flag like .dev or .pre, We keep to safe version on lockfile for old versions of ruby.

Hmm. I'm not sure your workflow. Is the following correct?

  1. local: Prepare mater Ruby
  2. local: Run bundle update with master Ruby
  3. local: Commit Gemfile.lock and push it to tdiary/tdiary-core
  4. tdiary/tdiary-core: CI with Ruby 3.0 (not master Ruby) failed

@kou
Copy link
Member

kou commented Sep 3, 2024

I'm not sure where it's finding 3.1.1 and trying to use that.

Are you using master Ruby?

@kou
Copy link
Member

kou commented Sep 3, 2024

The Rails case shows that ".dev" approach causes another problem, right?

@hsbt
Copy link
Member Author

hsbt commented Sep 3, 2024

Hmm. I'm not sure your workflow. Is the following correct?

local: Prepare mater Ruby
local: Run bundle update with master Ruby
local: Commit Gemfile.lock and push it to tdiary/tdiary-core
tdiary/tdiary-core: CI with Ruby 3.0 (not master Ruby) failed

Yes.

In my understanding, Rails case happened with 3.1.2, not only .dev prefix. It's another issue from my concern.

@kou
Copy link
Member

kou commented Sep 3, 2024

OK. If you use master Ruby for bundle update, I think that BUNDLED WITH in Gemfile.lock will be updated to 2.6.0.dev or something too. Is it acceptable?
I think that we should use released Ruby not mater Ruby for the use case.

@yahonda
Copy link

yahonda commented Sep 3, 2024

Opened rubygems/rubygems#7996 because it looks like a bundler issue.

@hsbt hsbt changed the title Specify prelease string to development version Specify pre-release string to development version Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants