-
Notifications
You must be signed in to change notification settings - Fork 17
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
A bunch of warnings showing up after migrating to version 0.2.0 #12
A bunch of warnings showing up after migrating to version 0.2.0 #12
Comments
@deivid-rodriguez Would that be related to the same sort of problem that digest had? ruby/openssl#463 (comment) |
It seems similar to ruby/fileutils#22 too. I'll need a repro to look at it, are |
My builds are failing with the same error from yesterday i have to stop the pathname gem from update. is there anything i can do for this not to fail. gem list pathname*** LOCAL GEMS *** pathname (0.2.0, default: 0.1.0)
|
Just to clarify, in my case the builds are not failing, but it's annoying... It's also triggered when I open the rails console. |
My environment: spring is commented out in my Gemfile, but bootsnap is not ruby/fileutils#22 seems to be close to the issue I reported. So I tried few things such as App is working, but these errors messages when lauching the console or the app are quite annoying. |
I just tried removing |
@spaquet can you try |
It sounds like it is going to be hard to get a repro, so here's some steps you can take to provide me with some more information about the issue:
puts "=================================== backtrace =================================="
puts caller_locations(0).join("\n")
puts "================================================================================"
|
Before updating to v0.2.0 (so, just the default gem v0.1.0), there is only: After updating, we have the following: ~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/pathname.rb
~/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/pathname-0.2.0/lib/pathname.rb A diff of the two files: ~/.rbenv/versions/3.0.2/lib/ruby$ diff 3.0.0/pathname.rb gems/3.0.0/gems/pathname-0.2.0/lib/pathname.rb
577a578,579
> autoload(:FileUtils, 'fileutils')
>
582,584c584,585
< def mkpath
< require 'fileutils'
< FileUtils.mkpath(@path)
---
> def mkpath(mode: nil)
> FileUtils.mkpath(@path, mode: mode)
594d594
< require 'fileutils' A plain IRB session (no bundler) gives no warnings: irb(main):001:0> require 'pathname'
=> true If IRB is started by creating a new, basic gem with If I use the Even if I add IRB to the bundle, generate a binstub for IRB, and I realize I haven't found the exact issue yet, but I'll keep digging later; hopefully what I've found so far can be of use. |
A segfault is surprising and it should probably be reported to ruby-core. Regarding the warning, can you show a backtrace of the require point of each file (write the snippet above into each of the involved |
Oh oops, I didn't read your comment right at first, so I didn't realize you wanted the backtrace lines inserted into the actual lib files, my bad. Otherwise, I would have included that in my first reply. Here's another gist with the backtraces on; I've also included the outputs of |
Oh, I see what the problem is now. When
As a consequence, by the time We need to refactor I'll work on this tomorrow. |
Well, these warnings are so annoying (e.g.: showing up for each rake task) that I rolled back to the default pathname-0.1.0 with a cursory |
@deivid-rodriguez isn't that course of action just going to make the same problem reappear later with a different gemified library? Would it be possible to change the behavior of Bundler instead, e.g., by not having it remove the paths for gems that have already been activated? I realize there will be consequences to that too, of course. |
Yes, that would probably fix this particular situation and it might be a good move in any case, but it still wouldn't allow users to specify We usually solve this problem by making |
@sumankula yes. This fixes the issue. However you also go back to the previous version ;-) |
Sorry for being a bit slow I was caught on another project.
and here are the first 21 lines of the application.rb file:
Here is the backtrace for pathname 0.1.0 as a reference point
|
Thank you @spaquet, my PR in rubygems should fix the issue, I'll try to wrap it up soon. |
Hi! I'm seeing a lot of similar warnings from URI as well as pathname, is #12 (comment) likely to be the cause? Examples (truncated for brevity):
|
The underlying cause is the same: a new version of default gems used by bundler/rubygems internally has been released (in this case, uri-0.11.0), potentially causing two versions of the same gem to be activated at the same time. Solution is also to vendor |
I'm trying to run kitchen tests and I segfault with pathname-0.2.0.
If I I'm running on a fresh WSL2 ubuntu install setting up my env like so: # Ruby
brew install ruby
echo 'export RUBYOPT="-W:no-deprecated -W:no-experimental"' >> ~/.zshrc
echo 'gem: --no-document' > ~/.gemrc
cat << EOF > ~/Gemfile
source "https://rubygems.org/"
source "https://rubygems.org/" do
gem "kitchen-terraform"
gem "inspec"
gem "inspec-bin"
gem "rubocop"
gem "cookstyle"
end
EOF
echo 'export BUNDLE_GEMFILE="~/Gemfile"' >> ~/.zshrc
source ~/.zshrc
gem install bundle
gem update
bundle update If this is a problem outside the scope of this repo and my info may be useful, can you point me to the correct place? |
@brettcurtis Please separate your SEGV issues from this? It seems to the difference. |
Can someone having this issue (or #14, I believe it's the same after all) verify that this little patch to bundler fixes things: diff --git a/bundler/lib/bundler/shared_helpers.rb b/bundler/lib/bundler/shared_helpers.rb
index 405ade95dd..846b9cc3aa 100644
--- a/bundler/lib/bundler/shared_helpers.rb
+++ b/bundler/lib/bundler/shared_helpers.rb
@@ -313,12 +313,11 @@ def bundler_ruby_lib
end
def clean_load_path
- bundler_lib = bundler_ruby_lib
-
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
$LOAD_PATH.reject! do |p|
- next if resolve_path(p).start_with?(bundler_lib)
+ resolved_path = resolve_path(p)
+ next if $LOADED_FEATURES.any? {|lf| lf.start_with?(resolved_path) }
loaded_gem_paths.delete(p)
end
$LOAD_PATH.uniq! |
@deivid-rodriguez - I'm back in business with that patch - Thanks ! |
Bundler 2.2.33 has been released which I expect to fix this issue. I think this can be closed. |
"Works on my Laptop" :D Thanks for the fix! |
Great! Thanks for this fix! |
Updating bundler fixed this for me. Thanks for the fix. |
Since upgrading to version 0.2.0 a lot of warning messages are popping up when launching an app or the console.
.rbenv/versions/3.0.1/lib/ruby/3.0.0/pathname.rb:20: warning: already initialized constant Pathname::TO_PATH
.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:20: warning: previous definition of TO_PATH was here
.rbenv/versions/3.0.1/lib/ruby/3.0.0/pathname.rb:22: warning: already initialized constant Pathname::SAME_PATHS
.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:22: warning:
.rbenv/versions/3.0.1/lib/ruby/3.0.0/pathname.rb:34: warning: already initialized constant Pathname::SEPARATOR_LISTprevious definition of SEPARATOR_LIST was here
.rbenv/versions/3.0.1/lib/ruby/3.0.0/pathname.rb:35: warning: already initialized constant
.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:35: warning:
.rbenv/versions/3.0.1/lib/ruby/3.0.0/pathname.rb:41: warning: already initialized constant Pathname::ABSOLUTE_PATH previous definition of ABSOLUTE_PATH was here
Anybody else with the same warnings?
The text was updated successfully, but these errors were encountered: