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

Cannot unlink broken symlink via Pathname #2380

Open
headius opened this issue Dec 29, 2014 · 1 comment
Open

Cannot unlink broken symlink via Pathname #2380

headius opened this issue Dec 29, 2014 · 1 comment

Comments

@headius
Copy link
Member

@headius headius commented Dec 29, 2014

From http://jira.codehaus.org/browse/JRUBY-6099. Look for additional repro code there.

When swapping the last two lines it works as expected.

require 'fileutils'
require 'pathname'

source = Pathname.new('test')
FileUtils.touch source

raise unless source.exist?

link = Pathname.new('link')
link.make_symlink source

raise unless link.exist?
raise unless link.symlink?

source.unlink
link.unlink

The exception is:

Errno::ENOENT: No such file or directory - No such file or directory - link
   rmdir at org/jruby/RubyDir.java:363
  unlink at /Users/.../.rvm/rubies/jruby-1.6.2/lib/ruby/1.8/pathname.rb:1058
  (root) at symlink-bug.rb:16
@janko
Copy link

@janko janko commented Dec 26, 2018

I ran into this too. Switching from Pathname#unlink to File.unlink fixed the issue for me, but it would be nice if Pathname#delete/Pathname#delete worked too.

janko added a commit to shrinerb/shrine that referenced this issue Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants