[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "mktemp" is a BSD-ism and there are others around....
From: |
Paul Eggert |
Subject: |
Re: "mktemp" is a BSD-ism and there are others around.... |
Date: |
Wed, 10 May 2006 09:59:36 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Bruce Korb <address@hidden> writes on 2005-10-30:
> The other variation on "mktemp" uses "illegal option"
> (you get arrested if you use one). BTW, if the "mktemp -d -q"
> is successful in creating a file, shouldn't you remove the
> file before trying another method?
Sorry, I don't follow the reasoning behind this proposed patch, or the
BTW comment either. I don't see why Autoconf should care what
diagnostic mktemp outputs: if mktemp fails, that's good enough reason
to try a traditional mkdir.
> $ cvs diff -u ./lib/Autom4te/General.pm
> Index: ./lib/Autom4te/General.pm
> ===================================================================
> RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/General.pm,v
> retrieving revision 1.34
> diff -u -r1.34 General.pm
> --- ./lib/Autom4te/General.pm 14 May 2005 07:00:39 -0000 1.34
> +++ ./lib/Autom4te/General.pm 30 Oct 2005 17:46:34 -0000
> @@ -310,10 +310,16 @@
> my ($signature) = @_;
> my $TMPDIR = $ENV{'TMPDIR'} || '/tmp';
>
> - # If mktemp supports dirs, use it.
> - $tmp = `(umask 077 &&
> - mktemp -d -q "$TMPDIR/${signature}XXXXXX") 2>/dev/null`;
> + $tmp = `(mktemp -@ 2>&1) | grep 'invalid option'`;
> chomp $tmp;
> +
> + if ($tmp)
> + {
> + # If mktemp supports dirs, use it.
> + $tmp = `(umask 077 &&
> + mktemp -d -q "$TMPDIR/${signature}XXXXXX") 2>/dev/null`;
> + chomp $tmp;
> + }
>
> if (!$tmp || ! -d $tmp)
> {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: "mktemp" is a BSD-ism and there are others around....,
Paul Eggert <=