Skip to content
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

Merged
merged 1 commit into from Feb 6, 2024

Conversation

amorde
Copy link
Member

@amorde amorde commented Feb 5, 2024

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.

@@ -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
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Member

@paulb777 paulb777 left a 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

@Chaseshaw
Copy link

Didn't fix my ruby 3.3.0 / macOS 13.6.4

@amorde
Copy link
Member Author

amorde commented Feb 6, 2024

@Chaseshaw got an example I could try?

@amorde amorde force-pushed the amorde/fix-duplicate-file-copy branch from 129a45d to d47ddda Compare February 6, 2024 02:33
@amorde amorde force-pushed the amorde/fix-duplicate-file-copy branch from d47ddda to cab06c3 Compare February 6, 2024 02:37
@amorde
Copy link
Member Author

amorde commented Feb 6, 2024

Going to go ahead and merge + ship since we know it fixes at least certain cases of this issue.

@amorde amorde merged commit b2e4e00 into 1-15-stable Feb 6, 2024
5 of 6 checks passed
@amorde amorde deleted the amorde/fix-duplicate-file-copy branch February 6, 2024 02:48
@nikolaykasyanov
Copy link
Contributor

nikolaykasyanov commented Feb 6, 2024

@amorde the following Podfile is causing pod install to fail with 1.15.1 (interestingly, 1.15.0 is fine):

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:

$ pod install
Analyzing dependencies
Downloading dependencies
Downloading Instabug (12.6.0)
Installing Instabug (12.6.0)
Generating Pods project
[!] The plist file at path `/Users/User/Desktop/CocoaPodsReproducer/Pods/Instabug/Instabug.xcframework/Info.plist` doesn't exist.

@danigutierrezayuso
Copy link

@amorde it seems that this fix added in version 1.15.1 is now causing other issues:

#12262
#12264
#12265
#12266

And in our case we're also seeing 'no such module' errors in all our repositories that didn't happen with version 1.15.0

@foxware00
Copy link

Can confirm, I can't use 1.15.1 when 1.15.0 is fine

@amorde
Copy link
Member Author

amorde commented Feb 6, 2024

We'll push out an update that reverts this PR as well as the original change that this PR was attempting to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants