age icon indicating copy to clipboard operation
age copied to clipboard

Decryption does not create a file when data is empty

Open kautsig opened this issue 1 year ago • 0 comments

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.

kautsig avatar Mar 26 '24 08:03 kautsig