Bug 3238

Summary: GPG Mime Plugin exports contents to a tmpfile unnecessarily
Product: Claws Mail (GTK 2) Reporter: Kevin Day <thekevinday>
Component: Plugins/Privacy/PGPAssignee: users
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P3    
Version: 3.10.1   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
A patch to claws-mail to use gpgme_data_new_from_filepart() instead of gpgme_data_new_from_file().
none
Fixed version where file pointer is correctly closed none

Description Kevin Day 2014-07-31 16:47:06 UTC
Created attachment 1419 [details]
A patch to claws-mail to use gpgme_data_new_from_filepart() instead of gpgme_data_new_from_file().

(I didn't see a Plugins/PGPCore option, hopefully Plugins/Privacy is correct enough.)

The code in src/plugins/pgpcore/sgpgme.c creates a tmpfile to populate the gpgme_data_t variable.

The function currently being called is: gpgme_data_new_from_file().

The mime data already contains the e-mail file and the relevant mime coordinates, so why not just use the function gpgme_data_new_from_filepart()?

Creating a tmpfile seems unneccessary and wastefull.
Especially when one runs off a flashdisk that has a limited number of writes!

Or perhaps on a read-only filesystem, when one needs to check e-mails but not download any new ones?
Comment 1 Paul 2014-08-01 07:52:56 UTC
Thanks! Now applied!
Comment 2 Kevin Day 2014-08-01 16:52:02 UTC
Created attachment 1420 [details]
Fixed version where file pointer is correctly closed

I just noticed that the file pointer wasn't properly closed after my changes.

The code that I removed included the closing of fp (which is the original file and not the temporary file). That file was opened at the start of the function.