From e43d3deac9a2e0d620be7d56bc00d403b2601aa8 Mon Sep 17 00:00:00 2001 From: The Bundler Bot Date: Fri, 16 Mar 2018 11:56:31 +0000 Subject: [PATCH] Auto merge of #6336 - bundler:segiddins/updater-use-more-filesystem-access, r=colby-swandale [CompactIndexClient::Updater] Use filesystem_access when copying files ### What was the end-user problem that led to this PR? The problem was users could see the error template when they do not have write permissions to their temporary directory. Closes https://github.com/bundler/bundler/issues/6289 ### What was your diagnosis of the problem? My diagnosis was we need to use `SharedHelpers.filesystem_access` when writing files. ### What is your fix for the problem, implemented in this PR? My fix wraps usage of `cp` (cherry picked from commit b7b847fe734dc8d95782d2e6510c8bc9a6631374) --- lib/bundler/compact_index_client/updater.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bundler/compact_index_client/updater.rb b/lib/bundler/compact_index_client/updater.rb index 950306fee52..4d6eb800446 100644 --- a/lib/bundler/compact_index_client/updater.rb +++ b/lib/bundler/compact_index_client/updater.rb @@ -33,7 +33,9 @@ def update(local_path, remote_path, retrying = nil) # first try to fetch any new bytes on the existing file if retrying.nil? && local_path.file? - FileUtils.cp local_path, local_temp_path + SharedHelpers.filesystem_access(local_temp_path) do + FileUtils.cp local_path, local_temp_path + end headers["If-None-Match"] = etag_for(local_temp_path) headers["Range"] = if local_temp_path.size.nonzero?