[前][次][番号順一覧][スレッド一覧]

ruby-changes:43456

From: nobu <ko1@a...>
Date: Wed, 29 Jun 2016 07:03:07 +0900 (JST)
Subject: [ruby-changes:43456] nobu:r55530 (trunk): Octal mode in un.rb

nobu	2016-06-29 07:03:00 +0900 (Wed, 29 Jun 2016)

  New Revision: 55530

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55530

  Log:
    Octal mode in un.rb
    
    * lib/fileutils.rb (FileUtils#symbolic_modes_to_i): revert r55524.
    
    * lib/un.rb (install, chmod): support octal mode string.  fix up
      r55513.

  Modified files:
    trunk/lib/fileutils.rb
    trunk/lib/un.rb
Index: lib/fileutils.rb
===================================================================
--- lib/fileutils.rb	(revision 55529)
+++ lib/fileutils.rb	(revision 55530)
@@ -812,7 +812,6 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L812
   private_module_function :apply_mask
 
   def symbolic_modes_to_i(mode_sym, path)  #:nodoc:
-    return mode_sym.oct if /\A[0-7]+\z/ =~ mode_sym
     mode = if File::Stat === path
              path.mode
            else
Index: lib/un.rb
===================================================================
--- lib/un.rb	(revision 55529)
+++ lib/un.rb	(revision 55530)
@@ -196,7 +196,7 @@ end https://github.com/ruby/ruby/blob/trunk/lib/un.rb#L196
 
 def install
   setup("pm:o:g:") do |argv, options|
-    (mode = options.delete :m) and options[:mode] = mode
+    (mode = options.delete :m) and options[:mode] = /\A\d/ =~ mode ? mode.oct : mode
     options[:preserve] = true if options.delete :p
     (owner = options.delete :o) and options[:owner] = owner
     (group = options.delete :g) and options[:group] = group
@@ -216,7 +216,8 @@ end https://github.com/ruby/ruby/blob/trunk/lib/un.rb#L216
 
 def chmod
   setup do |argv, options|
-    mode = argv.shift.oct
+    mode = argv.shift
+    mode = /\A\d/ =~ mode ? mode.oct : mode
     FileUtils.chmod mode, argv, options
   end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]