GNUPG CLI endless loop when using --batch and --decrypt on detached signature file

Harakiri harakiri_23 at
Tue Apr 21 17:25:41 CEST 2009

When automatically processing files, i found that gnupg has an endless loop from stdin expecting something but no matter what you enter, it will never quit.

1. using -verify

gpg --no-options --batch --status-fd 2 --yes --output out.out --verify
gpg: no signed data
gpg: can't hash datafile: file open error

this is fine, gpg exits, and returns an error (i need to supply the signed data file)

2. using -decrypt without batch on detached signature file

gpg --no-options --status-fd 2 --yes --output out.out --decrypt
Detached signature.
Please enter name of data file: <file>
No such file, try again or hit enter to quit.

OK i should enter something and can quit with <enter>.

3. now using -decrypt with batch on detached signature file 

gpg --no-options --status-fd 2 --batch --yes --output out.out --decrypt

i can enter what i want - gnupg will never quit - adding --debug-all or -v doesnt reveal anything, only control c will quit - but this doesnt help in a batch processing cronjob or similar.

I know that --decrypt is not suited for detached signature files but im talking about batch processing here and i dont have control what files are were - at the very least GPG should quit with an error because of --status-fd 2. According to DETAILS.txt this would be the best case for

        Unexpected data has been encountered
            0 - not further specified               1


More information about the Gnupg-users mailing list