Document make-temp-name magic limitations

* doc/lispref/files.texi (Unique File Names):
* src/fileio.c (Fmake_temp_name): Document that make-temp-name
does not guarantee uniqueness on magic file names.
This commit is contained in:
Paul Eggert 2017-08-08 09:49:40 -07:00
parent 846870e508
commit 7d1115e0c7
2 changed files with 7 additions and 5 deletions

View file

@ -2547,13 +2547,14 @@ should compute the directory like this:
@end defopt
@defun make-temp-name base-name
This function generates a string that can be used as a unique file
This function generates a string that might be a unique file
name. The name starts with @var{base-name}, and has several random
characters appended to it, which are different in each Emacs job. It
is like @code{make-temp-file} except that (i) it just constructs a
name, and does not create a file, and (ii) @var{base-name} should be
an absolute file name (on MS-DOS, this function can truncate
@var{base-name} to fit into the 8+3 file-name limits).
name and does not create a file, (ii) @var{base-name} should be an
absolute file name that is not magic, and (iii) if the returned file
name is magic, it might name an existing file. @xref{Magic File
Names}.
@strong{Warning:} In most cases, you should not use this function; use
@code{make-temp-file} instead! This function is susceptible to a race

View file

@ -757,7 +757,8 @@ danger of generating a name being used by another Emacs process
\(so long as only a single host can access the containing directory...).
This function tries to choose a name that has no existing file.
For this to work, PREFIX should be an absolute file name.
For this to work, PREFIX should be an absolute file name, and PREFIX
and the returned string should both be non-magic.
There is a race condition between calling `make-temp-name' and creating the
file, which opens all kinds of security holes. For that reason, you should