Repository navigation
Conversation
--create-keyfile and --backup-headers opened the destination with O_CREAT|O_TRUNC without checking whether it existed. Recreating an existing keyfile replaced it with new random data, so every volume that used it could no longer be mounted, and an existing file chosen for a header backup was truncated. --create-keyfile now refuses an existing file unless --force is given, without asking, so that scripts are not stopped by a new prompt. The check comes before the random pool is enriched. --backup-headers is interactive and already asks for the file name, so it asks before replacing an existing file, with the prompt of the file dialog of the graphical interface, as text mode already does for new containers (4edad72). --force overwrites without asking. Fixes veracrypt#1962
This was referenced Oct 27, 2026
Tests/test_text_overwrite.py checks overwriting keyfiles and header backups in text mode against the installed package in the Linux workflow.
flatstik
force-pushed
the
fix-1962-text-overwrite
branch
from
October 27, 2026 14:02
697016e to
65f7b2f
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 #1962.
--create-keyfilerefuses an existing file unless--forceis given, without asking, so that scripts are not stopped by a new prompt (as suggested in the issue). The check comes before the random pool is enriched.--backup-headersis interactive and already asks for the file name, so it asks before replacing an existing file, with the prompt of the file dialog of the graphical interface, as text mode already does for new containers (4edad72).--forceoverwrites without asking.Tested:
Tests/test_text_overwrite.py(new, run without root in the Linux workflow): passes on ubuntu-24.04 and ubuntu-26.04, https://github.com/flatstik/VeraCrypt/actions/runs/40497977392; against 1.26.30 it fails the overwrite checks.The new test adds lines next to
test_mount_helper.pyin.github/workflows/build-linux.yml, as do the other PRs split from #1963, so whichever is merged later conflicts there; I will rebase it.Split from #1963, with #1968 (#1958), #1967 (#1959), #1966 (#1960), #1964 (#1961).