Fix make-temp-file bug with ""/"."/".." prefix
The bug with "." and ".." has been present for a while; I introduced the bug with "" earlier today in my patch for Bug#28023. * lisp/files.el (make-temp-file): Do not use expand-file-name if PREFIX is empty or "." or "..", as it does the wrong thing. Compute absolute-prefix here ... (files--make-magic-temp-file): ... instead of here ... * src/fileio.c (Fmake_temp_file_internal): ... or here. * lisp/files.el (make-temp-file): If the prefix is empty, append "/" to the absolute prefix so that the new files are children rather than siblings of temporary-file-directory. This fixes a bug introduced in the previous change. * test/lisp/files-tests.el (files-test-make-temp-file-empty-prefix): New test, for the bug.
This commit is contained in:
parent
a6ad98ad66
commit
ebf53ed4f6
3 changed files with 26 additions and 16 deletions
|
@ -166,6 +166,20 @@ form.")
|
|||
(should (eq buffer-file-coding-system 'iso-2022-7bit-unix))))
|
||||
(delete-file tempfile))))
|
||||
|
||||
(ert-deftest files-test-make-temp-file-empty-prefix ()
|
||||
"Test make-temp-file with an empty prefix."
|
||||
(let ((tempfile (make-temp-file ""))
|
||||
(tempdir (make-temp-file "" t))
|
||||
(tempfile-. (make-temp-file "."))
|
||||
(tempdir-. (make-temp-file "." t))
|
||||
(tempfile-.. (make-temp-file ".."))
|
||||
(tempdir-.. (make-temp-file ".." t)))
|
||||
(dolist (file (list tempfile tempfile-. tempfile-..))
|
||||
(should file)
|
||||
(delete-file file))
|
||||
(dolist (dir (list tempdir tempdir-. tempdir-..))
|
||||
(should dir)
|
||||
(delete-directory dir))))
|
||||
|
||||
;; Stop the above "Local Var..." confusing Emacs.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue