File#delete can't delete broken symlinks
----------------------------------------

                 Key: JRUBY-1920
                 URL: http://jira.codehaus.org/browse/JRUBY-1920
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC1
         Environment: Latest JRuby 1.1RC1 from trunk.
            Reporter: Vladimir Sizikov
         Attachments: file-delete-broken-symlink.patch

Consider the following example:

{noformat}
# First, clean everything
`rm -f test-file link-to-test-file`

# Create the file
`touch test-file`

# Create the link
`ln -s test-file link-to-test-file`

# Make the link broken
`rm test-file`

# Attempt to delete the broken link
File.delete('link-to-test-file')

# Check that it's deleted
`ls -l link-to-test-file`
{noformat}

MRI prints:
ls: link-to-test-file: No such file or directory
(which means that the broken symlink was successfully deleted)

JRuby prints:
No such file or directory - "link-to-test-file" (Errno::ENOENT)
(an attempt to delete the broken symlink leads to the exception, the
symlink is NOT removed).

This leads to some hard-to-understand rubyspec failures from time to time.

The proposed patch fixes the problem.
NOTE: This issue should be fixes after JRUBY-1919, so that File#symlink?
works correctly, since in this patch we rely on that.






-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to