age -o keeps a symlink, pipe, device or redirected stream at the path (closes #59)
check / check (push) Failing after 2s

age encrypt -o and age decrypt -o now look at the -o path before writing. A path that is the same file as the tool's standard output or standard error, under any name, is written to that stream, so a redirected file keeps its contents, inode and mode. A new path or a regular file is written beside it and renamed over it, as before, with the signal handling of #48. A symlink gets the same rule for what it points at, so the link survives; a dangling one is refused. A named pipe or a device is written directly. The README says a replaced file gets mode 0600.

Rule suppressed: gosec G304 on the direct open of the -o path.

Model: opus-5-5
This commit was merged in pull request #60.
This commit is contained in:
2026-10-04 16:59:02 +02:00
parent dad29597bd
commit 5b36e42e4d
4 changed files with 236 additions and 17 deletions
+2 -1
View File
@@ -85,7 +85,8 @@ func init() {
// signals to clean up first: "ssh to" and "ssh install" while they
// have ssh or sftp running, so the child ends and their own cleanup
// still runs, and "age encrypt -o" and "age decrypt -o" while they
// write, so the unfinished file is removed.
// write a new file to rename over the named one, so the unfinished file
// is removed.
func Main() int {
err := Root().Execute()
if err == nil {