gpg fails to decrypt files encrypted to the same name as the original input

Jerome Baum jerome at jeromebaum.com
Sun Jun 19 20:32:58 CEST 2011


> I noticed this very interesting behavior in my version of gpg (2.0.17):
>
> 1. take a simple text file and call it say test.txt, encrypt it to a
> file named test.txt in the same directory so that it overwrites it. (gpg
> -o test.txt -e test.txt)
> 2. decrypt file test.txt with gpg (gpg -d test.txt) and get gibberish.
>
> It does not seem to happen when I have the output renamed to something
> else. I know this is a highly unusual (and probably ineffective way) of
> using gpg but I still thought it was interesting that it would fail. Any
> thoughts on this (potential) bug? Can anyone else recreate it, or is it
> actually a feature/unavoidable side-effect?

That's actually quite common for software to do. There are a few
notable exceptions (sort(1) comes to mind), but it's not something you
normally have to worry about. People tend to append ".gpg" anyway. :)

-- 
Jerome Baum
tel +49-1578-8434336
email jerome at jeromebaum.com
web www.jeromebaum.com
--
PGP: A0E4 B2D4 94E6 20EE 85BA E45B 63E4 2BD8 C58C 753A
PGP: 2C23 EBFF DF1A 840D 2351 F5F5 F25B A03F 2152 36DA



More information about the Gnupg-users mailing list