Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 63420 - mail-mta/exim FEATURES=distcc - build system sets TMPDIR in src/EDITME
Summary: mail-mta/exim FEATURES=distcc - build system sets TMPDIR in src/EDITME
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-09 06:21 UTC by chris-gentoo
Modified: 2016-02-03 13:50 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge info (emerge.info,1.26 KB, text/plain)
2004-09-09 15:39 UTC, chris-gentoo
Details
exim-4.86-rename-TMPDIR-to-EXIM_TMPDIR.patch (exim-4.86-rename-TMPDIR-to-EXIM_TMPDIR.patch,2.20 KB, patch)
2016-02-03 10:13 UTC, Alexander Tsoy
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description chris-gentoo 2004-09-09 06:21:46 UTC
I have distcc isntalled and configured, it works for other ebuilds. But with exim-4.41, during the build I see (repeatedly)
(dcc_make_tmpnam) ERROR: can't use TMPDIR ""/tmp"": No such file or directory
and then distcc falls back to compiling locally because remote compiling failed.
/tmp exists and is writable by root (which is the user I'm building as)

Reproducible: Always
Steps to Reproduce:
1. Configure and use distcc in FEATURES="...
2. emerge -v =mail-mta/exim-4.41


Actual Results:  
distcc fails to distribute as described above 

Expected Results:  
distcc would write to /tmp and distribute jobs to the two servers I have 
configured.
Comment 1 Lisa Seelye (RETIRED) gentoo-dev 2004-09-09 10:36:51 UTC
please post emerge info
Comment 2 chris-gentoo 2004-09-09 15:39:23 UTC
Created attachment 39274 [details]
emerge info
Comment 3 Lisa Seelye (RETIRED) gentoo-dev 2004-09-09 16:35:10 UTC
Try updating to a more recent version of distcc.  2.16 should have this fixed (which I will move in to x86 shortly)
Comment 4 Malte Starostik 2009-05-04 12:11:29 UTC
Same problem exists (again?) with a current stable distcc-3.0-r4
Comment 5 Tobias Klausmann (RETIRED) gentoo-dev 2011-01-15 11:55:45 UTC
Also broken with distcc-3.1
Comment 6 Alexander Tsoy 2014-05-12 14:05:23 UTC
This is probably a bug in exim's build system. TMPDIR should not be quoted.

Just an example of what is happening here:

$ TMPDIR="\"/tmp\"" mktemp 
mktemp: failed to create file via template '"/tmp"/tmp.XXXXXXXXXX': No such file or directory

The following patch fixes the problem:

--- exim-4.80.1-r2.ebuild.orig        2014-05-12 17:25:43.560403783 +0400
+++ exim-4.80.1-r2.ebuild    2014-05-12 17:25:50.691351764 +0400
@@ -137,6 +137,7 @@
                -e "s:EXIM_MONITOR=eximon.bin:# EXIM_MONITOR=eximon.bin:" \
                -e "s:ZCAT_COMMAND=.*$:ZCAT_COMMAND=${EPREFIX}/bin/zcat:" \
                -e "s:COMPRESS_COMMAND=.*$:COMPRESS_COMMAND=${EPREFIX}/bin/gzip:" \
+               -e "s:TMPDIR=.*$:TMPDIR=/tmp:" \
                src/EDITME > Local/Makefile
 
        cd Local
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2014-09-30 22:11:12 UTC
(In reply to Alexander Tsoy from comment #6)
> This is probably a bug in exim's build system. TMPDIR should not be quoted.

Maybe it shouldn't be set at all, or moved to a safe namespace using a prefix.

> Just an example of what is happening here:
> 
> $ TMPDIR="\"/tmp\"" mktemp 
> mktemp: failed to create file via template '"/tmp"/tmp.XXXXXXXXXX': No such
> file or directory
> 
> The following patch fixes the problem:
> 
> --- exim-4.80.1-r2.ebuild.orig        2014-05-12 17:25:43.560403783 +0400
> +++ exim-4.80.1-r2.ebuild    2014-05-12 17:25:50.691351764 +0400
> @@ -137,6 +137,7 @@
>                 -e "s:EXIM_MONITOR=eximon.bin:# EXIM_MONITOR=eximon.bin:" \
>                 -e "s:ZCAT_COMMAND=.*$:ZCAT_COMMAND=${EPREFIX}/bin/zcat:" \
>                 -e
> "s:COMPRESS_COMMAND=.*$:COMPRESS_COMMAND=${EPREFIX}/bin/gzip:" \
> +               -e "s:TMPDIR=.*$:TMPDIR=/tmp:" \

Looking at 4.84, src/EDITME has that already:

TMPDIR="/tmp"

Shouldn't that be TMPDIR="${T}" (and the variable name maybe replaced with GENTOO_EXIM_TMPDIR?
Comment 8 Alexander Tsoy 2014-09-30 22:38:48 UTC
(In reply to Jeroen Roovers from comment #7)
> (In reply to Alexander Tsoy from comment #6)
> > This is probably a bug in exim's build system. TMPDIR should not be quoted.
> 
> Maybe it shouldn't be set at all, or moved to a safe namespace using a
> prefix.
> 
> > Just an example of what is happening here:
> > 
> > $ TMPDIR="\"/tmp\"" mktemp 
> > mktemp: failed to create file via template '"/tmp"/tmp.XXXXXXXXXX': No such
> > file or directory
> > 
> > The following patch fixes the problem:
> > 
> > --- exim-4.80.1-r2.ebuild.orig        2014-05-12 17:25:43.560403783 +0400
> > +++ exim-4.80.1-r2.ebuild    2014-05-12 17:25:50.691351764 +0400
> > @@ -137,6 +137,7 @@
> >                 -e "s:EXIM_MONITOR=eximon.bin:# EXIM_MONITOR=eximon.bin:" \
> >                 -e "s:ZCAT_COMMAND=.*$:ZCAT_COMMAND=${EPREFIX}/bin/zcat:" \
> >                 -e
> > "s:COMPRESS_COMMAND=.*$:COMPRESS_COMMAND=${EPREFIX}/bin/gzip:" \
> > +               -e "s:TMPDIR=.*$:TMPDIR=/tmp:" \
> 
> Looking at 4.84, src/EDITME has that already:
> 
> TMPDIR="/tmp"

Yes. And my patch remove quotes.

> 
> Shouldn't that be TMPDIR="${T}" (and the variable name maybe replaced with
> GENTOO_EXIM_TMPDIR?

TMPDIR in Local/Makefile sets temporary directory path used by exim at runtime if TMPDIR env variable is not defined.
Comment 9 Alexander Tsoy 2014-10-01 06:13:13 UTC
(In reply to Alexander Tsoy from comment #8)

> > Shouldn't that be TMPDIR="${T}" (and the variable name maybe replaced with
> > GENTOO_EXIM_TMPDIR?
> 
> TMPDIR in Local/Makefile sets temporary directory path used by exim at
> runtime if TMPDIR env variable is not defined.

s/not defined/defined/
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2015-08-25 04:16:27 UTC
Still not fixed, then...
Comment 11 Fabian Groffen gentoo-dev 2016-02-01 19:51:50 UTC
not sure why distcc is doing anything with TMPDIR here

in any case, it's a runtime var, not a compile-time var

the use is somewhat odd though, it looks as if they want to set TMPDIR to a hard-coded path resetting whatever was in the environment if set, probably security related

dropping the quotes from "/tmp" should break the build, as it is used directly in code, hence I don't understand comment #6.

If someone with distcc could attach a full buildlog maybe I can see something.
Comment 12 Alexander Tsoy 2016-02-02 16:55:58 UTC
(In reply to Fabian Groffen from comment #11)

This is a clash between standard environment variable name and a macro name.
TMPDIR is exported by portage and then redefined in Makefile. Minimal reproducer:

$ cat Makefile 
TMPDIR="/tmp"
all:
        /usr/bin/env
$ export TMPDIR=test
$ make | grep ^TMPDIR
TMPDIR="/tmp"


This TMPDIR *with quotes* is picked by distcc which results in errors like:

distcc[9034] (dcc_make_tmpnam) ERROR: can't use TMPDIR ""/tmp"": No such file or directory
distcc[9034] (dcc_build_somewhere) Warning: failed to distribute, running locally instead
Comment 13 Alexander Tsoy 2016-02-02 17:09:45 UTC
(In reply to Fabian Groffen from comment #11)

> dropping the quotes from "/tmp" should break the build, as it is used
> directly in code, hence I don't understand comment #6.

It doesn't break the build, but I agree that workaround from comment #6 is incorrect.
Comment 14 Alexander Tsoy 2016-02-02 21:37:30 UTC
I created pull request:
https://github.com/Exim/exim/pull/40
Comment 15 Fabian Groffen gentoo-dev 2016-02-03 09:22:41 UTC
I agree with that approach, it's just that the patch applies neither to 4.86 nor to 4.87_rc3.
Comment 16 Alexander Tsoy 2016-02-03 10:13:13 UTC
Created attachment 424528 [details, diff]
exim-4.86-rename-TMPDIR-to-EXIM_TMPDIR.patch

Yes, git repository and release tarballs has different directory layout. I tested attached patch with 4.86-r2 and 4.87_rc3.
Comment 17 Fabian Groffen gentoo-dev 2016-02-03 13:50:22 UTC
pushed, thanks!