Page MenuHome GnuPG

Gpgtar creates dirs named "-_1_" when decrypting from stdin
Closed, ResolvedPublic

Description

Kleopatra passes data to gpgtar in a pipe and uses --set-filename to set a filename hint. In the past that worked. Nowadays gpgtar ignores the --set-filename and uses the "filename" of stdin "-"
Omiting the "-" from the gpgtar command results in an error as it needs a filename.

My fix would be to respect the explicit --set-filename before using the implicit filename:

diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c
index b0e17cb10..8613d193f 100644
--- a/tools/gpgtar-extract.c
+++ b/tools/gpgtar-extract.c
@@ -345,21 +345,21 @@ gpgtar_extract (const char *filename, int decrypt)
     dirname = xtrystrdup (opt.directory);
   else
     {
-      if (filename)
+      if (opt.filename)
         {
-          dirprefix = strrchr (filename, '/');
+          dirprefix = strrchr (opt.filename, '/');
           if (dirprefix)
             dirprefix++;
           else
-            dirprefix = filename;
+            dirprefix = opt.filename;
         }
-      else if (opt.filename)
+      else if (filename)
         {
-          dirprefix = strrchr (opt.filename, '/');
+          dirprefix = strrchr (filename, '/');
           if (dirprefix)
             dirprefix++;
           else
-            dirprefix = opt.filename;
+            dirprefix = filename;
         }
 
       if (!dirprefix || !*dirprefix)

It's fine with me to only fix it in master (although i would prefer it in stable as this is windows relevant) as I have a "workaround" in kleopatra that kleopatra renames the folder after extraction but that does not work well if multiple archives are extracted together (due to internal Kleopatra cpp abuse)-

Details

Version
master

Event Timeline

You could use the --directory option. However< I agree that your suggested changes is less surprising then the current behaviour. Thus I would consider this a bug fix. Can you please apply to 2.2?

I also noted tha we don't have a man page for gpgtar. This needs to be fixed as well.

aheinecke claimed this task.

Pushed to 2.2