ruby-changes:58987
From: Hiroshi <ko1@a...>
Date: Sat, 30 Nov 2019 19:54:57 +0900 (JST)
Subject: [ruby-changes:58987] 32e547954f (master): Revert "[ruby/fileutils] Fix #install with "X" mode option"
https://git.ruby-lang.org/ruby.git/commit/?id=32e547954f From 32e547954fbbcbdd6f4468bf3be9e7eaa5d32f0f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Sat, 30 Nov 2019 17:58:39 +0900 Subject: Revert "[ruby/fileutils] Fix #install with "X" mode option" This reverts commit eab88d20eaa925d5e61a2a65820a099b46ccf3f8. The some CI was broken with this. diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 45ec148..59fc8bb 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -917,8 +917,11 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L917 private_module_function :apply_mask def symbolic_modes_to_i(mode_sym, path) #:nodoc: - path = File.stat(path) unless File::Stat === path - mode = path.mode + mode = if File::Stat === path + path.mode + else + File.stat(path).mode + end mode_sym.split(/,/).inject(mode & 07777) do |current_mode, clause| target, *actions = clause.split(/([=+-])/) raise ArgumentError, "invalid file mode: #{mode_sym}" if actions.empty? @@ -935,7 +938,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L938 when "x" mask | 0111 when "X" - if path.directory? + if FileTest.directory? path mask | 0111 else mask diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 82c6389..ca435ed1 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -1182,8 +1182,6 @@ class TestFileUtils < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L1182 assert_filemode 04500, 'tmp/j' install 'tmp/j', 'tmp/k', :mode => "+s" assert_filemode 06500, 'tmp/k' - install 'tmp/a', 'tmp/l', :mode => "o+X" - assert_filemode 0644, 'tmp/l' end if have_file_perm? def test_chmod -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/