summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-03-28 09:07:38 +0000
committerColby Swandale <me@colby.fyi>2019-04-05 22:27:24 +1100
commit531fcaa62cc68a3263de06c4dbbd6a56ecacfa28 (patch)
tree99ac6140da998116529fbaaff593c2bc4b0d6487
parent65db92188d5102b7825cb5ba11622efea8d78aef (diff)
downloadbundler-531fcaa62cc68a3263de06c4dbbd6a56ecacfa28.tar.gz
Merge #7068
7068: Bump vendored fileutils to 1.2.0 r=hsbt a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was we manually updated some code in the vendored fileutils instead of using a released version. ### What was your diagnosis of the problem? My diagnosis was that we should use the recently released fileutils 1.2.0. ### What is your fix for the problem, implemented in this PR? My fix is to vendor it through `bin/rake vendor:fileutils[v1.2.0]`. ### Why did you choose this fix out of the possible options? I chose this fix because it properly upgrades the vendored code to match what's last released. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net> (cherry picked from commit 2167156db020fbe6ce74759cbf62ad1ceb651fb7)
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils.rb57
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils/version.rb5
2 files changed, 38 insertions, 24 deletions
diff --git a/lib/bundler/vendor/fileutils/lib/fileutils.rb b/lib/bundler/vendor/fileutils/lib/fileutils.rb
index 3a48e80293..fb7777eb49 100644
--- a/lib/bundler/vendor/fileutils/lib/fileutils.rb
+++ b/lib/bundler/vendor/fileutils/lib/fileutils.rb
@@ -1,4 +1,13 @@
# frozen_string_literal: true
+
+begin
+ require 'rbconfig'
+rescue LoadError
+ # for make mjit-headers
+end
+
+require "bundler/vendor/fileutils/lib/fileutils/version"
+
#
# = fileutils.rb
#
@@ -56,7 +65,7 @@
#
# There are some `low level' methods, which do not accept any option:
#
-# Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference = false)
+# Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
# Bundler::FileUtils.copy_file(src, dest, preserve = false, dereference = true)
# Bundler::FileUtils.copy_stream(srcstream, deststream)
# Bundler::FileUtils.remove_entry(path, force = false)
@@ -84,13 +93,8 @@
# files/directories. This equates to passing the <tt>:noop</tt> and
# <tt>:verbose</tt> flags to methods in Bundler::FileUtils.
#
-
-require 'rbconfig'
-
module Bundler::FileUtils
- VERSION = "1.1.0"
-
def self.private_module_function(name) #:nodoc:
module_function name
private_class_method name
@@ -110,12 +114,14 @@ module Bundler::FileUtils
#
# Changes the current directory to the directory +dir+.
#
- # If this method is called with block, resumes to the old
- # working directory after the block execution finished.
+ # If this method is called with block, resumes to the previous
+ # working directory after the block execution has finished.
+ #
+ # Bundler::FileUtils.cd('/') # change directory
#
- # Bundler::FileUtils.cd('/', :verbose => true) # chdir and report it
+ # Bundler::FileUtils.cd('/', :verbose => true) # change directory and report it
#
- # Bundler::FileUtils.cd('/') do # chdir
+ # Bundler::FileUtils.cd('/') do # change directory
# # ... # do something
# end # return to original directory
#
@@ -519,13 +525,12 @@ module Bundler::FileUtils
if destent.exist?
if destent.directory?
raise Errno::EEXIST, d
- else
- destent.remove_file if rename_cannot_overwrite_file?
end
end
begin
File.rename s, d
- rescue Errno::EXDEV
+ rescue Errno::EXDEV,
+ Errno::EPERM # move from unencrypted to encrypted dir (ext4)
copy_entry s, d, true
if secure
remove_entry_secure s, force
@@ -543,11 +548,6 @@ module Bundler::FileUtils
alias move mv
module_function :move
- def rename_cannot_overwrite_file? #:nodoc:
- /emx/ =~ RbConfig::CONFIG['host_os']
- end
- private_module_function :rename_cannot_overwrite_file?
-
#
# Remove file(s) specified in +list+. This method cannot remove directories.
# All StandardErrors are ignored when the :force option is set.
@@ -698,7 +698,7 @@ module Bundler::FileUtils
f.chown euid, -1
f.chmod 0700
}
- rescue EISDIR # JRuby in non-native mode can't open files as dirs
+ rescue Errno::EISDIR # JRuby in non-native mode can't open files as dirs
File.lstat(dot_file).tap {|fstat|
unless fu_stat_identical_entry?(st, fstat)
# symlink (TOC-to-TOU attack?)
@@ -1145,8 +1145,11 @@ module Bundler::FileUtils
module StreamUtils_
private
- def fu_windows?
- /mswin|mingw|bccwin|emx/ =~ RbConfig::CONFIG['host_os']
+ case (defined?(::RbConfig) ? ::RbConfig::CONFIG['host_os'] : ::RUBY_PLATFORM)
+ when /mswin|mingw/
+ def fu_windows?; true end
+ else
+ def fu_windows?; false end
end
def fu_copy_stream0(src, dest, blksize = nil) #:nodoc:
@@ -1271,9 +1274,15 @@ module Bundler::FileUtils
def entries
opts = {}
opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
- Dir.entries(path(), opts)\
- .reject {|n| n == '.' or n == '..' }\
- .map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
+
+ files = if Dir.respond_to?(:children)
+ Dir.children(path, opts)
+ else
+ Dir.entries(path(), opts)
+ .reject {|n| n == '.' or n == '..' }
+ end
+
+ files.map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
end
def stat
diff --git a/lib/bundler/vendor/fileutils/lib/fileutils/version.rb b/lib/bundler/vendor/fileutils/lib/fileutils/version.rb
new file mode 100644
index 0000000000..6d8504ccd5
--- /dev/null
+++ b/lib/bundler/vendor/fileutils/lib/fileutils/version.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+module Bundler::FileUtils
+ VERSION = "1.2.0"
+end