--tmpdir unfortunately doesn't work on OS X/BSD-style mktemp, but '-t'
does.  So "mktemp -t tmp.XXXXXXXXXX" obeys TMPDIR on both Linux and OS X.
 "-t" is marked as deprecated in the Linux version's manpage, however ---
not sure if you consider that a problem.

Alternatively, it could just run "mktemp tmp.XXXXXXXXXX", which creates the
temporary file in the current directory on both systems.  Not ideal, but
consistent (and maybe that's fine given how the script is used in the build
system?)

On Sun, Jul 10, 2016 at 7:44 PM, Eugene Rudoy <[email protected]> wrote:

> What about "mktemp --tmpdir tmp.XXXXXXXXXX"?
>
> @Andrew: could you please test it under OS X? Don't have any here.
>
> On Sun, Jul 10, 2016 at 8:10 PM, Denys Vlasenko
> <[email protected]> wrote:
> > On Thu, Jul 7, 2016 at 4:09 AM,  <[email protected]> wrote:
> >> From: Andrew Oates <[email protected]>
> >>
> >> On OS X, mktemp can't be run without any arguments (it requires a
> >> template).  This version has the same behavior on both OS X and Linux.
> >>
> >> Signed-off-by: Andrew Oates <[email protected]>
> >> ---
> >>  scripts/trylink | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/scripts/trylink b/scripts/trylink
> >> index 145df99..59194fc 100755
> >> --- a/scripts/trylink
> >> +++ b/scripts/trylink
> >> @@ -46,7 +46,7 @@ try() {
> >>  }
> >>
> >>  check_cc() {
> >> -    local tempname="$(mktemp)"
> >> +    local tempname="$(mktemp /tmp/tmp.XXXXXXXXXX)"
> >>      local r
> >>      echo "int main(int argc,char**argv){return argv?argc:0;}"
> >"$tempname".c
> >>      # Can use "-o /dev/null", but older gcc tend to *unlink it* on
> failure! :(
> >> @@ -61,7 +61,7 @@ check_cc() {
> >>  }
> >>
> >>  check_libc_is_glibc() {
> >> -    local tempname="$(mktemp)"
> >> +    local tempname="$(mktemp /tmp/tmp.XXXXXXXXXX)"
> >>      local r
> >>      echo "\
> >>         #include <stdlib.h>
> >> --
> >> 2.5.0
> >
> > This would ignore $TMPDIR. Meaning, this can break build for people
> > who for some obscure reason do not have /tmp.
> > _______________________________________________
> > busybox mailing list
> > [email protected]
> > http://lists.busybox.net/mailman/listinfo/busybox
>
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to