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

Joseph Ziff jziff at
Sun Jun 19 06:55:56 CEST 2011

Hey hackers,

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?

Joseph Ziff <jziff [AT] sindegra [D0T] com>, <jziff [AT] haverford [D0T]
Signed with gnupg 2.0.17 for your convenience.
Go to to retrieve the public key.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20110619/56f28d93/attachment.pgp>

More information about the Gnupg-users mailing list