This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 683
fix: fix db write error on partitioned drives #548
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
davidmurdoch
force-pushed
the
fix/db-partition-error
branch
from
February 8, 2020 20:40
8978a14
to
17cece5
Compare
nicholasjpaterno
approved these changes
Feb 11, 2020
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.
LGTM!
I've tested this manually by setting the |
nicholasjpaterno
approved these changes
Feb 12, 2020
@@ -11,6 +11,7 @@ function FileDown(location) { | |||
this.location = location; | |||
const tmpDir = path.join(location, "_tmp"); | |||
try { | |||
// Fixes https://github.com/trufflesuite/ganache/issues/1617 |
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.
👍
1 task
This was referenced Jun 6, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an attempt to fix https://github.com/trufflesuite/ganache/issues/1617
If the user's tmp dir and ganache's db directory is not located on the same drive/partition then db file writes fail. This fixes that issue by ensuring the tmp directory is one we control (obviously this means automatic tmp file deletion by the os won't happen in cases where the user has supplied their own db path (like Ganache UI does automatically), but we don't need to worry about that unless ganache crashes, and even then, I don't think it is an issue as only a few key/value files would accumulate there in these exceptional circumstances).
All that said... I haven't yet tested this since it requires some filesystem shenanigans I don't want to set up on a Saturday afternoon.
TODO before merging: actually test that this fixes anything. :-D