all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#58265: 29.0.50; [PATCH] $HOME adjustment for 'ert-remote-temporary-file-directory' is wrong
@ 2022-10-03  1:32 Jim Porter
  2022-10-03  1:48 ` Jim Porter
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jim Porter @ 2022-10-03  1:32 UTC (permalink / raw)
  To: 58265

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

I tried to use 'ert-remote-temporary-file-directory' in a test for an 
external package, but it ended up breaking some existing tests simply by 
requiring both tramp and ert-x. These tests indirectly used 'cd' (by way 
of 'compilation-start'), which triggered the failure.

Steps to reproduce:

   $ mkdir -p ~/src
   $ emacs -Q --batch -l tramp -l ert-x --eval '(cd "~/src/")'

Result:

   Error: error ("No such directory: ~/src/")
     mapbacktrace(#f(compiled-function (evald func args flags) 
#<bytecode 0xc43976fdbae86a5>))
     debug-early-backtrace()
     debug-early(error (error "No such directory: ~/src/"))
     error("No such directory: %s" "~/src/")
     cd("~/src")
     eval((cd "~/src") t)
     command-line-1(("-l" "tramp" "-l" "ert-x" "--eval" "(cd \"~/src/\")"))
     command-line()
     normal-top-level()
   No such directory: ~/src/

Looking at ert-x.el, I think this is because 
'ert-remote-temporary-file-directory' does some fixup on $HOME, but it 
was too aggressive. See attached.

[-- Attachment #2: 0001-Fix-logic-of-HOME-adjustment-for-ert-remote-temporar.patch --]
[-- Type: text/plain, Size: 1123 bytes --]

From 5ef9bce106dbc78c0e29b3c0e1baf0ee47859ece Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Sun, 2 Oct 2022 18:19:56 -0700
Subject: [PATCH] ; Fix logic of $HOME adjustment for
 'ert-remote-temporary-file-directory'

* lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory): Only
adjust $HOME when it doesn't exist.
---
 lisp/emacs-lisp/ert-x.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index bfd796586d..a891f068a7 100644
--- a/lisp/emacs-lisp/ert-x.el
+++ b/lisp/emacs-lisp/ert-x.el
@@ -568,7 +568,7 @@ ert-remote-temporary-file-directory
          `("\\`mock\\'" nil ,(system-name)))
         ;; Emacs's Makefile sets $HOME to a nonexistent value.  Needed
         ;; in batch mode only, therefore.
-        (unless (and (null noninteractive) (file-directory-p "~/"))
+        (when (and noninteractive (not (file-directory-p "~/")))
           (setenv "HOME" temporary-file-directory))
         (format "/mock::%s" temporary-file-directory))))
     "Temporary directory for remote file tests.")
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-04  0:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03  1:32 bug#58265: 29.0.50; [PATCH] $HOME adjustment for 'ert-remote-temporary-file-directory' is wrong Jim Porter
2022-10-03  1:48 ` Jim Porter
2022-10-03  9:17 ` Lars Ingebrigtsen
2022-10-04  0:44   ` Jim Porter
2022-10-03 11:53 ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.