[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: 1.6b snapshot
From: |
Ben Elliston |
Subject: |
Re: FYI: 1.6b snapshot |
Date: |
23 Dec 2002 12:02:16 +1100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter) |
Hi Akim,
>>>>> "Akim" == Akim Demaille <address@hidden> writes:
Akim> I'm afraid you're taking useless risks here, typically for 8+3
You always have such a way with words. Alas:
Akim> {
Akim> tmp=$TMPDIR/$1$$-$RANDOM
Akim> (umask 077 && mkdir $tmp)
Akim> }
If $1 is two to four characters long, $$ is up to 5 characters long
for a 16-bit process ID and $RANDOM is a similarly large natural
number, then you've just blown 8.3 systems out of the water.
Furthermore, $RANDOM does not seem to be as portable as it ought to
be. If it's unsupported by a shell it will, of course, expand to the
empty string giving:
tmp=$TMPDIR/$1$$-
.. where $1 is known. So this code can silently fail and generate a
temporary filename that has the equivalent strength as foo-$$. May I
suggest the following alternative?
{
test -n "$RANDOM" && tmp=$TMPDIR/$1$$-$RANDOM && (umask 077 && mkdir $tmp)
}
I am currently reviewing a config.guess patch that uses the guts of
your AS_TMPDIR macro to generate a secure tmp directory. Thanks for
that.
Ben
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: FYI: 1.6b snapshot,
Ben Elliston <=