tag 569500 + patch
thanks

On Fri, Feb 12, 2010 at 12:35:17AM +0100, E. Prom wrote:
> I've noticed that several (all?) attachments I've seen from received e-mail 
> are
> not deleted from the temp folder (user-defined, not /tmp) after exiting mutt.
> Happened lastly for a mp3 file, opened by mailcap : audio/*; /usr/bin/mplayer
> %s
> 
> I'm quite sure this started happening after update to 1.5.20-7, whichs 
> includes
> «
>     + upstream/528233-readonly-open.patch: open attachments in read-only
>       (Closes: 528233)
> »

I've been seeing this too and it is indeed caused by that patch.  At the
end of mutt_view_attachment, mutt_unlink is called which tries to open
the temp file O_RDWR.  This fails due to the chmod 0400 added by the
patch.

Attached is an updated version of the patch which fixes the problem.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
Open attachments as read-only so the editor won't be able to modify it;
otherwise the user can believe that he/she can edit it and risk to lose his/her
work (see upstream bug http://bugs.mutt.org/3261)

--- a/attach.c
+++ b/attach.c
@@ -494,6 +494,7 @@
 	goto return_error;
     }
 
+    chmod (tempfile, 0400);
     use_pipe = rfc1524_expand_command (a, tempfile, type,
 				       command, sizeof (command));
     use_pager = entry->copiousoutput;
@@ -633,9 +634,15 @@
   if (entry)
     rfc1524_free_entry (&entry);
   if (fp && tempfile[0])
+  {
+    chmod (tempfile, 0600);
     mutt_unlink (tempfile);
+  }
   else if (unlink_tempfile)
+  {
+    chmod (tempfile, 0600);
     unlink(tempfile);
+  }
 
   if (pagerfile[0])
     mutt_unlink (pagerfile);

Attachment: signature.asc
Description: Digital signature

Reply via email to