Subject: bug#29267: 26.0.90; find-file confused by process-environment's HOME even with absolute fname

From: [email-masked] (João Távora)
Date: Sat, 11 Nov 2017 23:43:03 +0000

Hello maintainers, Glenn,

[This popped up with Glenn's idea for a fix to bug#29187 (which I
commited in 0da08f2f8ef1946978f0974e9e8cdb87fece018c). It's breaking an
interactive run of the flymake tests (which run fine with make check).]

I find, to my surprise that evaluating this form returns nil

   (let* ((tempdir (make-temp-file "some-temp-dir" t))
          (process-environment (cons (format "HOME=%s" tempdir)
                                     process-environment))
          (absolute (concat "/home/"
           		 user-login-name
           		 "/foo.txt")))
     (string= absolute
              (with-current-buffer
                  (find-file-noselect absolute)
                buffer-file-name)))

Same with find-file. find-file is unexpectedly prepending my absolute
file name with HOME found in the process environment.

It returns t, as expected, when:

* when the process-environment override is removed;

* emacs is started with HOME=/nonexistent, as is the case with
  make check;

* very curiously, if the absolute file name is *not* prefixed by
  whatever HOME was before the override;

Thanks,
João