Fix resolving symlinks in Eshell history file names

* lisp/eshell/em-dirs.el (eshell-write-last-dir-ring):
* lisp/eshell/em-hist.el (eshell-write-history): Don't call
file-truename with argument of nil.  (Bug#33477)

* test/lisp/eshell/eshell-tests.el (with-temp-eshell): Remove
HISTFILE from the environment, to make sure the Eshell history
file is nil.
This commit is contained in:
Eli Zaretskii 2018-12-09 09:45:40 +02:00
parent 7515a1d493
commit c2fdd50c3c
3 changed files with 5 additions and 2 deletions

View file

@ -553,7 +553,7 @@ in the minibuffer:
(defun eshell-write-last-dir-ring ()
"Write the buffer's `eshell-last-dir-ring' to a history file."
(let* ((file eshell-last-dir-ring-file-name)
(resolved-file (file-truename file)))
(resolved-file (if (stringp file) (file-truename file))))
(cond
((or (null file)
(equal file "")

View file

@ -467,7 +467,7 @@ Useful within process sentinels.
See also `eshell-read-history'."
(let* ((file (or filename eshell-history-file-name))
(resolved-file (file-truename file)))
(resolved-file (if (stringp file) (file-truename file))))
(cond
((or (null file)
(equal file "")

View file

@ -31,6 +31,9 @@
(defmacro with-temp-eshell (&rest body)
"Evaluate BODY in a temporary Eshell buffer."
`(let* ((eshell-directory-name (make-temp-file "eshell" t))
;; We want no history file, so prevent Eshell from falling
;; back on $HISTFILE.
(_ (setenv "HISTFILE"))
(eshell-history-file-name nil)
(eshell-buffer (eshell t)))
(unwind-protect