Skip to content

Add --no-clobber for explicit --output files - #2340

Closed
VISHNU0906 wants to merge 2 commits into
getsops:mainfrom
VISHNU0906:feat/no-clobber-output-2297
Closed

VISHNU0906 wants to merge 2 commits into
getsops:mainfrom
VISHNU0906:feat/no-clobber-output-2297

Conversation

@VISHNU0906

Copy link
Copy Markdown

Fixes #2297

Adds an opt-in --no-clobber flag for commands that support --output (decrypt, encrypt, rotate, and the legacy top-level flags).

When set with --output, the destination is opened with O_EXCL so an existing file or symlink is left unchanged. Using --no-clobber without --output, or together with --in-place, is rejected. Without the flag, overwrite behavior is unchanged.

Tests cover exclusive create, unchanged existing bytes, symlink targets, overwrite without the flag, and invalid flag combinations.

Opt-in flag fails without changing an existing destination, including
symlinks, by opening the output path with O_EXCL. Rejected without
--output or with --in-place; default overwrite behavior is unchanged.
Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>
@VISHNU0906

Copy link
Copy Markdown
Author

Closing in favor of #2341 — same change recommitted with a DCO Signed-off-by line (the earlier commit was missing it).

@VISHNU0906 VISHNU0906 closed this Nov 6, 2026
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.

Add --no-clobber for explicit output files

1 participant