Skip to content

Decryption does not create a file when data is empty #555

@kautsig

Description

@kautsig

Environment

  • OS: Debian Linux (Linux 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux)
  • age version: 1.1.1

What were you trying to do

Using age in a script to automatically en-/decrypt files in a batch process.

What happened

I can encrypt an empty file, but decryption does not re-create the input.

$ age-keygen -o key.txt
$ echo -n "" | age -r age1xe9fdxsrj6025yxl2yzlpalpmn2yypt3a7ysk4c2hpncq2nt9als8wh7hg > data.age
$ age --decrypt -i key.txt -o empty-file data.age 
$ cat empty-file
cat: empty-file: No such file or directory

This is a problem in scripts, because i have to handle this case specifically. I appended a && touch empty-file as a work around. Still, the behavior was very unexpected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions