ports/lang/ruby/3.0/patches/patch-lib_fileutils_rb

26 lines
834 B
Text
Raw Normal View History

2023-08-16 22:26:55 +00:00
Make FileUtils.mkdir_p act more like mkdir(1) -p, by not attempting
to create directories that already exist. This fixes systrace
warnings when building ports.
Index: lib/fileutils.rb
--- lib/fileutils.rb.orig
+++ lib/fileutils.rb
@@ -213,7 +213,7 @@ module FileUtils
# optimize for the most common case
begin
- fu_mkdir path, mode
+ fu_mkdir path, mode unless File.directory?(path)
next
rescue SystemCallError
next if File.directory?(path)
@@ -228,7 +228,7 @@ module FileUtils
stack.pop if path == stack.last # root directory should exist
stack.reverse_each do |dir|
begin
- fu_mkdir dir, mode
+ fu_mkdir dir, mode unless File.directory?(dir)
rescue SystemCallError
raise unless File.directory?(dir)
end