[Mutt] #3261: mutt should open attachment as read-only file for external viewer
#3261: mutt should open attachment as read-only file for external viewer
------------------------------+---------------------------------------------
Reporter: antonio@xxxxxxxx | Owner: mutt-dev
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: mutt | Version:
Keywords: |
------------------------------+---------------------------------------------
Forwarding from http://bugs.debian.org/528233
{{{
Hi,
I have encountered a little bit awkward behavior when mutt opens
attachment in external viewer (according to mailcap). The problem is
caused by mutt creating read-write temp file for the attachment which can
be misinterpreted by viewer to enable editing as well.
I do understand that viewer is not supposed to enable editing, but this
is happening. Just as one example consider OpenOffice and doc/odt
attachment. I ended up with lost changes (2h of work) because I thought
that mutt would keep the file if it had been changed after opening.
If the tmp file was read-only from the beginning then even editor
wouldn't allow me to edit it.
I have hacked my use case by the following simple patch:
--- mutt-1.5.18.orig/attach.c 2009-05-11 17:22:38.000000000 +0200
+++ mutt-1.5.18/attach.c 2009-05-11 17:24:24.000000000 +0200
@@ -494,6 +494,11 @@ int mutt_view_attachment (FILE *fp, BODY
goto return_error;
}
+ /* chmod tmp file to read-only because we don't want to enable
+ * viewers which are editors as well to change the content which
+ * will be thrown away after we close it.
+ */
+ chmod(tempfile, 0400);
use_pipe = rfc1524_expand_command (a, tempfile, type,
command, sizeof (command));
use_pager = entry->copiousoutput;
I don't consider it to be the real fix, but maybe it can help with
resolution.
Thanks in advance.
}}}
--
Ticket URL: <http://dev.mutt.org/trac/ticket/3261>
Mutt <http://www.mutt.org/>
The Mutt mail user agent