Skip to content

fix(filesystem): open db file for writing in get_db_write#309

Open
allamiro wants to merge 1 commit into
lixmal:masterfrom
allamiro:fix/filesystem-write
Open

fix(filesystem): open db file for writing in get_db_write#309
allamiro wants to merge 1 commit into
lixmal:masterfrom
allamiro:fix/filesystem-write

Conversation

@allamiro

@allamiro allamiro commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #273 (the latent bug part).

Problem

Filesystem::get_db_write opened the target with File::open — read-only — so writes could never succeed. Latent today because KeePass::to_backend is dead code, but it blocks all future write/save support.

Changes

  • File::create instead of File::open
  • new write_roundtrip test (write through the backend, read back) — fails with EBADF before the fix

Out 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.

Review in cubic

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.
@allamiro allamiro force-pushed the fix/filesystem-write branch from 13d2c07 to 1179d30 Compare June 13, 2026 00:17
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.

Filesystem db backend opens file read-only in get_db_write; save path is dead code

1 participant