Hi everyone,

On Sun, Jul 06, 2025 at 12:32:09PM +0000, Holger Levsen wrote:
> On Sun, Jul 06, 2025 at 12:47:36PM +0100, Richard Lewis wrote:
> > On Sun, 6 Jul 2025 at 12:01, Holger Levsen <hol...@layer-acht.org> wrote:
> > > bsd-mailx
> > 
> > i'm not sure, but i think this may be the problem --- looking at
> > https://salsa.debian.org/debian/bsd-mailx/-/blob/master/send.c and
> > https://salsa.debian.org/debian/bsd-mailx/-/blob/master/debian/patches/02-Base-fixes-1.patch
> > it seems debian has patched bsd-mailx to hardcode /tmp (im not sure
> > about this, i only read the code on salsa, and couldnt spot where the
> > directory was set)?
> 
> ic!

I've come along and done the easy bit... the attached patch causes mailx
to honour the TMPDIR environment variable, if set. Does this do enough
to fix your originally-failing scenario?

(I don't see that Debian overrode anything so much as setting an
otherwise undefined but required build-time definition for the default.)

Andrew
From fe60bc9a58b31197791451097cf3550fb5542b85 Mon Sep 17 00:00:00 2001
From: Andrew Bower <and...@bower.uk>
Date: Wed, 9 Jul 2025 22:44:53 +0100
Subject: [PATCH] Patch to honour TMPDIR. (Closes: #1108377)

All the hard work was done diagnosing the issue by Richard Lewis and Holger
Levsen on the BTS; the patch was the easy bit!
---
 debian/patches/36-Honour-TMPDIR.patch | 26 ++++++++++++++++++++++++++
 debian/patches/series                 |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 debian/patches/36-Honour-TMPDIR.patch

diff --git a/debian/patches/36-Honour-TMPDIR.patch b/debian/patches/36-Honour-TMPDIR.patch
new file mode 100644
index 0000000..dfb0012
--- /dev/null
+++ b/debian/patches/36-Honour-TMPDIR.patch
@@ -0,0 +1,26 @@
+From: Andrew Bower <and...@bower.uk>
+Date: Wed, 9 Jul 2025 22:28:37 +0100
+Bug-Debian: https://bugs.debian.org/1108377
+Forwarded: no
+Subject: Honour TMPDIR environment variable
+
+Thanks: diagnosis by Richard Lewis and Holger Levsen.
+
+---
+ temp.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/temp.c b/temp.c
+index b2c6308..b88aaa4 100644
+--- a/temp.c
++++ b/temp.c
+@@ -47,7 +47,8 @@ tinit(void)
+ {
+ 	char *cp;
+ 
+-	tmpdir = _PATH_TMP;
++	if ((tmpdir = getenv("TMPDIR")) == NULL)
++		tmpdir = _PATH_TMP;
+ 	if ((tmpdir = strdup(tmpdir)) == NULL)
+ 		err(1, "strdup");
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 52353b6..d2af381 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -32,3 +32,4 @@
 33-Add-MIME-headers.patch
 34-Fix-strnvis.patch
 35-Fix-new-warnings-and-error.patch
+36-Honour-TMPDIR.patch
-- 
2.50.0

Attachment: signature.asc
Description: PGP signature

Reply via email to