Skip to content

Commit 6ad4631

Browse files
committed
Revert "Fix #install with "X" mode option"
This reverts commit 2ea54ad.
1 parent f92145b commit 6ad4631

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/fileutils.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,11 @@ def apply_mask(mode, user_mask, op, mode_mask) #:nodoc:
917917
private_module_function :apply_mask
918918

919919
def symbolic_modes_to_i(mode_sym, path) #:nodoc:
920-
path = File.stat(path) unless File::Stat === path
921-
mode = path.mode
920+
mode = if File::Stat === path
921+
path.mode
922+
else
923+
File.stat(path).mode
924+
end
922925
mode_sym.split(/,/).inject(mode & 07777) do |current_mode, clause|
923926
target, *actions = clause.split(/([=+-])/)
924927
raise ArgumentError, "invalid file mode: #{mode_sym}" if actions.empty?
@@ -935,7 +938,7 @@ def symbolic_modes_to_i(mode_sym, path) #:nodoc:
935938
when "x"
936939
mask | 0111
937940
when "X"
938-
if path.directory?
941+
if FileTest.directory? path
939942
mask | 0111
940943
else
941944
mask

test/fileutils/test_fileutils.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,8 +1182,6 @@ def test_install_mode_option
11821182
assert_filemode 04500, 'tmp/j'
11831183
install 'tmp/j', 'tmp/k', :mode => "+s"
11841184
assert_filemode 06500, 'tmp/k'
1185-
install 'tmp/a', 'tmp/l', :mode => "o+X"
1186-
assert_filemode 0644, 'tmp/l'
11871185
end if have_file_perm?
11881186

11891187
def test_chmod

0 commit comments

Comments
 (0)