Repository navigation
fix(core-storage): copy history.db into a name that does not exist yet - #4564
Merged
Merged
Conversation
datlechin
enabled auto-merge (squash)
November 25, 2026 19:52
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.
Summary
keep_databaseno longer makes an empty.partialbeforeVACUUM INTO. SQLite creates the file, under a name that is free.vacuum_into_new_filerefuses a target that already exists before SQLite sees it, then sets the new copy to 0600. The SQLite docs allow an existing empty target (VACUUM INTO). Apple's 3.54.0 in macOS 27 and the iOS 27.1 SDK refuses it ("output file already exists"), and upstream writes into it. With the check, every SQLite build behaves the same.src/vacuum.cstill refuses onlysize > 0in 3.54.1, and the 3.54.0 release notes do not mention VACUUM. Apple's build (source id endingaapl, dated 2026-04-09) refuses an existing target whether it is empty or not, with defensive mode on or off.linux/docs/storage.md, Copies before a format upgrade: describes the new staging.storageDir: nil. Linux (Ubuntu 26.04 and 26.10, Fedora 44 and 45, GNOME 51 Flatpak) and Windows (bundled 3.54.1) all accept the empty file. Without this fix, a core-backed history on macOS 27 or iOS 27 would fail to open after every upgrade that adds a migration.Test plan
upgrade_copies::tests::the_copy_step_takes_only_a_name_that_is_free: an existing empty target is refused and left at 0 bytes, on every SQLite build. A free name gets a 0600 copy that holds the schema.tablepro-storagetests fail with "output file already exists". With this change, all 373 pass.verify.sh --platform linux --jobs 4:test tablepro-storagepasses 383 of 383, andlintis clean. The fulltestwas INCONCLUSIVE twice: the 8 GB Docker VM OOM-killed rustc on the app's lib test before any suite ran. CI's Linux fast checks run that suite.cargo clippy -p tablepro-storage --all-targets -- -D warningsis clean.VACUUM INTOon a missing target, an empty file and a non-empty file. Apple 3.54.0 accepts only the missing target. Upstream 3.51.3 and 3.54.1 accept the missing target and the empty file.