[gnu.emacs.bug] Bug in make-temp-name

lbn@ksuvax1.cis.ksu.edu (Lars Bo Nielsen) (03/29/89)

GNU Emacs 18.52.4 of Thu Dec 15 1988 on ksuvax1.cis.ksu.edu (berkeley-unix)

I have found a bug (I think) in make-temp-file. When the same pattern
is used more than 26 times make-temp-file will _not_ return a unique
filename, it returns the 26th name. (It may sound obscure to make
more than 26 temporary files, but I really need it)

Try:

(defun test ()
  (let ((i 0))
    (while (< i 30)
      (let ((name (make-temp-name "/tmp/Delete.Me.Again.")))
	(insert (format "%d " i) name "\n")
        (write-file name)
        (setq i (1+ i))))))

You get ex:

0 /tmp/Delete.Me.Again.005593
1 /tmp/Delete.Me.Again.a05593
2 /tmp/Delete.Me.Again.b05593
[...]
21 /tmp/Delete.Me.Again.u05593
22 /tmp/Delete.Me.Again.v05593
23 /tmp/Delete.Me.Again.w05593
24 /tmp/Delete.Me.Again.x05593
25 /tmp/Delete.Me.Again.y05593
26 /tmp/Delete.Me.Again.y05593		<-   Repeated file-name
27 /tmp/Delete.Me.Again.y05593		<-
28 /tmp/Delete.Me.Again.y05593		<-
29 /tmp/Delete.Me.Again.y05593

--
 Lars Bo Nielsen  (lbn@ksuvax1.cis.ksu.edu)

lbn@ksuvax1.cis.ksu.edu (Lars Bo Nielsen) (03/29/89)

In article <1426@deimos.cis.ksu.edu> I wrote:
                                     -------
>I have found a bug (I think) in make-temp-file. When the same pattern
>is used more than 26 times make-temp-file will _not_ return a unique
>filename, it returns the 26th name.

Emacs is _not_ to blame, the bug is in the Un*x function "mktemp". I
have found the bug on both Vax and SUN. I am sure this is a commonly
known bug.

I am sorry I was too quick to post a bug-report.
 
--
 Lars Bo Nielsen  (lbn@ksuvax1.cis.ksu.edu)