Project

General

Profile

Actions

Bug #11021

closed

FileUtils.mv displays the wrong destination when Errno::EEXIST is raised

Added by britto (João Britto) about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
[ruby-core:<unknown>]

Description

Suppose we have the following directory structure:

$ cd /tmp
$ mkdir -p ruby/a
$ mkdir ruby/a/b
$ mkdir ruby/b
$ tree ruby
ruby
├── a
│   └── b
└── b

3 directories, 0 files

When we try to move b inside a, there is a name clash and Errno::EEXIST is raised.

$ irb
>> require 'fileutils'
=> true
>> FileUtils.mv 'ruby/b', 'ruby/a'
Errno::EEXIST: File exists - ruby/a

However, the error message says ruby/a exists, which does not seem to be the proper destination. The error message should instead read ruby/a/b exists.

I am including a patch to address this issue.


Files

ruby-fileutils-mv-fix.diff (912 Bytes) ruby-fileutils-mv-fix.diff britto (João Britto), 03/31/2015 11:57 PM
Actions #1

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

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

Applied in changeset r50141.


fileutils.rb: fix error message

  • lib/fileutils.rb (FileUtils#mv): show the exact target path in
    the error message instead of the destination parent directory
    name. patched by João Britto at
    [ruby-core:68706]. [Bug #11021]
Actions #2

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

Updated by usa (Usaku NAKAMURA) almost 9 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE, 2.2: REQUIRED

ruby_2_1 r50397 merged revision(s) 50141.

Updated by nagachika (Tomoyuki Chikanaga) almost 9 years ago

Backported into ruby_2_1 branch at r50485.

Updated by nagachika (Tomoyuki Chikanaga) almost 9 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: DONE, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0