ryantm / agenix

age-encrypted secrets for NixOS and Home manager
https://matrix.to/#/#agenix:nixos.org
Creative Commons Zero v1.0 Universal
1.34k stars 108 forks source link

fix truncated output when decrypting a large file to stdout via -d #175

Closed whentze closed 1 year ago

whentze commented 1 year ago

rage intentionally truncates large output when writing to stdout: https://github.com/str4d/rage/blob/55e52c252b4036eb76582c84cbc5b9f6ef23c67f/age/src/cli_common/file_io.rs#L219 but if told to write to "-" instead, it will not truncate: https://github.com/str4d/rage/blob/55e52c252b4036eb76582c84cbc5b9f6ef23c67f/age/src/cli_common/file_io.rs#L312

whentze commented 1 year ago

I tried it locally and it does fix the issue. Should we add a regression test for this?

cole-h commented 1 year ago

I haven't touched our regression tests, but I do think it would be a good idea to make sure we are able to decrypt entire files without truncating. If it's easy to add a test for that, I would encourage you to do so!

whentze commented 1 year ago

Hey, I spent some time thinking about this and didn't find an easy way to write a regression test, or at least not one that doesn't need to change the test setup considerably. Could we merge this fix even without one?