Bugs item #1917, was opened at 2005-05-14 21:33
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=1917&group_id=426

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nicolas Pouillard (ertai)
Assigned to: Nobody (None)
Summary: Pathname#unlink fails on a symlink which points to a directory.

Initial Comment:
When you try to unlink a link to a directory Pathname#unlink fails like that:

irb(main):001:0> Pathname.new('/tmp/bar').unlink
Errno::ENOTDIR: Not a directory - /tmp/bar


Here the Pathname#unlink code:

# File pathname.rb, line 860
  def unlink()
    if FileTest.directory? @path
      Dir.unlink @path
    else
      File.unlink @path
    end
  end

I simply propose:

# File pathname.rb, line 860
  def unlink()
    if FileTest.directory? @path and not FileTest.symlink? @path
      Dir.unlink @path
    else
      File.unlink @path
    end
  end


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=1917&group_id=426