patch-lib_fileutils_rb 984 B

123456789101112131415161718192021222324252627
  1. $OpenBSD: patch-lib_fileutils_rb,v 1.1 2010/10/12 15:39:06 jeremy Exp $
  2. Make FileUtils.mkdir_p act more like mkdir(1) -p, by not attempting
  3. to create directories that already exist. This fixes systrace
  4. warnings when building ports.
  5. --- lib/fileutils.rb.orig Fri Oct 8 08:52:53 2010
  6. +++ lib/fileutils.rb Fri Oct 8 08:58:40 2010
  7. @@ -201,7 +201,7 @@ module FileUtils
  8. list.map {|path| path.sub(%r</\z>, '') }.each do |path|
  9. # optimize for the most common case
  10. begin
  11. - fu_mkdir path, options[:mode]
  12. + fu_mkdir path, options[:mode] unless File.directory?(path)
  13. next
  14. rescue SystemCallError
  15. next if File.directory?(path)
  16. @@ -214,7 +214,7 @@ module FileUtils
  17. end
  18. stack.reverse_each do |path|
  19. begin
  20. - fu_mkdir path, options[:mode]
  21. + fu_mkdir path, options[:mode] unless File.directory?(path)
  22. rescue SystemCallError => err
  23. raise unless File.directory?(path)
  24. end