Page MenuHome GnuPG

gpgtar: Does not allow decryption from stdin
Closed, ResolvedPublic

Description

I see no way to decrypt an archive passed to gpgtar via stdin.

$ gpgtar --version
gpgtar (GnuPG) 2.4.1-beta7

$ gpgtar --decrypt <~/dev/g10/testdata/decrypt-me-sym.tar.asc 
Usage: gpgtar [options] [files] [directories] (-h for help)

$ gpgtar --decrypt - <~/dev/g10/testdata/decrypt-me-sym.tar.asc 
gpg: decrypt_message failed: Unknown system error
gpgtar: error reading '[?]': premature EOF (size of last record: 0)

$ ls -lR -- -_1_
-_1_:
total 0

The following patch avoids the usage message:

diff --git a/tools/gpgtar.c b/tools/gpgtar.c
index 8461666b9..252d80c1d 100644
--- a/tools/gpgtar.c
+++ b/tools/gpgtar.c
@@ -531,7 +531,7 @@ main (int argc, char **argv)
       break;
 
     case aDecrypt:
-      if (argc != 1)
+      if (argc > 1)
         gpgrt_usage (1);
       if (opt.outfile)
         log_info ("note: ignoring option --output\n");

Update: If I omit the --dry-run option, then passing no filename to gpgtar works. So, applying the above patch fixes the problem and matches the check for --list-archive and the behavior of gpgtar without crypto operations.

Event Timeline

ikloecker created this task.
werner moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jan 26 2023, 12:02 PM
werner added projects: gnupg24, gnupg22.
werner moved this task from Backlog to QA on the gnupg22 board.
werner moved this task from Backlog to QA on the gnupg24 board.

Works for me with gpgtar (GnuPG) 2.4.1-beta21. I haven't verified this with 2.2.x.

werner moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Apr 3 2023, 12:58 PM
werner edited projects, added gnupg24 (gnupg-2.4.1); removed gnupg24.

works with gpgtar (GnuPG) 2.2.42-beta102, too

ebo moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Apr 5 2023, 12:54 PM