comparison tests/automated/mule-tests.el @ 4399:e5b3c4dbc8a2

Call #'make-temp-file in mule-tests.el, now it's available. 2008-01-16 Aidan Kehoe <kehoea@parhasard.net> * automated/mule-tests.el (test-file-name): Call #'make-temp-file now it's available. Remove a long comment saying, essentially, that it should be used, not #'make-temp-name.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 16 Jan 2008 15:43:01 +0100
parents 4d0f773d5e21
children 732b87cfabf2
comparison
equal deleted inserted replaced
4398:479443c0f95a 4399:e5b3c4dbc8a2
116 ;; Test that revert-buffer resets the modiff 116 ;; Test that revert-buffer resets the modiff
117 ;; Bug reported 2007-06-20 <200706201902.32191.scop@xemacs.org>. 117 ;; Bug reported 2007-06-20 <200706201902.32191.scop@xemacs.org>.
118 ;; Fixed 2007-06-22 <18043.2793.611745.734215@parhasard.net>. 118 ;; Fixed 2007-06-22 <18043.2793.611745.734215@parhasard.net>.
119 ;;---------------------------------------------------------------- 119 ;;----------------------------------------------------------------
120 120
121 (let ((test-file-name 121 (let ((test-file-name
122 ;; The Gnus people, when they call #'make-temp-name, then loop, 122 (make-temp-file (expand-file-name "tXfXsKc" (temp-directory))))
123 ;; checking if the corresponding file exists. Our #'make-temp-name
124 ;; already does this loop, and the Gnus approach doesn't bring
125 ;; anything; there remains a race condition if you can predict the
126 ;; path name. The path name in question depends on the process ID and
127 ;; a (weak) PRNG seeded with the seconds to the power of the
128 ;; milliseconds of some instant close to the startup time of this
129 ;; XEmacs; without being able to read the address space of this
130 ;; XEmacs, or monitor what stat() calls it does, it is not predictable.
131 ;;
132 ;; The really kosher way to do this is to merge GNU's make-temp-file
133 ;; and use that. It basically has the functionality of the Unix
134 ;; mkstemp.
135 (make-temp-name (expand-file-name "tXfXsKc" (temp-directory))))
136 revert-buffer-function 123 revert-buffer-function
137 kill-buffer-hook) ; paranoia 124 kill-buffer-hook) ; paranoia
138 (find-file test-file-name) 125 (find-file test-file-name)
139 (erase-buffer) 126 (erase-buffer)
140 (insert "a string\n") 127 (insert "a string\n")