From: "noraj (Alexandre ZANNI) via ruby-core" Date: 2023-02-05T01:08:52+00:00 Subject: [ruby-core:112218] [Ruby master Bug#19414] uninitialized constant URI::WSS in 3.0.X and 3.1.X Issue #19414 has been reported by noraj (Alexandre ZANNI). ---------------------------------------- Bug #19414: uninitialized constant URI::WSS in 3.0.X and 3.1.X https://bugs.ruby-lang.org/issues/19414 * Author: noraj (Alexandre ZANNI) * Status: Open * Priority: Normal * ruby -v: 3.1.3 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- I have a library called [ctf-party](https://github.com/noraj/ctf-party), [making use of URI:WSS](https://github.com/noraj/ctf-party/blob/ef3b82cc1668325b782246a9bb162b18a9b2930c/lib/ctf_party/defang.rb#L86), and it's making my [CI pipeline fails](https://github.com/noraj/ctf-party/actions/runs/4059895670). I'm able to reproduce it locally (`bundle exec rake test`), working with ruby 3.2.0 and not with 3.1.3. The error is: ``` irb(main):001:0> require 'uri' => true irb(main):002:0> URI::WS => URI::WS irb(main):003:0> URI::WSS (irb):3:in `
': uninitialized constant URI::WSS (NameError) from /home/noraj/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `' from /home/noraj/.asdf/installs/ruby/3.1.3/bin/irb:25:in `load' from /home/noraj/.asdf/installs/ruby/3.1.3/bin/irb:25:in `
' ``` I don't understand why is that happening since [it exists in the official documentation](https://ruby-doc.org/3.1.3/stdlibs/uri/URI/WSS.html) and the [code looks ok to me on tag 3.1.3](https://github.com/ruby/ruby/blob/v3_1_3/lib/uri/wss.rb) which is [strictly identical to the code on tag 3.2.0](https://github.com/ruby/ruby/blob/v3_2_0/lib/uri/wss.rb). It works if I require the file explicitly: ``` irb(main):004:0> require 'uri/wss' => true irb(main):005:0> URI::WSS => URI::WSS ``` The issue come from the fact that [in 3.2.0 `'uri/wss'` is required](https://github.com/ruby/ruby/blob/v3_2_0/lib/uri.rb#L104) but [not in 3.1.3](https://github.com/ruby/ruby/blob/v3_1_3/lib/uri.rb#L103). In [3.0.5](https://github.com/ruby/ruby/blob/v3_0_5/lib/uri.rb) it is even worse as neither ws and wss are required. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/