1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Revert "[ruby/fileutils] Fix #install with "X" mode option"

This reverts commit eab88d20ea.

  The some CI was broken with this.
This commit is contained in:
Hiroshi SHIBATA 2019-11-30 17:58:39 +09:00
parent 5e9f08647c
commit 32e547954f
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 6 additions and 5 deletions

View file

@ -917,8 +917,11 @@ module FileUtils
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
when "x"
mask | 0111
when "X"
if path.directory?
if FileTest.directory? path
mask | 0111
else
mask

View file

@ -1182,8 +1182,6 @@ class TestFileUtils < Test::Unit::TestCase
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