fix(filesystem): open db file for writing in get_db_write#309
Open
allamiro wants to merge 1 commit into
Open
Conversation
File::open opens read-only, so any attempt to save the database through the filesystem backend failed with EBADF. Use File::create. The save path itself (KeePass::to_backend) is still unused by the API; wiring it up is part of the write-support feature work.
13d2c07 to
1179d30
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #273 (the latent bug part).
Problem
Filesystem::get_db_writeopened the target withFile::open— read-only — so writes could never succeed. Latent today becauseKeePass::to_backendis dead code, but it blocks all future write/save support.Changes
File::createinstead ofFile::openwrite_roundtriptest (write through the backend, read back) — fails with EBADF before the fixOut of scope, noted for the write-support feature work: atomic save (write to temp + rename) and conflict detection when the kdbx changed externally.
Testing
cargo test: 10/10 pass (1 new).Summary by cubic
Open the database file for writing in the filesystem backend to fix EBADF errors on save and unblock future write support. Adds a write_roundtrip test that writes via the backend and reads it back.
Written for commit 13d2c07. Summary will update on new commits.