emacs-31 3b4cba3b68f: Fix `with-tramp-local-environment'

Michael Albinus via Mailing list for Emacs changes <[email protected]> Thu, 16 Jul 2026 09:50:47 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 3b4cba3b68f57144ce79b0b3805809933c2659d5
Author: Michael Albinus <[email protected]>
Commit: Michael Albinus <[email protected]>

    Fix `with-tramp-local-environment'
    
    * lisp/net/tramp.el (with-tramp-local-environment): Do not change the
    global environment.  Reported by Daniel Kraus <[email protected]>.
    (Bug#81409)
---
 lisp/net/tramp.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 78e1d34ebab..41dcffd8b19 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -7228,6 +7228,7 @@ might have improper values."
 	  (mapcar #'car tramp-connection-local-default-system-variables))))
     `(let* ((default-directory tramp-compat-temporary-file-directory)
 	    (temporary-file-directory tramp-compat-temporary-file-directory)
+	    (process-environment (copy-sequence process-environment))
             ,@bindings)
        (setenv "TERM" tramp-terminal-type)
        (setenv "PROMPT_COMMAND")