Project

General

Profile

ActionsLike0

Feature #9263

closed

When creating symlink (or link) and the destination exists already, the error message is ambiguous

Added by vajrasky (Vajrasky Kok) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Assignee:
-
Target version:
[ruby-core:59202]

Description

Assume file 'link_b' already exists.

irb(main):001:0> File.symlink('a.txt', 'link_b')
Errno::EEXIST: File exists @ sys_fail2 - (a.txt, link_b)
from (irb):1:in symlink' from (irb):1 from /home/ethan/Documents/code/ruby/localruby/bin/irb:11:in '

We don't need both file information "(a.txt, link_b)". For EEXIST, it always refers to the destination file. So the error message should be:
Errno::EEXIST: File exists @ sys_fail2 - link_b
from (irb):1:in symlink' from (irb):1 from /home/ethan/Documents/code/ruby/localruby/bin/irb:11:in '

I already created a patch for this. Tested on Linux. I haven't tested on Windows yet. If this is a go, then I'll test it on Windows later (Does Ruby 2.1 support symlink on Windows NT 6?).


Files

Added by nobu (Nobuyoshi Nakada) over 11 years ago

Revision 9f368b5a

file.c: destination path only

  • file.c: remove unnecessary the source path from EEXIST error
    messages and show the destination path only. [ruby-core:59202]
    [Feature #9263]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

ActionsLike0

Also available in: Atom PDF