Repository navigation
fix: warn about overwriting in blob sign only when the signature file exists - #1381
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
… exists notation blob sign --force printed "Warning: existing signature file will be overwritten" even when no signature file existed. The success message also printed a stray space at the start of the "Signature file written to" line. Print the overwrite warning only when the signature file exists, and remove the stray space. Signed-off-by: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com>
RaphaelFakhri
requested review from
NiazFK,
gokarnm,
priteshbandi,
rgnote,
shizhMSFT,
toddysm,
vaninrao10 and
yizha1
as code owners
November 3, 2026 10:28
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.
What this PR does
notation blob sign --forceprintsWarning: existing signature file will be overwritteneven when no signature file exists at the target path. The--forcebranch skips the existence check that the prompt branch uses.This PR checks for an existing signature file first, then either prompts (without
--force) or prints the warning (with--force). This matchesnotation blob policy importandnotation blob policy init, which warn only when a configuration already exists.It also removes a stray space after the newline in the success message. Before this change, the output was:
The output now matches
specs/cmd/blob.md.Testing
TestBlobSignCommand_ForceOutputsigns a blob twice with--forceusing a generated self-signed key:Without the fix, the test fails on the stray space, and with only the space fix applied, it fails on the spurious warning. With the fix, it passes.
Fixes #1380