unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: 58265@debbugs.gnu.org
Subject: bug#58265: 29.0.50; [PATCH] $HOME adjustment for 'ert-remote-temporary-file-directory' is wrong
Date: Sun, 2 Oct 2022 18:32:32 -0700	[thread overview]
Message-ID: <cc7969a4-b6fc-dd53-1638-cbe5b5951683@gmail.com> (raw)

[-- 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


             reply	other threads:[~2022-10-03  1:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03  1:32 Jim Porter [this message]
2022-10-03  1:48 ` bug#58265: 29.0.50; [PATCH] $HOME adjustment for 'ert-remote-temporary-file-directory' is wrong Jim Porter
2022-10-03  9:17 ` Lars Ingebrigtsen
2022-10-04  0:44   ` Jim Porter
2022-10-03 11:53 ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc7969a4-b6fc-dd53-1638-cbe5b5951683@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=58265@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).