Re: Metrics and map file for Adobe Utopia
Thomas Esser <[email protected]> Sun, 23 Oct 2005 16:51:39 +0200
| Newsgroups | gmane.comp.tex.tetex.general |
|---|---|
| Message-ID | <[email protected]> |
> TMPDIR="${TMP-/tmp}/getfont$$"
>
> Some sites don't let users write in /tmp. If they set TMP to something
> writable, then fine, but I have also seen TMPDIR=$HOME/tmp on such systems.
Yes, you are right. To meet the requirements of POSIX, I am using the
following in my scripts:
tmpdir=${TMPDIR-${TEMP-${TMP-/tmp}}}/$progname.$$
So, the variables TMPDIR, TEMP and TMP are used (priority descending).
> Some administrators won't like the use of the PID for the temporary
> directory.
Well, many people use $$ for temporary *filenames* in directories that
have world-write permissions. This is a securiry whole (e.g. symlink
attacks). Reinhard is using the $$-name for creating a *directory* and
aborts if this fails. This is a reliable way to prevent security wholes.
One suggestion: I would write
(umask 077; mkdir "${TMPDIR}") || die "Can't mkdir ${TMPDIR}"
to make the code even safer (the newly created directory will only be
accissible to the user; independed of the user's default umask).
> Is there anyone who doesn't have mktemp these days? Getfont
Yes, I think that many traditional UNIX systems don't have it.
Thomas