0478cee6b6
Resolves: #858264
147 lines
8.0 KiB
Diff
147 lines
8.0 KiB
Diff
Subject: Changed tmpdir default to /var/tmp
|
||
|
||
By default, mutt stores drafts in
|
||
/tmp/mutt-$HOSTNAME-$UID-$PID-$REV. /tmp is designed to hold data
|
||
that isn't guaranteed to be preserved between different invocations
|
||
of programmes. For practical purposes, and on Debian at least, this
|
||
translates to files being deleted on every boot, unless TMPTIME is
|
||
amended in /etc/default/rcS and /tmp is not a tmpfs.
|
||
|
||
This behaviour can cause loss of data, e.g. when the laptop dies or
|
||
turns itself off due to low power; the user might not have a chance
|
||
to commit the temporary mail draft s/he was working on to
|
||
non-volatile storage.
|
||
|
||
I suggest that mutt should use /var/tmp by default for its mail
|
||
drafts, as that directory is also temporary in nature, but cleaned
|
||
less frequently than /tmp. More specifically, the FHS dictates that
|
||
"files and directories located in /var/tmp must not be deleted when
|
||
the system is booted."
|
||
|
||
This patch modifies all occurrences of $tmpdir, $TMPDIR and Tempdir, but
|
||
not the documentation, which looks like it's generated from init.h.
|
||
|
||
Patch created by: martin f. krafft <madduck@madduck.net>, submitted to
|
||
http://dev.mutt.org/trac/ticket/3236
|
||
and repaired to be able to apply.
|
||
|
||
Fedora related: Upstream is not willing to change defualt tmpdir,
|
||
because they don't believe /var/tmp is on all supported platforms.
|
||
However, they agree with changing it in distrubution packages.
|
||
More info at http://dev.mutt.org/trac/ticket/3236
|
||
|
||
diff -up mutt-1.5.21/doc/manual.html.tmpdir mutt-1.5.21/doc/manual.html
|
||
--- mutt-1.5.21/doc/manual.html.tmpdir 2012-09-27 15:02:53.455915783 +0200
|
||
+++ mutt-1.5.21/doc/manual.html 2012-09-27 15:04:07.439427603 +0200
|
||
@@ -3090,7 +3090,7 @@ information, notably the type, encoding
|
||
</p><p>
|
||
Attachments appear as follows by default:
|
||
</p><pre class="screen">
|
||
-- 1 [text/plain, 7bit, 1K] /tmp/mutt-euler-8082-0 <no description>
|
||
+- 1 [text/plain, 7bit, 1K] /var/tmp/mutt-euler-8082-0 <no description>
|
||
2 [applica/x-gunzip, base64, 422K] ~/src/mutt-0.85.tar.gz <no description>
|
||
</pre><p>
|
||
The <span class="quote">“<span class="quote">-</span>”</span> denotes that Mutt will delete the file after
|
||
@@ -6944,7 +6944,7 @@ Default: (empty)</p></div><p>
|
||
This variable allows you to specify where Mutt will place its
|
||
temporary files needed for displaying and composing messages. If
|
||
this variable is not set, the environment variable <code class="literal">$TMPDIR</code> is
|
||
-used. If <code class="literal">$TMPDIR</code> is not set then <span class="quote">“<span class="quote"><code class="literal">/tmp</code></span>”</span> is used.
|
||
+used. If <code class="literal">$TMPDIR</code> is not set then <span class="quote">“<span class="quote"><code class="literal">/var/tmp</code></span>”</span> is used.
|
||
</p></div><div class="sect2" title="3.294. to_chars"><div class="titlepage"><div><div><h3 class="title"><a id="to-chars"></a>3.294. to_chars</h3></div></div></div><div class="literallayout"><p>Type: string<br />
|
||
Default: <span class="quote">“<span class="quote"><code class="literal"> +TCFL</code></span>”</span></p></div><p>
|
||
Controls the character used to indicate mail addressed to you. The
|
||
diff -up mutt-1.5.21/doc/manual.txt.tmpdir mutt-1.5.21/doc/manual.txt
|
||
--- mutt-1.5.21/doc/manual.txt.tmpdir 2012-09-27 15:04:20.601518838 +0200
|
||
+++ mutt-1.5.21/doc/manual.txt 2012-09-27 15:04:50.154724683 +0200
|
||
@@ -4524,7 +4524,7 @@ description.
|
||
|
||
Attachments appear as follows by default:
|
||
|
||
-- 1 [text/plain, 7bit, 1K] /tmp/mutt-euler-8082-0 <no description>
|
||
+- 1 [text/plain, 7bit, 1K] /var/tmp/mutt-euler-8082-0 <no description>
|
||
2 [applica/x-gunzip, base64, 422K] ~/src/mutt-0.85.tar.gz <no description>
|
||
|
||
The ?-? denotes that Mutt will delete the file after sending (or postponing, or
|
||
@@ -9746,7 +9746,7 @@ Default: (empty)
|
||
|
||
This variable allows you to specify where Mutt will place its temporary files
|
||
needed for displaying and composing messages. If this variable is not set, the
|
||
-environment variable $TMPDIR is used. If $TMPDIR is not set then ?/tmp? is
|
||
+environment variable $TMPDIR is used. If $TMPDIR is not set then ?/var/tmp? is
|
||
used.
|
||
|
||
3.294. to_chars
|
||
diff -up mutt-1.5.21/doc/Muttrc.tmpdir mutt-1.5.21/doc/Muttrc
|
||
--- mutt-1.5.21/doc/Muttrc.tmpdir 2012-09-27 15:02:16.391661482 +0200
|
||
+++ mutt-1.5.21/doc/Muttrc 2012-09-27 15:02:33.822780695 +0200
|
||
@@ -4515,7 +4515,7 @@ attachments -I message/external-body
|
||
# This variable allows you to specify where Mutt will place its
|
||
# temporary files needed for displaying and composing messages. If
|
||
# this variable is not set, the environment variable $TMPDIR is
|
||
-# used. If $TMPDIR is not set then ``/tmp'' is used.
|
||
+# used. If $TMPDIR is not set then ``/var/tmp'' is used.
|
||
#
|
||
#
|
||
# set to_chars=" +TCFL"
|
||
diff -up mutt-1.5.21/doc/reference.html.tmpdir mutt-1.5.21/doc/reference.html
|
||
--- mutt-1.5.21/doc/reference.html.tmpdir 2012-09-27 15:05:12.288879110 +0200
|
||
+++ mutt-1.5.21/doc/reference.html 2012-09-27 15:05:51.130151344 +0200
|
||
@@ -2804,7 +2804,7 @@ Default: (empty)</p></div><p>
|
||
This variable allows you to specify where Mutt will place its
|
||
temporary files needed for displaying and composing messages. If
|
||
this variable is not set, the environment variable <code class="literal">$TMPDIR</code> is
|
||
-used. If <code class="literal">$TMPDIR</code> is not set then <span class="quote">“<span class="quote"><code class="literal">/tmp</code></span>”</span> is used.
|
||
+used. If <code class="literal">$TMPDIR</code> is not set then <span class="quote">“<span class="quote"><code class="literal">/var/tmp</code></span>”</span> is used.
|
||
</p></div><div class="sect2" title="3.294. to_chars"><div class="titlepage"><div><div><h3 class="title"><a id="to-chars"></a>3.294. to_chars</h3></div></div></div><div class="literallayout"><p>Type: string<br />
|
||
Default: <span class="quote">“<span class="quote"><code class="literal"> +TCFL</code></span>”</span></p></div><p>
|
||
Controls the character used to indicate mail addressed to you. The
|
||
diff -up mutt-1.5.21/init.c.tmpdir mutt-1.5.21/init.c
|
||
--- mutt-1.5.21/init.c.tmpdir 2012-09-27 14:59:10.099395476 +0200
|
||
+++ mutt-1.5.21/init.c 2012-09-27 14:59:23.292484023 +0200
|
||
@@ -2992,7 +2992,7 @@ void mutt_init (int skip_sys_rc, LIST *c
|
||
MailcapPath = safe_strdup ("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap");
|
||
}
|
||
|
||
- Tempdir = safe_strdup ((p = getenv ("TMPDIR")) ? p : "/tmp");
|
||
+ Tempdir = safe_strdup ((p = getenv ("TMPDIR")) ? p : "/var/tmp");
|
||
|
||
p = getenv ("VISUAL");
|
||
if (!p)
|
||
diff -up mutt-1.5.21/init.h.tmpdir mutt-1.5.21/init.h
|
||
--- mutt-1.5.21/init.h.tmpdir 2012-09-27 14:59:46.214638908 +0200
|
||
+++ mutt-1.5.21/init.h 2012-09-27 15:00:21.541877784 +0200
|
||
@@ -3178,7 +3178,7 @@ struct option_t MuttVars[] = {
|
||
** This variable allows you to specify where Mutt will place its
|
||
** temporary files needed for displaying and composing messages. If
|
||
** this variable is not set, the environment variable \fC$$$TMPDIR\fP is
|
||
- ** used. If \fC$$$TMPDIR\fP is not set then ``\fC/tmp\fP'' is used.
|
||
+ ** used. If \fC$$$TMPDIR\fP is not set then ``\fC/var/tmp\fP'' is used.
|
||
*/
|
||
{ "to_chars", DT_STR, R_BOTH, UL &Tochars, UL " +TCFL" },
|
||
/*
|
||
diff -up mutt-1.5.21/install-sh.tmpdir mutt-1.5.21/install-sh
|
||
--- mutt-1.5.21/install-sh.tmpdir 2012-09-27 15:00:32.246950740 +0200
|
||
+++ mutt-1.5.21/install-sh 2012-09-27 15:01:15.957247967 +0200
|
||
@@ -332,7 +332,7 @@ do
|
||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||
;;
|
||
*)
|
||
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||
+ tmpdir=${TMPDIR-/var/tmp}/ins$RANDOM-$$
|
||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||
|
||
if (umask $mkdir_umask &&
|
||
diff -up mutt-1.5.21/muttbug.sh.in.tmpdir mutt-1.5.21/muttbug.sh.in
|
||
--- mutt-1.5.21/muttbug.sh.in.tmpdir 2012-09-27 15:01:37.097392500 +0200
|
||
+++ mutt-1.5.21/muttbug.sh.in 2012-09-27 15:01:52.061494226 +0200
|
||
@@ -85,7 +85,7 @@ esac
|
||
exec > /dev/tty
|
||
exec < /dev/tty
|
||
|
||
-SCRATCH=${TMPDIR-/tmp}/`basename $0`.`hostname`.$$
|
||
+SCRATCH=${TMPDIR-/var/tmp}/`basename $0`.`hostname`.$$
|
||
|
||
mkdir ${SCRATCH} || \
|
||
{
|