Feature #9263

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

Added by Vajrasky Kok over 1 year ago. Updated over 1 year ago.

[ruby-core:59202]
Status:Closed
Priority:Normal
Assignee:-

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?).

better_error_message_symlink_link_destination_exist.patch Magnifier (1.01 KB) Vajrasky Kok, 12/19/2013 06:19 PM

Associated revisions

Revision 44313
Added by Nobuyoshi Nakada over 1 year ago

file.c: destination path only

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

Revision 44313
Added by Nobuyoshi Nakada over 1 year ago

file.c: destination path only

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

History

#1 Updated by Nobuyoshi Nakada over 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r44313.
Vajrasky, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


file.c: destination path only

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

Also available in: Atom PDF