From: "naruse (Yui NARUSE) via ruby-core" Date: 2023-03-04T06:38:49+00:00 Subject: [ruby-core:112685] [Ruby master Bug#19415] Incorrect circularity warning for concurrent requires Issue #19415 has been updated by naruse (Yui NARUSE). Backport changed from 2.7: WONTFIX, 3.0: WONTFIX, 3.1: REQUIRED, 3.2: REQUIRED to 2.7: WONTFIX, 3.0: WONTFIX, 3.1: REQUIRED, 3.2: DONE ruby_3_2 53f6173cfc085a7422b4a76c85e6c35969209327 merged revision(s) 8ce2fb9bbbaea14737c84385b1573f743a30f773,3a0f6ce1d31eefd8af01b50f3632a64d64e8f8c1. ---------------------------------------- Bug #19415: Incorrect circularity warning for concurrent requires https://bugs.ruby-lang.org/issues/19415#change-102141 * Author: fxn (Xavier Noria) * Status: Closed * Priority: Normal * Backport: 2.7: WONTFIX, 3.0: WONTFIX, 3.1: REQUIRED, 3.2: DONE ---------------------------------------- This script performs 5 concurrent `require` calls to the same file: ```ruby threads = [] 5.times do threads << Thread.new { p require 'bar' } end threads.each(&:join) ``` The file `bar.rb` is simply ```ruby sleep 0.1 ``` Now, if you execute the main script with warnings enabled: ``` ruby -W2 -I. foo.rb ``` you'll see one `true` and four `false` as expected. But also four warnings: ``` circular require considered harmful - /Users/fxn/tmp/bar.rb ``` As you see, there isn't really a circular `require` going on, so the warning itself is incorrect. On the other hand, concurrent `require` calls for the same file is something routinely happening and supported. I'd suggest that script should issue no warning. -- 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/