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

Don't use Obsolete Method Dir.exists? #391

Merged
merged 2 commits into from
Sep 25, 2023
Merged

Don't use Obsolete Method Dir.exists? #391

merged 2 commits into from
Sep 25, 2023

Conversation

shundhammer
Copy link
Contributor

@shundhammer shundhammer commented Sep 25, 2023

Bugzilla

https://bugzilla.suse.com/show_bug.cgi?id=1215637

Problem

Crash when trying to use the directory selector in the "Edit User" or "Add User" dialog with "undefined method `exists?' for Dir:Class".

Cause

Dir.exists? and File.exists? were deprecated long ago with Ruby 2.2, and now with Ruby 3.2 they were finally removed. The current TW uses Ruby 3.2.2.

Both methods were just aliases for Dir.exist? and File.exist?, respectively (even though that's the usual slightly broken English that is common in Ruby).

Reference

https://rubyreferences.github.io/rubychanges/3.2.html#removals

Removals

...

  • Methods:
    • Dir.exists?, File.exists? (deprecated since 2.1 as a general rule of having “bare verb” as a method name)

Fix

Now using Dir.exist? instead.

What about Other Releases like SLE-15.x / Leap 15.x?

Those are still using Ruby 2.5 (SLE-15.5 / Leap 15.5) or older. No need to change it there as well.

Test

Manual test on TW.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6299493935

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 60.824%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/include/users/dialogs.rb 0 1 0.0%
Totals Coverage Status
Change from base Build 6053800689: 0.0%
Covered Lines: 3394
Relevant Lines: 5580

💛 - Coveralls

@shundhammer shundhammer merged commit c86b796 into master Sep 25, 2023
16 checks passed
@shundhammer shundhammer deleted the huha-dir-exists branch September 25, 2023 12:47
@shundhammer
Copy link
Contributor Author

Manually submitted to openSUSE:Factory:

https://build.opensuse.org/request/show/1113640

@yast-bot
Copy link
Contributor

✔️ Internal Jenkins job #40 successfully finished

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants