Bug #6716

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

Added by Masahiro Tomita almost 3 years ago. Updated 6 months ago.

[ruby-dev:45933]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada
ruby -v:ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux] Backport:2.0.0: DONE, 2.1: DONE

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

Duplicated by Ruby trunk - Bug #10374: FileUtils.mv can't move broken symlinks Open 10/12/2014

Associated revisions

Revision 46783
Added by Hiroshi SHIBATA 10 months ago

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

Revision 46783
Added by Hiroshi SHIBATA 10 months ago

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

Revision 47953
Added by Tomoyuki Chikanaga 6 months ago

merge revision(s) r46783: [Backport #6716]

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

Revision 47974
Added by Usaku NAKAMURA 6 months ago

merge revision(s) 46783: [Backport #6716]

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

History

#1 Updated by Masahiro Tomita almost 3 years ago

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

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

#2 Updated by Koichi Sasada almost 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to Nobuyoshi Nakada

#3 Updated by Hiroshi SHIBATA 10 months 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. [Bug #6716]

#4 Updated by Nobuyoshi Nakada 6 months ago

  • Duplicated by Bug #10374: FileUtils.mv can't move broken symlinks added

#5 Updated by Nobuyoshi Nakada 6 months ago

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

#6 Updated by Tomoyuki Chikanaga 6 months 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.

#7 Updated by Usaku NAKAMURA 6 months 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.

Also available in: Atom PDF