Skip to content

Commit

Permalink
Merge pull request #8239 from edipofederle/fix-dir-home-empty
Browse files Browse the repository at this point in the history
Fix Dir.home for empty dir name
  • Loading branch information
enebo committed May 16, 2024
2 parents 733d2c4 + 50fe22d commit 7dbf8a4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyDir.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ public static IRubyObject home(ThreadContext context, IRubyObject recv) {

@JRubyMethod(name = "home", meta = true)
public static IRubyObject home(ThreadContext context, IRubyObject recv, IRubyObject user) {
if (user == null || user.isNil()) {
if (user == null || user.isNil() || user.toString().isEmpty()) {
return getHomeDirectoryPath(context);
}

Expand Down
1 change: 0 additions & 1 deletion test/mri/excludes/TestDir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
exclude :test_glob, '\0 delimiter is not handled'
exclude :test_glob_gc_for_fd, "tweaks rlimit and never restores it, depends on GC effects"
exclude :test_glob_too_may_open_files, "our glob does not appear to open files, and so the expected EMFILE does not happen"
exclude :test_home, "uses user.home as a fallback home path"

0 comments on commit 7dbf8a4

Please sign in to comment.