Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

[Source::Rubygems] Remove .gem if downloaded package is invalid#6010

Merged
bundlerbot merged 1 commit intomasterfrom
seg-remove-failed-gem-download
Sep 15, 2017
Merged

[Source::Rubygems] Remove .gem if downloaded package is invalid#6010
bundlerbot merged 1 commit intomasterfrom
seg-remove-failed-gem-download

Conversation

@segiddins
Copy link
Copy Markdown
Contributor

What was the end-user problem that led to this PR?

The problem was the user could (once) have downloaded a .gem file that isn't actually a .gem, and that package would poison their cache.

Closes #5941.

What was your diagnosis of the problem?

My diagnosis was we should remove the .gem right after downloading it if we can't open it.

What is your fix for the problem, implemented in this PR?

My fix rm_rf's the .gem on failure.

Why did you choose this fix out of the possible options?

I chose this fix because it won't accidentally nuke existing cache entries for a user, but it should help prevent Bundler propagating an issue.

@colby-swandale
Copy link
Copy Markdown
Member

colby-swandale commented Sep 11, 2017

How does this work as the end user? Will bundler just try and download the gem again or will this raise an error?

@indirect
Copy link
Copy Markdown

If possible, I'd like to try to re-download one time, and then delete the file again and print an error explaining that we tried to download the gem and the result was corrupted even on retry. 👍🏻

@segiddins
Copy link
Copy Markdown
Contributor Author

If possible, I'd like to try to re-download one time, and then delete the file again and print an error explaining that we tried to download the gem and the result was corrupted even on retry. 👍🏻

Sure! Should be possible. Fair warning, I might not be able to get around to that for few weeks, so someone else is more than welcome to take this over!

@indirect
Copy link
Copy Markdown

Let's merge this for now, so that the cache will be cleared before the error, and hopefully it will work on the second run. I'll create a ticket for improving the UX.

@bundlerbot r+

@bundlerbot
Copy link
Copy Markdown
Collaborator

📌 Commit f420278 has been approved by indirect

@bundlerbot
Copy link
Copy Markdown
Collaborator

⌛ Testing commit f420278 with merge 49219ab...

bundlerbot added a commit that referenced this pull request Sep 14, 2017
[Source::Rubygems] Remove .gem if downloaded package is invalid

### What was the end-user problem that led to this PR?

The problem was the user could (once) have downloaded a `.gem` file that isn't actually a `.gem`, and that package would poison their cache.

Closes #5941.

### What was your diagnosis of the problem?

My diagnosis was we should remove the `.gem` right after downloading it if we can't open it.

### What is your fix for the problem, implemented in this PR?

My fix `rm_rf`'s the `.gem` on failure.

### Why did you choose this fix out of the possible options?

I chose this fix because it won't accidentally nuke existing cache entries for a user, but it should help prevent Bundler propagating an issue.
@bundlerbot
Copy link
Copy Markdown
Collaborator

💔 Test failed - status-travis

@olleolleolle
Copy link
Copy Markdown
Member

@bundlerbot retry

@bundlerbot
Copy link
Copy Markdown
Collaborator

⌛ Testing commit f420278 with merge 4fc8fe9...

bundlerbot added a commit that referenced this pull request Sep 15, 2017
[Source::Rubygems] Remove .gem if downloaded package is invalid

### What was the end-user problem that led to this PR?

The problem was the user could (once) have downloaded a `.gem` file that isn't actually a `.gem`, and that package would poison their cache.

Closes #5941.

### What was your diagnosis of the problem?

My diagnosis was we should remove the `.gem` right after downloading it if we can't open it.

### What is your fix for the problem, implemented in this PR?

My fix `rm_rf`'s the `.gem` on failure.

### Why did you choose this fix out of the possible options?

I chose this fix because it won't accidentally nuke existing cache entries for a user, but it should help prevent Bundler propagating an issue.
@bundlerbot
Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-travis
Approved by: indirect
Pushing 4fc8fe9 to master...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check for corrupt file in cache

5 participants