Subject: bug#26911: 25.2; eshell "cd .." doesn't work correctly with TRAMP

From: Eli Zaretskii <[email-masked]>
Date: Fri, 28 Aug 2020 09:39:38 +0300

> Cc: Michael Albinus <[email-masked]>, [email-masked],
>  Eli Zaretskii <[email-masked]>, Yegor Timoshenko <[email-masked]>
> From: Paul Eggert <[email-masked]>
> Date: Thu, 27 Aug 2020 14:53:52 -0700
> 
> Thanks for reporting that. Sigh, too often when I fix one bug in 
> expand-file-name I introduce another. I installed the attached patch to fix this 
> bug (I and I hope it doesn't introduce yet another :-).

Two tests (including the new one) fail here on MS-Windows:

  Test fileio-tests--HOME-trailing-slash backtrace:
    signal(ert-test-failed (((should (equal (expand-file-name "~") (expa
    ert-fail(((should (equal (expand-file-name "~") (expand-file-name ho
    (if (unwind-protect (setq value-197 (apply fn-195 args-196)) (setq f
    (let (form-description-199) (if (unwind-protect (setq value-197 (app
    (let ((value-197 'ert-form-evaluation-aborted-198)) (let (form-descr
    (let* ((fn-195 #'equal) (args-196 (condition-case err (let ((signal-
    (let ((home (car --dolist-tail--))) (setenv "HOME" home) (let* ((fn-
    (while --dolist-tail-- (let ((home (car --dolist-tail--))) (setenv "
    (let ((--dolist-tail-- '("/a/b/c" "/a/b/c/"))) (while --dolist-tail-
    (let ((old-home (getenv "HOME"))) (let ((--dolist-tail-- '("/a/b/c" 
    (closure (t) nil (let ((old-home (getenv "HOME"))) (let ((--dolist-t
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name fileio-tests--HOME-trailing-slash :do
    ert-run-or-rerun-test(#s(ert--stats :selector (not ...) :tests [... 
    ert-run-tests((not (tag :unstable)) #f(compiled-function (event-type
    ert-run-tests-batch((not (tag :unstable)))
    ert-run-tests-batch-and-exit((not (tag :unstable)))
    eval((ert-run-tests-batch-and-exit '(not (tag :unstable))) t)
    command-line-1(("-L" ";." "-l" "ert" "-l" "src/fileio-tests.el" "--e
    command-line()
    normal-top-level()
  Test fileio-tests--HOME-trailing-slash condition:
      (ert-test-failed
       ((should
	 (equal
	  (expand-file-name "~")
	  (expand-file-name home)))
	:form
	(equal "d:/gnu/git/emacs/trunk/test/a/b/c/" "d:./a/b/c")
	:value nil :explanation
	(arrays-of-different-length 34 9 "d:/gnu/git/emacs/trunk/test/a/b/c/" "d:./a/b/c" first-mismatch-at 2)))
     FAILED   1/12  fileio-tests--HOME-trailing-slash (0.000000 sec)

  Test fileio-tests--expand-file-name-trailing-slash backtrace:
    signal(ert-test-failed (((should (equal (expand-file-name fooslashal
    ert-fail(((should (equal (expand-file-name fooslashalias "/") "/foo/
    (if (unwind-protect (setq value-202 (apply fn-200 args-201)) (setq f
    (let (form-description-204) (if (unwind-protect (setq value-202 (app
    (let ((value-202 'ert-form-evaluation-aborted-203)) (let (form-descr
    (let* ((fn-200 #'equal) (args-201 (condition-case err (let ((signal-
    (let ((fooslashalias (car --dolist-tail--))) (let* ((fn-200 #'equal)
    (while --dolist-tail-- (let ((fooslashalias (car --dolist-tail--))) 
    (let ((--dolist-tail-- '("foo/" "foo//" "foo/." "foo//." "foo///././
    (closure (t) nil (let ((--dolist-tail-- '("foo/" "foo//" "foo/." "fo
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name fileio-tests--expand-file-name-traili
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (tag :unstable)) #f(compiled-function (event-type
    ert-run-tests-batch((not (tag :unstable)))
    ert-run-tests-batch-and-exit((not (tag :unstable)))
    eval((ert-run-tests-batch-and-exit '(not (tag :unstable))) t)
    command-line-1(("-L" ";." "-l" "ert" "-l" "src/fileio-tests.el" "--e
    command-line()
    normal-top-level()
  Test fileio-tests--expand-file-name-trailing-slash condition:
      (ert-test-failed
       ((should
	 (equal
	  (expand-file-name fooslashalias "/")
	  "/foo/"))
	:form
	(equal "d:/foo/" "/foo/")
	:value nil :explanation
	(arrays-of-different-length 7 5 "d:/foo/" "/foo/" first-mismatch-at 0)))