branch: externals/tramp
commit 4f7278970eaecf096bb0a984191e71e7a49fa58e
Author: Michael Albinus <[email protected]>
Commit: Michael Albinus <[email protected]>

    Tramp ELPA version 2.8.0.3 released
---
 README                      |   6 +-
 test/tramp-archive-tests.el |   2 +-
 test/tramp-tests.el         | 188 ++++++++++++++++++++++++++------------------
 texi/tramp.texi             |   2 +-
 texi/trampver.texi          |   2 +-
 tramp-androidsu.el          |   4 +-
 tramp-cache.el              |   2 +-
 tramp-compat.el             |   2 +-
 tramp-fuse.el               |   9 +--
 tramp-gvfs.el               |   2 +-
 tramp-sh.el                 |   7 +-
 tramp.el                    |  68 ++++++++++------
 trampver.el                 |   6 +-
 13 files changed, 175 insertions(+), 125 deletions(-)

diff --git a/README b/README
index e51a5c9d70..5720b4415f 100644
--- a/README
+++ b/README
@@ -32,11 +32,11 @@ Emacs 28 or older
 
    • Remove all byte-compiled Tramp files
 
-          $ rm -f ~/.emacs.d/elpa/tramp-2.8.0.2/tramp*.elc
+          $ rm -f ~/.emacs.d/elpa/tramp-2.8.0.3/tramp*.elc
 
    • Start Emacs with Tramp's source files
 
-          $ emacs -L ~/.emacs.d/elpa/tramp-2.8.0.2 -l tramp
+          $ emacs -L ~/.emacs.d/elpa/tramp-2.8.0.3 -l tramp
 
      This should not give you the error.
 
@@ -50,7 +50,7 @@ Mitigation of a bug in Emacs 29.1
 ---------------------------------
 
 Due to a bug in Emacs 29.1, you must apply the following change prior
-installation or upgrading Tramp 2.8.0.2 from GNU ELPA:
+installation or upgrading Tramp 2.8.0.3 from GNU ELPA:
 
      (when (string-equal emacs-version "29.1")
        (with-current-buffer
diff --git a/test/tramp-archive-tests.el b/test/tramp-archive-tests.el
index 0ff0f3ddd4..33dc0b9d4a 100644
--- a/test/tramp-archive-tests.el
+++ b/test/tramp-archive-tests.el
@@ -559,7 +559,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
   (let (;; We test for the summary line.  Keyword "total" could be localized.
        (process-environment
-        (append '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment)))
+        (seq-union '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment)))
     (unwind-protect
        (progn
          (with-temp-buffer
diff --git a/test/tramp-tests.el b/test/tramp-tests.el
index 892e4ef519..3432e6eb70 100644
--- a/test/tramp-tests.el
+++ b/test/tramp-tests.el
@@ -91,6 +91,9 @@
 (defvar tramp-remote-process-environment)
 (defvar tramp-use-connection-share)
 
+;; Declared in Emacs 29.1.
+(defvar completions-max-height)
+
 ;; Declared in Emacs 30.1.
 (defvar project-mode-line)
 (defvar remote-file-name-access-timeout)
@@ -3457,41 +3460,43 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
            ;; `sort' works destructive.
            (should
             (equal (file-expand-wildcards "*")
-                   (sort (copy-sequence '("foo" "bar" "baz")) 'string<)))
+                   (sort (copy-sequence '("foo" "bar" "baz")) #'string-lessp)))
            (should
             (equal (file-expand-wildcards "ba?")
-                   (sort (copy-sequence '("bar" "baz")) 'string<)))
+                   (sort (copy-sequence '("bar" "baz")) #'string-lessp)))
            (should
             (equal (file-expand-wildcards "ba[rz]")
-                   (sort (copy-sequence '("bar" "baz")) 'string<)))
+                   (sort (copy-sequence '("bar" "baz")) #'string-lessp)))
 
            (should
             (equal
              (file-expand-wildcards "*" 'full)
              (sort
-              (copy-sequence `(,tmp-name2 ,tmp-name3 ,tmp-name4)) 'string<)))
+              (copy-sequence `(,tmp-name2 ,tmp-name3 ,tmp-name4))
+              #'string-lessp)))
            (should
             (equal
              (file-expand-wildcards "ba?" 'full)
-             (sort (copy-sequence `(,tmp-name3 ,tmp-name4)) 'string<)))
+             (sort (copy-sequence `(,tmp-name3 ,tmp-name4)) #'string-lessp)))
            (should
             (equal
              (file-expand-wildcards "ba[rz]" 'full)
-             (sort (copy-sequence `(,tmp-name3 ,tmp-name4)) 'string<)))
+             (sort (copy-sequence `(,tmp-name3 ,tmp-name4)) #'string-lessp)))
 
            (should
             (equal
              (file-expand-wildcards (concat tmp-name1 "/" "*"))
              (sort
-              (copy-sequence `(,tmp-name2 ,tmp-name3 ,tmp-name4)) 'string<)))
+              (copy-sequence `(,tmp-name2 ,tmp-name3 ,tmp-name4))
+              #'string-lessp)))
            (should
             (equal
              (file-expand-wildcards (concat tmp-name1 "/" "ba?"))
-             (sort (copy-sequence `(,tmp-name3 ,tmp-name4)) 'string<)))
+             (sort (copy-sequence `(,tmp-name3 ,tmp-name4)) #'string-lessp)))
            (should
             (equal
              (file-expand-wildcards (concat tmp-name1 "/" "ba[rz]"))
-             (sort (copy-sequence `(,tmp-name3 ,tmp-name4)) 'string<))))
+             (sort (copy-sequence `(,tmp-name3 ,tmp-name4)) #'string-lessp))))
 
        ;; Cleanup.
        (ignore-errors (delete-directory tmp-name1 'recursive))))))
@@ -3510,7 +3515,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
           (tmp-name2 (expand-file-name "foo" tmp-name1))
           ;; We test for the summary line.  Keyword "total" could be localized.
           (process-environment
-           (append '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment)))
+           (seq-union '("LANG=C" "LANGUAGE=C" "LC_ALL=C") 
process-environment)))
       (unwind-protect
          (progn
            (make-directory tmp-name1)
@@ -5002,30 +5007,33 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
 
 (tramp--test-deftest-with-ls tramp-test26-file-name-completion)
 
-;; This test is inspired by Bug#51386, Bug#52758, Bug#53513, Bug#54042
-;; and Bug#60505.
+;; This test is inspired by Bug#51386, Bug#52758, Bug#53513,
+;; Bug#54042, Bug#60505 and Bug#79236.
 (ert-deftest tramp-test26-interactive-file-name-completion ()
   "Check interactive completion with different `completion-styles'."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
 
-  ;; (when (get-buffer trace-buffer) (kill-buffer trace-buffer))
-  ;; (dolist (elt (append
-  ;;           (mapcar
-  ;;            #'intern (all-completions "tramp-" obarray #'functionp))
-  ;;           tramp-trace-functions))
-  ;;   (unless (get elt 'tramp-suppress-trace)
-  ;;     (trace-function-background elt)))
-  ;; (trace-function-background #'completion-file-name-table)
-  ;; (trace-function-background #'read-file-name)
-
   ;; Method, user and host name in completion mode.
-  (let ((method (file-remote-p ert-remote-temporary-file-directory 'method))
-       (user (file-remote-p ert-remote-temporary-file-directory 'user))
-       (host (file-remote-p ert-remote-temporary-file-directory 'host))
-       (hop (file-remote-p ert-remote-temporary-file-directory 'hop))
-        (orig-syntax tramp-syntax)
-        (non-essential t)
-       (inhibit-message (not (ignore-errors (edebug-mode)))))
+  (let* (;; Set this to `t' if you want to run all tests.
+        (expensive nil) ;(tramp--test-expensive-test-p))
+        ;; Set this to `t' if you want to see the traces.
+        (tramp-trace nil)
+        (method (file-remote-p ert-remote-temporary-file-directory 'method))
+        (user (file-remote-p ert-remote-temporary-file-directory 'user))
+        (host (file-remote-p ert-remote-temporary-file-directory 'host))
+        (hop (and expensive
+                  (file-remote-p ert-remote-temporary-file-directory 'hop)))
+        ;; All multi-hop capable methods.
+        (method-list
+         (and hop (sort (mapcar
+                         (lambda (x)
+                           (substring x (length tramp-prefix-format)))
+                         (tramp-get-completion-methods "" t)))))
+         (orig-syntax tramp-syntax)
+         (non-essential t)
+        (inhibit-message
+         (and (not tramp-trace) (not (ignore-errors (edebug-mode))))))
     ;; `file-remote-p' returns as host the string "host#port", which
     ;; isn't useful.
     (when (and (stringp host)
@@ -5034,6 +5042,16 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                host))
       (setq host (replace-match "" nil nil host)))
 
+    (when tramp-trace
+      (when (get-buffer trace-buffer) (kill-buffer trace-buffer))
+      (dolist
+         (elt
+          (append
+           (mapcar #'intern (all-completions "tramp-" obarray #'functionp))
+           '(completion-file-name-table read-file-name)))
+       (unless (get elt 'tramp-suppress-trace)
+         (trace-function-background elt))))
+
     (unwind-protect
         (dolist (syntax (if (tramp--test-expensive-test-p)
                            (tramp-syntax-values) `(,orig-syntax)))
@@ -5045,21 +5063,21 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
 
           (dolist
               (style
-               (if (tramp--test-expensive-test-p)
-                   ;; FIXME: It doesn't work for `initials' and
-                   ;; `shorthand' completion styles.  Should it?
-                  ;; `orderless' passes the tests, but it is an ELPA package.
-                  ;; What about `company' backends, `consult', `cider', `helm'?
+               (if expensive
+                   ;; `initials' uses "/" as separator, it doesn't apply here.
+                  ;; `shorthand' is about symbols, it doesn't apply here.
                    `(emacs21 emacs22 basic partial-completion substring
                     ;; FIXME: `flex' is not compatible with IPv6 hosts.
-                    ,@(unless (string-match-p tramp-ipv6-regexp host) '(flex)))
+                    ,@(unless (string-match-p tramp-ipv6-regexp host) '(flex))
+                    ;; `orderless' is an ELPA package.
+                    ;; What about `company' backends, `consult',
+                    ;; `cider', `helm'?
+                    orderless)
                 '(basic)))
 
            (when (assoc style completion-styles-alist)
              (let* (;; Force the real minibuffer in batch mode.
                      (executing-kbd-macro noninteractive)
-                    ;; FIXME: Is this TRT for test?
-                    (minibuffer-completing-file-name t)
                     (confirm-nonexistent-file-or-buffer nil)
                      (completion-styles `(,style))
                      completion-category-defaults
@@ -5072,6 +5090,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                       `(any
                         ,(string-replace
                           ":" "" completion-pcm-word-delimiters))))
+                    ;; Don't truncate in *Completions* buffer.
+                    (completions-max-height most-positive-fixnum)
                     ;; This is needed for the `simplified' syntax.
                      (tramp-default-method method)
                      (method-string
@@ -5097,7 +5117,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                     ;; Needed for host name completion.
                     (default-user
                      (file-remote-p
-                      (concat tramp-prefix-format hop method-string 
host-string)
+                      (concat
+                       tramp-prefix-format hop method-string host-string)
                       'user))
                     (default-user-string
                      (unless (tramp-string-empty-or-nil-p default-user)
@@ -5107,8 +5128,18 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                (dolist
                    (test-and-result
                     ;; These are triples of strings (TEST-STRING
-                    ;; RESULT-CHECK COMPLETION-CHECK).
+                    ;; RESULT-CHECK COMPLETION-CHECK).  If
+                    ;; COMPLETION-CHECK is a list, it is the complete
+                    ;; result the contents of *Completions* shall be
+                    ;; checked with.
                     (append
+                     ;; Complete hop.
+                     (unless (tramp-string-empty-or-nil-p hop)
+                       `((,(concat tramp-prefix-format hop)
+                          ,(concat tramp-prefix-format hop)
+                          ,(if (string-empty-p tramp-method-regexp)
+                               (or default-user-string host-string)
+                             method-list))))
                      ;; Complete method name.
                      (unless (string-empty-p tramp-method-regexp)
                        `((,(concat
@@ -5127,7 +5158,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                              tramp-prefix-format hop method-string user-string)
                           ,user-string)))
                      ;; Complete host name.
-                     (unless (tramp-string-empty-or-nil-p host)
+                     (unless (tramp-string-empty-or-nil-p host-string)
                        `((,(concat
                              tramp-prefix-format hop method-string
                             ipv6-prefix
@@ -5138,8 +5169,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                             default-user-string host-string)
                           ,host-string)))
                      ;; Complete user and host name.
-                     (unless (or (tramp-string-empty-or-nil-p user)
-                                 (tramp-string-empty-or-nil-p host))
+                     (unless (or (tramp-string-empty-or-nil-p user-string)
+                                 (tramp-string-empty-or-nil-p host-string))
                        `((,(concat
                              tramp-prefix-format hop method-string user-string
                             ipv6-prefix
@@ -5152,8 +5183,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
 
                  (dolist
                      (predicate
-                      (if (and (tramp--test-expensive-test-p)
-                               (tramp--test-emacs31-p))
+                      (if (and expensive (tramp--test-emacs31-p))
                           ;; `nil' will be expanded to `file-exists-p'.
                           ;; `read-directory-name' uses `file-directory-p'.
                           ;; `file-directory-p' works since Emacs 31.
@@ -5161,16 +5191,16 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                           '(file-exists-p file-directory-p) '(nil)))
 
                     (ignore-errors (kill-buffer "*Completions*"))
-                   ;; (when (get-buffer trace-buffer)
-                   ;;   (kill-buffer trace-buffer))
+                   (when tramp-trace
+                     (when (get-buffer trace-buffer)
+                       (kill-buffer trace-buffer)))
                     (discard-input)
                     (setq test (car test-and-result)
                           unread-command-events
-                         (append test '(tab tab return return))
+                         (append test (if noninteractive '(tab tab)
+                                         '(tab tab return)))
                           completions nil
-                          result
-                         (read-file-name
-                          "Prompt: " nil nil 'confirm nil predicate))
+                          result (read-file-name ": " nil nil nil nil 
predicate))
 
                     (if (or (not (get-buffer "*Completions*"))
                            (string-match-p
@@ -5186,11 +5216,12 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                                eos))
                             result))
                        (progn
-                          ;; (tramp--test-message
-                         ;;  (concat
-                          ;;   "syntax: %s style: %s predicate: %s "
-                         ;;   "test: %s result: %s")
-                          ;;  syntax style predicate test result)
+                         (when tramp-trace
+                            (tramp--test-message
+                            (concat
+                              "syntax: %s style: %s predicate: %s "
+                             "test: %s result: %s")
+                             syntax style predicate test result))
                          (should
                           (string-prefix-p (cadr test-and-result) result)))
 
@@ -5212,16 +5243,23 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                                (point) (point-max))
                                (rx (any "\r\n\t ")) 'omit)))
 
-                      ;; (tramp--test-message
-                     ;;  (concat
-                      ;;   "syntax: %s style: %s predicate: %s test: %s "
-                     ;;   "result: %s completions: %S")
-                      ;;  syntax style predicate test result completions)
-                      (should
-                      (member (caddr test-and-result) completions)))))))))
+                     (when tramp-trace
+                       (tramp--test-message
+                        (concat
+                          "syntax: %s style: %s predicate: %s test: %s "
+                         "result: %s completions: %S")
+                        syntax style predicate test result completions))
+                     (if (stringp (caddr test-and-result))
+                         (should
+                          (member (caddr test-and-result) completions))
+                       (should
+                        (equal
+                         (caddr test-and-result)
+                         (sort completions #'string-lessp)))))))))))
 
       ;; Cleanup.
-      ;; (untrace-all)
+      (when tramp-trace
+       (untrace-all))
       (tramp-change-syntax orig-syntax)
       (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password))))
 
@@ -5618,8 +5656,7 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
 (ert-deftest tramp-test30-make-process ()
   "Check `make-process'."
   :tags (append '(:expensive-test :tramp-asynchronous-processes)
-               (and (getenv "EMACS_EMBA_CI")
-                     '(:unstable)))
+               (and (getenv "EMACS_EMBA_CI") '(:unstable)))
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
 
@@ -7305,7 +7342,7 @@ This requires restrictions of file name syntax."
   "Check, whether Ange-FTP is used."
   (eq
    (tramp-find-foreign-file-name-handler tramp-test-vec)
-   'tramp-ftp-file-name-handler))
+   #'tramp-ftp-file-name-handler))
 
 (defun tramp--test-asynchronous-processes-p ()
   "Whether asynchronous processes tests are run.
@@ -7849,8 +7886,8 @@ This requires restrictions of file name syntax."
        "🌈🍒👋")
 
       (when (and (tramp--test-expensive-test-p) (not 
(tramp--test-windows-nt-p)))
-       (delete-dups
-        (mapcar
+       (seq-uniq
+        (tramp-compat-seq-keep
          ;; Use all available language specific snippets.
          (lambda (x)
            (and
@@ -8271,7 +8308,7 @@ process sentinels.  They shall not disturb each other."
       ;; Reading password from auth-source works.  We use the netrc
       ;; backend; the other backends shall behave similar.
       ;; Macro `ert-with-temp-file' was introduced in Emacs 29.1.
-      (with-no-warnings (when (symbol-plist 'ert-with-temp-file)
+      (with-no-warnings (when (symbol-plist #'ert-with-temp-file)
        (tramp-cleanup-connection tramp-test-vec 'keep-debug)
        (setq mocked-input nil)
        (auth-source-forget-all-cached)
@@ -8284,7 +8321,7 @@ process sentinels.  They shall not disturb each other."
            (should (file-exists-p ert-remote-temporary-file-directory))))))
 
       ;; Checking session-timeout.
-      (with-no-warnings (when (symbol-plist 'ert-with-temp-file)
+      (with-no-warnings (when (symbol-plist #'ert-with-temp-file)
        (tramp-cleanup-connection tramp-test-vec 'keep-debug)
        (let ((tramp-connection-properties
               (cons '(nil "session-timeout" 1)
@@ -8360,7 +8397,7 @@ process sentinels.  They shall not disturb each other."
 
       ;; The password shouldn't be read from auth-source.
       ;; Macro `ert-with-temp-file' was introduced in Emacs 29.1.
-      (with-no-warnings (when (symbol-plist 'ert-with-temp-file)
+      (with-no-warnings (when (symbol-plist #'ert-with-temp-file)
        (tramp-cleanup-connection tramp-test-vec 'keep-debug)
        (setq mocked-input nil)
        (auth-source-forget-all-cached)
@@ -8879,15 +8916,12 @@ If INTERACTIVE is non-nil, the tests are run 
interactively."
 ;; * tramp-set-file-uid-gid
 
 ;; * Work on skipped tests.  Make a comment, when it is impossible.
-;; * Use `skip-when' starting with Emacs 30.1.
 ;; * Revisit expensive tests, once problems in `tramp-error' are solved.
 ;; * Fix `tramp-test06-directory-file-name' for "ftp".
 ;; * In `tramp-test26-file-name-completion', check also user, domain,
 ;;   port and hop.
-;; * In `tramp-test26-interactive-file-name-completion', check `flex',
-;;   `initials' and `shorthand' completion styles.  Should
-;;   `minibuffer-completing-file-name' and `completion-pcm--delim-wild-regex'
-;;   be bound?  Check also domain, port and hop.
+;; * In `tramp-test26-interactive-file-name-completion', should
+;;   `completion-pcm--delim-wild-regex' be bound?  Check also domain and port.
 ;; * Check, why a process filter t doesn't work in
 ;;   `tramp-test29-start-file-process' and
 ;;   `tramp-test30-make-process'.
@@ -8899,6 +8933,8 @@ If INTERACTIVE is non-nil, the tests are run 
interactively."
 ;; * Check, why direct async processes do not work for
 ;;   `tramp-test45-asynchronous-requests'.
 
+;; Use `skip-when' starting with Emacs 30.1.
+
 ;; Starting with Emacs 29, use `ert-with-temp-file' and
 ;; `ert-with-temp-directory'.
 
diff --git a/texi/tramp.texi b/texi/tramp.texi
index 23e2311659..5d281dc062 100644
--- a/texi/tramp.texi
+++ b/texi/tramp.texi
@@ -2170,7 +2170,7 @@ the need.
 The package @file{auth-source.el}, originally developed for No Gnus,
 reads passwords from different sources, @xref{Help for users, ,
 auth-source, auth}.  The default authentication file is
-@file{~/.authinfo.gpg}, but this can be changed via the user option
+@file{~/.authinfo}, but this can be changed via the user option
 @code{auth-sources}.
 
 @noindent
diff --git a/texi/trampver.texi b/texi/trampver.texi
index fedbca9a5b..a2ff88cd29 100644
--- a/texi/trampver.texi
+++ b/texi/trampver.texi
@@ -7,7 +7,7 @@
 
 @c In the  Tramp GIT, the version number and the bug report address
 @c are auto-frobbed from configure.ac.
-@set trampver 2.8.0.2
+@set trampver 2.8.0.3
 @set trampurl https://www.gnu.org/software/tramp/
 @set tramp-bug-report-address tramp-devel@@gnu.org
 @set emacsver 28.1
diff --git a/tramp-androidsu.el b/tramp-androidsu.el
index a593833a83..6cc3f14381 100644
--- a/tramp-androidsu.el
+++ b/tramp-androidsu.el
@@ -311,9 +311,7 @@ FUNCTION."
                  (when
                      (and
                       (string-search "=" elt)
-                      (not
-                       (member
-                        elt (default-toplevel-value 'process-environment))))
+                      (not (tramp-local-environment-variable-p elt)))
                    (setq env (cons elt env)))))
           ;; Add remote path if exists.
           (env (let ((remote-path (string-join (tramp-get-remote-path v) ":")))
diff --git a/tramp-cache.el b/tramp-cache.el
index 4ecc804bf2..eedb5a3e9b 100644
--- a/tramp-cache.el
+++ b/tramp-cache.el
@@ -647,7 +647,7 @@ your laptop to different networks frequently."
   "Return a list of (user host) tuples allowed to access for METHOD.
 This function is added always in `tramp-get-completion-function'
 for all methods.  Resulting data are derived from connection history."
-  (delete-dups
+  (seq-uniq
    (tramp-compat-seq-keep
     (lambda (key)
       (let ((tramp-verbose 0))
diff --git a/tramp-compat.el b/tramp-compat.el
index feda8943be..5d463bc006 100644
--- a/tramp-compat.el
+++ b/tramp-compat.el
@@ -229,7 +229,7 @@ value is the default binding of the variable."
              (cdr result)
            ,variable)))))
 
-(dolist (elt (all-completions "tramp-compat-" obarray 'functionp))
+(dolist (elt (all-completions "tramp-compat-" obarray #'functionp))
   (function-put (intern elt) 'tramp-suppress-trace t))
 
 (add-hook 'tramp-unload-hook
diff --git a/tramp-fuse.el b/tramp-fuse.el
index 72b1934fac..07f4ef7458 100644
--- a/tramp-fuse.el
+++ b/tramp-fuse.el
@@ -59,11 +59,10 @@
   (let ((result
         (tramp-skeleton-directory-files directory full match nosort count
           ;; Some storage systems do not return "." and "..".
-          (delete-dups
-           (append
-            '("." "..")
-            (tramp-fuse-remove-hidden-files
-             (directory-files (tramp-fuse-local-file-name directory))))))))
+          (seq-union
+           '("." "..")
+           (tramp-fuse-remove-hidden-files
+            (directory-files (tramp-fuse-local-file-name directory)))))))
     (if full
        ;; Massage the result.
        (let ((local (rx
diff --git a/tramp-gvfs.el b/tramp-gvfs.el
index 7f3ac945bb..c283c119b8 100644
--- a/tramp-gvfs.el
+++ b/tramp-gvfs.el
@@ -2556,7 +2556,7 @@ This uses \"avahi-browse\" in case D-Bus is not enabled 
in Avahi."
           (split-string
            (shell-command-to-string (format "avahi-browse -trkp %s" service))
            (rx (+ (any "\r\n"))) 'omit (rx bol "+;" (* nonl) eol)))))
-    (delete-dups
+    (seq-uniq
      (tramp-compat-seq-keep
       (lambda (x)
        (ignore-errors
diff --git a/tramp-sh.el b/tramp-sh.el
index 9d13cdc3a2..8922adb758 100644
--- a/tramp-sh.el
+++ b/tramp-sh.el
@@ -2770,7 +2770,7 @@ The method used must be an out-of-band method."
                         #'file-name-directory (list localname))))
       (unless (or full-directory-p (member "-d" switches))
         (setq switches (append switches '("-d"))))
-      (setq switches (delete-dups switches)
+      (setq switches (seq-uniq switches)
            switches (mapconcat #'tramp-shell-quote-argument switches " "))
       (when wildcard
        (setq switches (concat switches " " wildcard)))
@@ -3052,8 +3052,7 @@ will be used."
             ;; `process-environment'.
             env uenv
             (env (dolist (elt (cons prompt process-environment) env)
-                   (or (member
-                        elt (default-toplevel-value 'process-environment))
+                   (or (tramp-local-environment-variable-p elt)
                        (if (string-search "=" elt)
                            (setq env (append env `(,elt)))
                          (setq uenv (cons elt uenv))))))
@@ -3288,7 +3287,7 @@ will be used."
                               (cons program args) " "))
       ;; We use as environment the difference to toplevel 
`process-environment'.
       (dolist (elt process-environment)
-        (or (member elt (default-toplevel-value 'process-environment))
+        (or (tramp-local-environment-variable-p elt)
             (if (string-search "=" elt)
                 (setq env (append env `(,elt)))
               (setq uenv (cons elt uenv)))))
diff --git a/tramp.el b/tramp.el
index b63c5d97a0..ce6c6ee63b 100644
--- a/tramp.el
+++ b/tramp.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Michael Albinus <[email protected]>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.8.0.2
+;; Version: 2.8.0.3
 ;; Package-Requires: ((emacs "28.1"))
 ;; Package-Type: multi
 ;; URL: https://www.gnu.org/software/tramp/
@@ -63,11 +63,6 @@
 
 ;;; Code:
 
-(require 'tramp-compat)
-(require 'tramp-message)
-(require 'tramp-integration)
-(require 'trampver)
-
 ;; Pacify byte-compiler.
 (require 'cl-lib)
 (declare-function file-notify-rm-watch "filenotify")
@@ -106,8 +101,9 @@
   ;; TODO: Once (autoload-macro expand) is available in all supported
   ;; Emacs versions (Emacs 31.1+), this can be eliminated:
   ;; Backward compatibility for autoload-macro declare form.
-  (unless (assq 'autoload-macro macro-declarations-alist)
-    (push '(autoload-macro ignore) macro-declarations-alist))
+  (eval-and-compile
+    (unless (assq 'autoload-macro macro-declarations-alist)
+      (push '(autoload-macro ignore) macro-declarations-alist)))
 
   (defmacro tramp--with-startup (&rest body)
     "Schedule BODY to be executed at the end of tramp.el."
@@ -124,6 +120,11 @@
      'defun-declarations-alist
      (list 'tramp-suppress-trace #'tramp-byte-run--set-suppress-trace))))
 
+(require 'tramp-compat)
+(require 'tramp-message)
+(require 'tramp-integration)
+(require 'trampver)
+
 ;;; User Customizable Internal Variables:
 
 (defgroup tramp nil
@@ -2728,7 +2729,7 @@ This avoids problems during autoload, when `load-path' 
contains
 remote file names."
   ;; We expect all other Tramp files in the same directory as tramp.el.
   (let* ((dir (expand-file-name (file-name-directory (locate-library 
"tramp"))))
-        (files (delete-dups
+        (files (seq-uniq
                 (mapcar
                  #'file-name-sans-extension
                  (directory-files
@@ -2760,7 +2761,9 @@ remote file names."
               (cons tramp-file-name-regexp #'tramp-file-name-handler))
   (put #'tramp-file-name-handler 'safe-magic t)
 
-  (tramp-register-crypt-file-name-handler)
+  ;; Don't fail during bootstrap before `tramp-loaddefs.el' is built.
+  (when (fboundp 'tramp-register-crypt-file-name-handler)
+    (tramp-register-crypt-file-name-handler))
 
   (add-to-list 'file-name-handler-alist
               (cons tramp-completion-file-name-regexp
@@ -2771,7 +2774,9 @@ remote file names."
        (mapcar #'car tramp-completion-file-name-handler-alist))
 
   ;; After unloading, `tramp-archive-enabled' might not be defined.
-  (when (bound-and-true-p tramp-archive-enabled)
+  (when (and (bound-and-true-p tramp-archive-enabled)
+             ;; Don't burp during boostrap when `tramp-loaddefs.el' isn't 
built.
+             (boundp 'tramp-archive-file-name-regexp))
     (add-to-list 'file-name-handler-alist
                 (cons tramp-archive-file-name-regexp
                       #'tramp-archive-file-name-handler))
@@ -2798,12 +2803,11 @@ whether HANDLER is to be called.  Add operations 
defined in
   ;; Mark `operations' the handler is responsible for.
   (put #'tramp-file-name-handler
        'operations
-       (delete-dups
-        (append
-         (get 'tramp-file-name-handler 'operations)
-         (mapcar
-          #'car
-          (symbol-value (intern (concat (symbol-name handler) "-alist"))))))))
+       (seq-union
+        (get 'tramp-file-name-handler 'operations)
+        (mapcar
+         #'car
+         (symbol-value (intern (concat (symbol-name handler) "-alist")))))))
 
 (defun tramp-exists-file-name-handler (operation &rest args)
   "Check, whether OPERATION runs a file name handler."
@@ -2974,7 +2978,7 @@ not in completion mode."
 BODY is the backend specific code."
   (declare (indent 2) (debug t))
   `(ignore-error file-missing
-     (delete-dups (delq nil (delete ""
+     (seq-uniq (delq nil (delete ""
        (let* ((case-fold-search read-file-name-completion-ignore-case)
              (result (progn ,@body)))
         ;; Some storage systems do not return "." and "..".
@@ -3261,7 +3265,7 @@ remote host and localname (filename on remote host)."
 (defun tramp-get-completion-methods (partial-method &optional multi-hop)
   "Return all method completions for PARTIAL-METHOD.
 If MULTI-HOP is non-nil, return only multi-hop capable methods."
-  (mapcar
+  (tramp-compat-seq-keep
    (lambda (method)
      (and method (string-prefix-p (or partial-method "") method)
          (or (not multi-hop)
@@ -3367,7 +3371,7 @@ as for \"~/.authinfo.gpg\"."
 This function is added always in `tramp-get-completion-function'
 for all methods.  Resulting data are derived from default settings."
   (and tramp-completion-use-auth-sources
-       (delete-dups
+       (seq-uniq
        (tramp-compat-seq-keep
         (lambda (x) `(,(plist-get x :user) ,(plist-get x :host)))
         (auth-source-search
@@ -3396,7 +3400,7 @@ User is always nil."
       (with-temp-buffer
        (insert-file-contents-literally filename)
        (goto-char (point-min))
-       (delete-dups (delq nil
+       (seq-uniq (delq nil
          (cl-loop while (not (eobp)) collect (funcall function))))))))
 
 (defun tramp-parse-rhosts (filename)
@@ -3533,7 +3537,7 @@ Host is always \"localhost\"."
 (defun tramp-parse-netrc (filename)
   "Return a list of (user host) tuples allowed to access.
 User may be nil."
-  (delete-dups
+  (seq-uniq
    (tramp-compat-seq-keep
     (lambda (item)
       (and (assoc "machine" item)
@@ -5342,6 +5346,18 @@ should be set connection-local.")
         (or (not (stringp buffer)) (not (tramp-tramp-file-p buffer)))
         (or (not (stringp stderr)) (not (tramp-tramp-file-p stderr))))))
 
+;; This function is used by `tramp-*-handle-make-process' and
+;; `tramp-sh-handle-process-file' to filter local environment variables
+;; that should not be propagated remotely.  Users can override this
+;; function if necessary, for example, to ensure that a specific
+;; environment variable is applied to remote processes, whether it
+;; exists locally or not.
+(defun tramp-local-environment-variable-p (arg)
+  "Return non-nil if ARG exists in default `process-environment'.
+Tramp does not propagate local environment variables in remote
+processes."
+  (member arg (default-toplevel-value 'process-environment)))
+
 (defun tramp-handle-make-process (&rest args)
   "An alternative `make-process' implementation for Tramp files."
   (tramp-skeleton-make-process args nil nil
@@ -5360,9 +5376,7 @@ should be set connection-local.")
           (env (dolist (elt process-environment env)
                  (when (and
                         (string-search "=" elt)
-                        (not
-                         (member
-                          elt (default-toplevel-value 'process-environment))))
+                        (not (tramp-local-environment-variable-p elt)))
                    (setq env (cons elt env)))))
           ;; Add remote path if exists.
           (env (if-let* ((sh-file-name-handler-p)
@@ -7408,6 +7422,10 @@ If VEC is `tramp-null-hop', return local null device."
 
 (run-hooks 'tramp--startup-hook)
 (setq tramp--startup-hook nil)
+;; Native compilation uses `expand-file-name'.  This can result loading
+;; "*.eln" files in an infloop, when `default-directory' is remote.
+;; Prevent this.
+(require 'tramp-cache)
 
 ;;; TODO:
 ;;
diff --git a/trampver.el b/trampver.el
index c3f7cc4966..cbd8e30e53 100644
--- a/trampver.el
+++ b/trampver.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Michael Albinus <[email protected]>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.8.0.2
+;; Version: 2.8.0.3
 ;; Package-Requires: ((emacs "28.1"))
 ;; Package-Type: multi
 ;; URL: https://www.gnu.org/software/tramp/
@@ -40,7 +40,7 @@
 ;; ./configure" to change them.
 
 ;;;###tramp-autoload
-(defconst tramp-version "2.8.0.2"
+(defconst tramp-version "2.8.0.3"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -76,7 +76,7 @@
 ;; Check for Emacs version.
 (let ((x   (if (not (string-version-lessp emacs-version "28.1"))
       "ok"
-    (format "Tramp 2.8.0.2 is not fit for %s"
+    (format "Tramp 2.8.0.3 is not fit for %s"
             (replace-regexp-in-string "\n" "" (emacs-version))))))
   (unless (string-equal "ok" x) (error "%s" x)))
 

Reply via email to