Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ca8c2107b1c5
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ef8591a3c755
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Dec 3, 2014

  1. Copy the full SHA
    448c366 View commit details

Commits on Dec 4, 2014

  1. Merge pull request #2273 from lumeet/master

    fix RubyFile#rename when the source is a broken symlink. Thanks @lumeet.  Great to have you on board.  I will evaluate whether this should be backported to 1.7 branch as well.
    enebo committed Dec 4, 2014
    Copy the full SHA
    ef8591a View commit details
Showing with 4 additions and 1 deletion.
  1. +4 −1 core/src/main/java/org/jruby/RubyFile.java
5 changes: 4 additions & 1 deletion core/src/main/java/org/jruby/RubyFile.java
Original file line number Diff line number Diff line change
@@ -934,7 +934,10 @@ public static IRubyObject rename(ThreadContext context, IRubyObject recv, IRubyO
JRubyFile oldFile = JRubyFile.create(runtime.getCurrentDirectory(), oldNameJavaString);
JRubyFile newFile = JRubyFile.create(runtime.getCurrentDirectory(), newNameJavaString);

if (!oldFile.exists() || !newFile.getParentFile().exists()) {
boolean isOldSymlink = RubyFileTest.symlink_p(recv, oldNameString).isTrue();
// Broken symlinks considered by exists() as non-existing,
// so we need to check for symlinks explicitly.
if (!(oldFile.exists() || isOldSymlink) || !newFile.getParentFile().exists()) {
throw runtime.newErrnoENOENTError(oldNameJavaString + " or " + newNameJavaString);
}