Kleopatra crashes on large files

GPG4win (v3.1.3 on Windows 10 64bit) seemed to work flawlessly. I could encrypt, sign and decrypt files via context menu, via drag and drop to Kleopatra, as well as via gpg command line.

When I tried decrypting a large file (approx. 8 GB encrypted, approx. 34 GB decrypted) Kleopatra crashed after about 5 minutes of decryption with the following statement (see attachment):

“Fehlermeldung der GnuPG Benutzerschnittstelle (Kleopatra):\r End of file”
Tanslated to English:
“Error message of GnuPG user interface (Kleopatra):\r End of file”

With this event gpg.exe and kleopatra.exe vanished from the task list while gpg-agent.exe was still alive.

I tried to decrypt the large file via command line (gpg -d “infile” > “outfile”) which worked perfectly. I also tried to decrypt another file with an encrypted size of approx. 1.3GB via the context menu which also worked flawlessly.

I then tried to change default-cache-ttl and max-cache-ttl in gpg-agent.conf to higher values, but this did not change the beaviour.

I also recognized that when using the command line the output file is directly written to the folder containing the input file and the free space on this drive shrinked accordingly to the decryption progress.
However, when decrypting via context menu, Kleopatra obviously uses some Windows folder (c:\Users<username>\AppData\Local\Temp) as a temporary folder for decryption. I did not recognize a reduction of free space on drive c: as I would expect. Nevertheless there was plenty of space available on drive c:.

Also the progress bar while enrypting or decrypting is dependent on file size. On smaller files (e.g. 1.3GB) it displays the percentage of progress. On larger files it shows no percentage.

I then tried to use an older gpg4win (v3.0.0) but the issue was still there.

What could be the rasons for this crash? How can I find out? How can I manage to make gpg4win also work with large files?

Any help is highly appreciated.
Alex

Error.png

It should work with such files. We had problems in the past with files larger then 4GiB but to our knowledge they are fixed. I’ll give it a try to see if I can reproduce the crash (The error means that Kleopatra has crashed).

Kleopatra obviously uses some Windows folder (c:\Users<username>\AppData\Local\Temp) as a temporary folder for decryption.

  1. Is there anything unusual about that folder on your system. E.g. does it live on a Network Share?

  2. You can change that behavior in Kleopatra → Settings → Configure Kleopatra → Crypto Operations. Check “Create temporary decrypted files in the folder of the encrypted file”

Kleopatra uses temporary files during decryption so that a possible file with the same name is only overwritten on success. On the command line you control such things manually.

Andre, thank you for your response.

The issue still exists when enabling the option “Create temporary decrypted files in the folder of the encrypted file”. The encrypted file resides on drive d: which is a conventional hard drive. When disabling the option again the temporary folder c:\Users<username>\AppData\Local\Temp" is used, which resides on a standard SSD.

As far as I can tell, there is nothing unusual with the drive containing the Temp folder and nothing unusual with drive d:. There is far more space available as needed on both drives.

But I found out something interesting:

When encrypting a huge “tar” file, decryption fails as described. When renaming the huge tar file to e.g. “xar” before encrytion, decryprion works fine. So - at a first gance - it seems as Kleopatra does not properly decrypt huge encrypted tar files.

In particular:

I encrypted a 36 Gb sized file named “basename.tar”. Encryption worked fine. On decryption a SUBFOLDER named “c:\Users<username>\AppData\Local\Temp\kleopatra-mlqSRk\basename.tar_1_” was created in the temporary folder which held no files. There was no sign that the decryption process would allocate any disk space. After a few minutes of decryption Kleopatra crashed as described. Enabling the option “Create temporary decrypted files in the folder of the encrypted file” does not prevent Kleopatra from crashing.

Then I simply renamed the 36 Gb sized file “basename.tar” to “basename.xar” and encrypted it. Encryption worked fine. On decryption a FILE named “c:\Users<username>\AppData\Local\Temp\kleopatra-amRdIQ\basename.xar.fwOLLL” was created in the temporary folder which increased in size as the decryption process proceeded. Decryption finished successfully.

So, it seems, Kleopatra behaves differently when decrypting encrypted (large) tar-files. As a workaround I now zip large tar files before encrypting it. Then, when decrypting, Kleopatra does the job well.

Another issue, which seems to be related:

I also encountered that Kleopatra tries to do an untar on decryption. For example: I have a small tar-File named “basename.tar” containing a folder named “XY” with some small files in “XY” and encrypt this tar file. The result is a encrypted file named “basename.tar.gpg”. When I decrypt this “basename.tar.gpg”, Kleopatra does not create a file named “basename.tar” as I would expect. But Kleopatra produces a new folder named “basename” containing the folder “XY” as well as the files of “XY”. So, Kleopatra obviously untared the tar file upon decrytion. I consider that this is the reason why Kleopatra crashes on the decryption of large tar files. Somehow it tries to untar it during the decryption process, but cannot fully untar it for reasons unknown to me and finally crashes. This does not happen with zipped or gzipped files. It seems to happen only with tarred files. And it also works on the command line, why I suspect to be a Kleopatra related issue.

This behaviour might be intentional, but but in my humble opinion it is highly confusing and not what I would expect Klkeopatra to do. Why would Kleopatra untar the tar files if I just want Kleopatra to decrypt it? Can this untarring be suppressed somehow?

Regards
Alex

Thanks for the detailed writeup. I’ve opened a task for this issue: https://dev.gnupg.org/T4180 A fix for this will probably not happen for the next release as we hope to release this week. So I’m glad that you find a workaround.

Regarding: “This behaviour might be intentional, but but in my humble opinion it is highly confusing and not what I would expect Klkeopatra to do. Why would Kleopatra untar the tar files if I just want Kleopatra to decrypt it? Can this untarring be suppressed somehow?”

Currently there is no option to disable untarring (It might be possible by editing libkleopatrarc in C:\Program Files\Gpg4win\etc\xdg )

I think there should be an option to disable it. I opened https://dev.gnupg.org/T4181

But I consider the default decrypt + untar good. Most users decrypt to access data and then they also want the tarball extracted. Also tar is not native or common on Windows so a user might not have a software available to untar after decryption.

Regards,
Andre

Andre, thank you for following up on this issue. Also thank you for the information, that this behaviour could be supressed by editing C:\Program Files\Gpg4win\etc\xdg\libkleopatrarc. I commented out the “unpack-command-…” lines in libkleopatrarc and no untarring occurs anymore.

Would be great to have an option in a future release, as you suggested.

Regards
Alexander