[#30549] [ANN] Ruby 1.8.6 has been released — "Akinori MUSHA" <knu@...>

 Ruby 1.8.6 をリリースしました。

14 messages 2007/03/12

[#30553] help: lib/shell for ruby 1.9 — keiju@... (Keiju ISHITSUKA)

けいじゅ@いしつかです.

13 messages 2007/03/13
[#30585] Re: help: lib/shell for ruby 1.9 — Yukihiro Matsumoto <matz@...> 2007/03/15

まつもと ゆきひろです

[#30587] Re: help: lib/shell for ruby 1.9 — keiju@... (石塚圭樹) 2007/03/15

けいじゅ@いしつかです.

[#30588] Re: help: lib/shell for ruby 1.9 — Yukihiro Matsumoto <matz@...> 2007/03/15

まつもと ゆきひろです

[ruby-dev:30473] Re: FileUtils.mv raises Errno::EPERM

From: "Akinori MUSHA" <knu@...>
Date: 2007-03-03 12:50:34 UTC
List: ruby-dev #30473
 青木さん、この件はどうでしょうか。


At Sun, 25 Feb 2007 15:06:26 +0900,
GO Noguchi wrote:
> 野口と申します。
>
> File.renameがErrno::EXDEVになる状況でディレクトリを移動すると
> ディレクトリに対してFile.unlinkしようとして、FileUtils.mvが
> エラーになります。
>
> $ cd ~
> $ mkdir foo
> $ touch foo/1
> home/ruby/local/ruby185/bin/ruby -rfileutils -ve 'FileUtils.mv("foo", "/tmp")'
> ruby 1.8.5 (2007-02-14 patchlevel 20) [i386-freebsd6.1]
> $ /home/ruby/local/ruby185/lib/ruby/1.8/fileutils.rb:504:in `unlink':
> Operation not permitted - foo (Errno::EPERM)
>        from /home/ruby/local/ruby185/lib/ruby/1.8/fileutils.rb:504:in `mv'
>        from /home/ruby/local/ruby185/lib/ruby/1.8/fileutils.rb:1379:in
> `fu_each_src_dest'
>        from /home/ruby/local/ruby185/lib/ruby/1.8/fileutils.rb:1393:in
> `fu_each_src_dest0'
>        from /home/ruby/local/ruby185/lib/ruby/1.8/fileutils.rb:1377:in
> `fu_each_src_dest'
>        from /home/ruby/local/ruby185/lib/ruby/1.8/fileutils.rb:490:in `mv'
>        from -e:1
>
> 妥当かどうかわかりませんが、一応パッチをつけておきます。
>
> --- fileutils.rb.orig   Sun Feb 25 14:46:44 2007
> +++ fileutils.rb        Sun Feb 25 14:53:16 2007
> @@ -484,7 +484,7 @@
>   #   FileUtils.mv Dir.glob('test*.rb'), 'test', :noop => true,
> :verbose => true
>   #
>   def mv(src, dest, options = {})
> -    fu_check_options options, :force, :noop, :verbose
> +    fu_check_options options, :force, :noop, :verbose, :secure
>     fu_output_message "mv#{options[:force] ? ' -f' : ''}
> #{[src,dest].flatten.join ' '}" if options[:verbose]
>     return if options[:noop]
>     fu_each_src_dest(src, dest) do |s, d|
> @@ -501,7 +501,11 @@
>           File.rename s, d
>         rescue Errno::EXDEV
>           copy_entry s, d, true
> -          File.unlink s
> +          if options[:secure]
> +            remove_entry_secure s, options[:force]
> +          else
> +            remove_entry s, options[:force]
> +          end
>         end
>       rescue SystemCallError
>         raise unless options[:force]
> @@ -514,7 +518,7 @@
>   module_function :move
>
>   OPT_TABLE['mv']   =
> -  OPT_TABLE['move'] = %w( noop verbose force )
> +  OPT_TABLE['move'] = %w( noop verbose force secure )
>
>   def rename_cannot_overwrite_file?   #:nodoc:
>     /djgpp|cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
>
> ---
> GO Noguchi<gonoguti@yahoo.co.jp>

--
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Different eyes see different things,
    Different hearts beat on different strings --
       But there are times for you and me when all such things agree"

In This Thread