Skip to content

cache_store: handle corrupt DBM database.#4949

Merged
MikeMcQuaid merged 1 commit intoHomebrew:masterfrom
MikeMcQuaid:dbm_crash
Sep 20, 2018
Merged

cache_store: handle corrupt DBM database.#4949
MikeMcQuaid merged 1 commit intoHomebrew:masterfrom
MikeMcQuaid:dbm_crash

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

When the DBM database cannot be read by the current version of Ruby's DBM library (due to corruption or another incompatibility) it segfaults or freezes which takes down the entire Homebrew Ruby process.

This isn't desirable so instead perform a shell out with the Homebrew Ruby to see if it can read the DBM database before we try to use the information. If this hangs or crashes: silently delete the database and recreate it.

Fixes #4923.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

@ghost ghost assigned MikeMcQuaid Sep 20, 2018
@ghost ghost added the in progress Maintainers are working on this label Sep 20, 2018
@MikeMcQuaid MikeMcQuaid requested a review from claui September 20, 2018 09:27
When the DBM database cannot be read by the current version of Ruby's
DBM library (due to corruption or another incompatibility) it segfaults
or freezes which takes down the entire Homebrew Ruby process.

This isn't desirable so instead perform a shell out with the Homebrew
Ruby to see if it can read the DBM database before we try to use the
information. If this hangs or crashes: silently delete the database and
recreate it.
@claui
Copy link
Copy Markdown
Contributor

claui commented Sep 20, 2018

(Heads up: I will be away from my computer until tomorrow.)

@MikeMcQuaid
Copy link
Copy Markdown
Member Author

@claui No worries, I'll merge this as-is as it's somewhat urgent and welcome any post-merge review.

@MikeMcQuaid MikeMcQuaid merged commit 97dca89 into Homebrew:master Sep 20, 2018
@MikeMcQuaid MikeMcQuaid deleted the dbm_crash branch September 20, 2018 10:16
@ghost ghost removed the in progress Maintainers are working on this label Sep 20, 2018
@lock lock bot added the outdated PR was locked due to age label Oct 20, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated PR was locked due to age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants