[ruby-core:68708] [Ruby trunk - Bug #11021] FileUtils.mv displays the wrong destination when Errno::EEXIST is raised

From: nobu@...
Date: 2015-04-01 02:03:55 UTC
List: ruby-core #68708
Issue #11021 has been updated by Nobuyoshi Nakada.

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

----------------------------------------
Bug #11021: FileUtils.mv displays the wrong destination when Errno::EEXIST =
is raised
https://bugs.ruby-lang.org/issues/11021#change-51994

* Author: Jo=C3=A3o Britto
* Status: Closed
* Priority: Normal
* Assignee:=20
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
Suppose we have the following directory structure:

~~~
$ cd /tmp
$ mkdir -p ruby/a
$ mkdir ruby/a/b
$ mkdir ruby/b
$ tree ruby
ruby
=E2=94=9C=E2=94=80=E2=94=80 a
=E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 b
=E2=94=94=E2=94=80=E2=94=80 b

3 directories, 0 files
~~~

When we try to move `b` inside `a`, there is a name clash and `Errno::EEXIS=
T` is raised.

~~~
$ irb
>> require 'fileutils'
=3D> 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 exi=
sts`.

I am including a patch to address this issue.

---Files--------------------------------
ruby-fileutils-mv-fix.diff (912 Bytes)


--=20
https://bugs.ruby-lang.org/

In This Thread

Prev Next