
Issue #19352 has been updated by Milella@Hotmail.com (Scott Milella). byroot (Jean Boussier) wrote in #note-10:
I merged the webpacker backport, if people absolutely want to use Ruby 3.2 with very old Rails stuff they can point their Gemfile to the git repo.
IMHO It's not worth bringing back `File.exists?`, it's really trivial to either fix or work around if somehow you are stuck with super old code.
I think in the long run for Ruby and Rails leaving those 2 methods in place or putting an alias into the code would be a benefit to the community. I also don't think I would call Rails 6.1.7 "very old code". There are thousands maybe hundreds of thousands of apps running on Rails 6 who may want to upgrade to Ruby v3.2 for the new features it brings. It's 2 methods that have been there for a very long time, why remove them at all? What benefit does it bring to remove them? Really I can't even see a benefit to remove them? If I am wrong please explain what benefit it brings to remove File.exists? and Dir.exists? On the other side there is a penalty in that if someone wants to upgrade their Ruby to v3.2 and they use Webpacker they are going to run into that issue. There could be other places those methods are used as well. Could even be a lot of gems that use those methods. I just don't see any upside to removing those 2 methods. If you go to Rubygems it lists Rails v6.7.2 is compatible with REQUIRED RUBY VERSION:
= 2.5.0
---------------------------------------- Bug #19352: Feature #17391 was not such a good idea because now Ruby 3.2 can not install Rails v5 or v6 if they use webpacker. https://bugs.ruby-lang.org/issues/19352#change-101576 * Author: Milella@Hotmail.com (Scott Milella) * Status: Open * Priority: Normal * ruby -v: 3.2 * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED ---------------------------------------- Hello, I tried logging a GitHub issue to Rails to make them aware of this issue but they said they are no longer bugfixing Rails v6.1 anymore. So since this IS a Ruby issue at its core this might be the best place for this. You removed 2 methods from Ruby 3.2 namely: Dir.exists? [Feature #17391] File.exists? [Feature #17391] The reason cited was that it was deprecated since v2 and MAYBE it might be a good idea to remove it in v3. I disagree. It will alienate Rails v5 and v6 from at the very least making a new rails app because when the webpacker install is called it uses one or both of those methods. take a look at this log: Here is what I did: ``` Windows 10/11 Installed prerequisites: NodeJS, Yarn, Git, SQLite3 etc. Install Ruby on Windows using RubyInstaller v3.2.0 filename: "rubyinstaller-devkit-3.2.0-1-x64.exe" Installed newest rails via gem install rails (installed v7.0.4.1 and it successfully installed) Install rails via gem install rails -v 6.1.7 (successfully installed) rails _6.1.7_ new testapp Here is the install log around the failure point: Bundle complete! 15 Gemfile dependencies, 78 gems now installed. Use bundle info [gemname] to see where a bundled gem is installed. run bundle binstubs bundler rails webpacker:install create config/webpacker.yml Copying webpack core config create config/webpack create config/webpack/development.js create config/webpack/environment.js create config/webpack/production.js create config/webpack/test.js Copying postcss.config.js to app root directory create postcss.config.js Copying babel.config.js to app root directory create babel.config.js Copying .browserslistrc to app root directory create .browserslistrc rails aborted! NoMethodError: undefined method `exists?' for Dir:Class Tasks: TOP => app:template (See full trace by running task with --trace) ``` Is there any way we can reverse the removal of those 2 methods? Otherwise you are again alienating Rails v5 (with webpacker) and v6 which a L O T of Rails apps runs on. Why would you want to release a new version of Ruby that PREVENTS backwards compatibility. It does work properly on Ruby 3.1, but if you try Ruby 3.2 you will get the method error on exists?. Thank You, Scott -- https://bugs.ruby-lang.org/