-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix an issue attempting to re-copy the same file when the destination does not have write permissions #12253
Conversation
lib/cocoapods/downloader/cache.rb
Outdated
@@ -327,13 +327,15 @@ def copy_source_and_clean(source, destination, spec) | |||
# @return [Void] | |||
# | |||
def copy_files(files, source, destination) | |||
files = files.select { |f| File.exist?(f) } | |||
files = files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. do we need to map first and then select or just select and convert to Pathname within the select
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we do because we use them below as pathnames
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed this fixes my repro
Didn't fix my ruby 3.3.0 / macOS 13.6.4 |
@Chaseshaw got an example I could try? |
129a45d
to
d47ddda
Compare
… does not have write permissions
d47ddda
to
cab06c3
Compare
Going to go ahead and merge + ship since we know it fixes at least certain cases of this issue. |
@amorde the following Podfile is causing platform :ios, '17.0'
inhibit_all_warnings!
use_frameworks!
target 'CocoaPodsReproducer' do
pod 'Instabug', '12.6.0', :source => 'https://cdn.cocoapods.org/'
end The error:
|
Can confirm, I can't use 1.15.1 when 1.15.0 is fine |
We'll push out an update that reverts this PR as well as the original change that this PR was attempting to fix. |
Fixes #12226
The underlying issue was attempting to copy a file when it already exists at the destination and does not have the write permission set, causing a write permission error.
The copy is duplicative because a previous pass had already copied a parent directory including the files. The fix is to update the logic to only copy individual files instead of also copying folders.
Note: this logic could be optimized a bit further, but I was looking for a reliable fast solution to the bug for now.