Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 174061

Summary: emktemp can be without conditional FreeBSD code
Product: Gentoo Linux Reporter: Fabian Groffen <grobian>
Component: EclassesAssignee: SpanKY <vapier>
Status: RESOLVED FIXED    
Severity: enhancement CC: grobian, haubi
Priority: High    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emktemp.patch

Description Fabian Groffen gentoo-dev 2007-04-10 17:54:12 UTC
Michael Haubenwallner writes:

...

So, here comes $USERLAND into account:
When USERLAND != GNU, mktemp is assumed being BSD-mktemp, and is called
"mktemp -t tmp".

Now look the difference (I've access to some FreeBSD machine):

    FreeBSD $ mktemp -t tmp
    /tmp/tmp.WHZmcERq

    Linux $ mktemp -t tmp
    mktemp: cannot create temp file /tmp/tmp: Invalid argument

    AIX $ mktemp -t tmp
    /tmp/tmp

    AIX $ mktemp -t tmp
    mktemp: cannot create temp file : Error 0

I've seen this "Error 0" message during gcc-install a few times...

So when there is no file /tmp/tmp on AIX, mktemp creates it.
If it already exists, no tempfile is created, and the error goes to
stderr, while to stdout goes nothing.

So emktemp() does not give any tempfile, and has_m32() ends up with
$temp being empty, passing an empty string as outputfile to gcc, and
using ".c" as input file.

[snip GCC compilation related stuff]

As a possible consequence, there is one way to call both BSD and GNU
mktemp the same way, always creating temporary files:

    FreeBSD$ mktemp -t tmp.XXXXXXXXXX
    /tmp/tmp.XXXXXXXX.1vllylRd

    Linux$ mktemp -t tmp.XXXXXXXXXX
    /tmp/tmp.XXXXoJdGIL

    AIX$ mktemp -t tmp.XXXXXXXXXX
    /tmp/tmp.XXXXlnhdUa

/haubi/


I can add that Solaris also does this same behaviour.  Darwin's doesn't, but we're in Prefix anyway.  So basically only GNU and FreeBSD are of relevance here.  The result of the attached patch is that the conditional USERLAND code disappears, which I think is groovy.
Comment 1 Fabian Groffen gentoo-dev 2007-04-10 17:54:44 UTC
Created attachment 115918 [details, diff]
emktemp.patch

the patch.
Comment 2 SpanKY gentoo-dev 2007-05-05 07:52:31 UTC
looks good, merged