Project

General

Profile

Actions

Bug #6716

closed

FileUtils.mv でリンク先がないシンボリックリンクファイルを指定すると ENOENT エラーになる

Added by tommy (Masahiro Tomita) over 12 years ago. Updated about 10 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
[ruby-dev:45933]

Description

FileUtils.mv でリンク先がないシンボリックリンクファイルを指定すると ENOENT になります。

 % ln -s unexist hoge
% ruby -v -rfileutils -e 'FileUtils.mv("hoge", "fuga")'
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
/home/tommy/ruby193/lib/ruby/1.9.1/fileutils.rb:1515:in `stat': No such file or directory - hoge (Errno::ENOENT)
	from /home/tommy/ruby193/lib/ruby/1.9.1/fileutils.rb:1515:in `block in fu_each_src_dest'
	from /home/tommy/ruby193/lib/ruby/1.9.1/fileutils.rb:1531:in `fu_each_src_dest0'
	from /home/tommy/ruby193/lib/ruby/1.9.1/fileutils.rb:1513:in `fu_each_src_dest'
	from /home/tommy/ruby193/lib/ruby/1.9.1/fileutils.rb:508:in `mv'
	from -e:1:in `<main>'

mv コマンドと同じ動きを目指すのであればエラーにすべきではないと思います。

r27317 から発生していると思います。


Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #10374: FileUtils.mv can't move broken symlinksClosedActions

Updated by tommy (Masahiro Tomita) over 12 years ago

こんな感じにしてみました。いかがでしょうか。

https://github.com/tmtm/ruby/commit/00a677d8f42a36dc3ec5515fde8107e5f41bfd7b

Updated by ko1 (Koichi Sasada) over 12 years ago

  • Status changed from Open to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)

Updated by hsbt (Hiroshi SHIBATA) over 10 years ago

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

Applied in changeset r46783.


  • lib/fileutils.rb: handle ENOENT error with symlink targeted to
    non-exists file. [ruby-dev:45933] [Bug #6716]

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Has duplicate Bug #10374: FileUtils.mv can't move broken symlinks added

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Description updated (diff)
  • Category set to lib
  • Backport set to 2.0.0: REQUIRED, 2.1: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) about 10 years ago

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

Backported into ruby_2_1 at r47953.

Updated by usa (Usaku NAKAMURA) about 10 years ago

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

Backported into ruby_2_0_0 at r47974.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0