emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/tramp 5fafba6a17: Tramp ELPA version 2.6.0.1 released


From: ELPA Syncer
Subject: [elpa] externals/tramp 5fafba6a17: Tramp ELPA version 2.6.0.1 released
Date: Mon, 30 Jan 2023 07:58:44 -0500 (EST)

branch: externals/tramp
commit 5fafba6a17fe68ee657e5a8b2dba34e8d5723ff6
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Tramp ELPA version 2.6.0.1 released
---
 README               |   4 +-
 test/tramp-tests.el  | 124 +++++++++++++++++++++++++++++-----------------
 texi/tramp.texi      |   2 +-
 texi/trampelpa.texi  |   2 +-
 texi/trampver.texi   |   4 +-
 tramp-adb.el         |  29 ++++++-----
 tramp-archive.el     |  37 +++++++-------
 tramp-cache.el       |   2 +-
 tramp-cmds.el        |   4 +-
 tramp-compat.el      |  74 ++++++++++++++++++----------
 tramp-container.el   |  25 +++++-----
 tramp-crypt.el       |   2 +-
 tramp-ftp.el         |   2 +-
 tramp-fuse.el        |   2 +-
 tramp-gvfs.el        |  21 ++++----
 tramp-integration.el |   2 +-
 tramp-rclone.el      |   4 +-
 tramp-sh.el          |  35 +++++++------
 tramp-smb.el         |  49 ++++++++++---------
 tramp-sshfs.el       |   2 +-
 tramp-sudoedit.el    |  18 ++++---
 tramp-uu.el          |   2 +-
 tramp.el             | 136 ++++++++++++++++++++++++++++++---------------------
 trampver.el          |   8 +--
 24 files changed, 341 insertions(+), 249 deletions(-)

diff --git a/README b/README
index c9bcbe9010..482a134aff 100644
--- a/README
+++ b/README
@@ -22,11 +22,11 @@ installed with, you must recompile the package:
 
    * Remove all byte-compiled Tramp files
 
-          $ rm -f ~/.emacs.d/elpa/tramp-2.6.0/tramp*.elc
+          $ rm -f ~/.emacs.d/elpa/tramp-2.6.0.1/tramp*.elc
 
    * Start Emacs with Tramp's source files
 
-          $ emacs -L ~/.emacs.d/elpa/tramp-2.6.0 -l tramp
+          $ emacs -L ~/.emacs.d/elpa/tramp-2.6.0.1 -l tramp
 
      This should not give you the error.
 
diff --git a/test/tramp-tests.el b/test/tramp-tests.el
index 8d63bb3de9..404cf4a47a 100644
--- a/test/tramp-tests.el
+++ b/test/tramp-tests.el
@@ -1,6 +1,6 @@
 ;;; tramp-tests.el --- Tests of remote file access  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
@@ -166,6 +166,9 @@ A resource file is in the resource directory as per
   ;; Suppress nasty messages.
   (fset #'shell-command-sentinel #'ignore)
   ;; We do not want to be interrupted.
+  (fset #'tramp-action-yesno
+       (lambda (_proc vec)
+         (tramp-send-string vec (concat "yes" tramp-local-end-of-line)) t))
   (eval-after-load 'tramp-gvfs
     '(fset 'tramp-gvfs-handler-askquestion
           (lambda (_message _choices) '(t nil 0)))))
@@ -3495,6 +3498,9 @@ This tests also `access-file', `file-readable-p',
             (access-file tmp-name1 "error")
             :type 'file-missing)
 
+           (should-not (file-exists-p tmp-name1))
+           (should-not (file-readable-p tmp-name1))
+           (should-not (file-regular-p tmp-name1))
            ;; `file-ownership-preserved-p' should return t for
            ;; non-existing files.
            (when test-file-ownership-preserved-p
@@ -3579,7 +3585,7 @@ This tests also `access-file', `file-readable-p',
            (should (file-exists-p tmp-name1))
            (should (file-readable-p tmp-name1))
            (should-not (file-regular-p tmp-name1))
-           (should-not (access-file tmp-name1 ""))
+           (should-not (access-file tmp-name1 "error"))
            (when test-file-ownership-preserved-p
              (should (file-ownership-preserved-p tmp-name1 'group)))
            (setq attr (file-attributes tmp-name1))
@@ -3927,7 +3933,10 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
          (tramp--test-ignore-make-symbolic-link-error
            (write-region "foo" nil tmp-name1)
            (should (file-exists-p tmp-name1))
+           (should (file-regular-p tmp-name1))
            (make-symbolic-link tmp-name1 tmp-name2)
+           (should (file-exists-p tmp-name2))
+           (should (file-regular-p tmp-name2))
            (should
             (string-equal
              (funcall
@@ -3978,6 +3987,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
               (string-equal tmp-name1 (file-symlink-p tmp-name3))))
            ;; Check directory as newname.
            (make-directory tmp-name4)
+           (should (file-directory-p tmp-name4))
+           (should-not (file-regular-p tmp-name4))
            (when (tramp--test-expensive-test-p)
              (should-error
               (make-symbolic-link tmp-name1 tmp-name4)
@@ -3991,6 +4002,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
              (file-symlink-p tmp-name5)))
            ;; Check, that files in symlinked directories still work.
            (make-symbolic-link tmp-name4 tmp-name6)
+           (should (file-symlink-p tmp-name6))
+           (should-not (file-regular-p tmp-name6))
            (write-region "foo" nil (expand-file-name "foo" tmp-name6))
            (delete-file (expand-file-name "foo" tmp-name6))
            (should-not (file-exists-p (expand-file-name "foo" tmp-name4)))
@@ -4052,9 +4065,11 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
          (tramp--test-ignore-make-symbolic-link-error
            (write-region "foo" nil tmp-name1)
            (should (file-exists-p tmp-name1))
+           (should (file-regular-p tmp-name1))
            (should (string-equal tmp-name1 (file-truename tmp-name1)))
            (make-symbolic-link tmp-name1 tmp-name2)
            (should (file-symlink-p tmp-name2))
+           (should (file-regular-p tmp-name2))
            (should-not (string-equal tmp-name2 (file-truename tmp-name2)))
            (should
             (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))
@@ -4064,6 +4079,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (let ((default-directory ert-remote-temporary-file-directory))
              (make-symbolic-link (file-name-nondirectory tmp-name1) tmp-name2))
            (should (file-symlink-p tmp-name2))
+           (should (file-regular-p tmp-name2))
            (should-not (string-equal tmp-name2 (file-truename tmp-name2)))
            (should
             (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))
@@ -4079,6 +4095,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                (if quoted #'tramp-compat-file-name-unquote #'identity) penguin)
               tmp-name2)
              (should (file-symlink-p tmp-name2))
+             (should-not (file-regular-p tmp-name2))
              (should
               (string-equal
                (file-truename tmp-name2)
@@ -4089,6 +4106,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (unless (tramp--test-windows-nt-p)
              (make-symbolic-link tmp-name1 tmp-name3)
              (should (file-symlink-p tmp-name3))
+             (should-not (file-regular-p tmp-name3))
               (should-not (string-equal tmp-name3 (file-truename tmp-name3)))
              ;; `file-truename' returns a quoted file name for `tmp-name3'.
              ;; We must unquote it.
@@ -4117,6 +4135,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                (make-symbolic-link
                 tmp-name3
                 (setq tmp-name3 (tramp--test-make-temp-name nil quoted))))
+             (should-not (file-regular-p tmp-name2))
+             (should-not (file-regular-p tmp-name3))
              (should
               (string-equal
                (file-truename tmp-name2)
@@ -4147,6 +4167,12 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
            (tramp--test-ignore-make-symbolic-link-error
             (make-symbolic-link tmp-name2 tmp-name1)
             (should (file-symlink-p tmp-name1))
+            (should-not (file-regular-p tmp-name1))
+            (should-not (file-regular-p tmp-name2))
+            (should
+             (string-equal
+              (file-truename tmp-name1)
+              (file-truename tmp-name2)))
             (if (tramp--test-smb-p)
                 ;; The symlink command of "smbclient" detects the
                 ;; cycle already.
@@ -4154,9 +4180,15 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                  (make-symbolic-link tmp-name1 tmp-name2)
                  :type 'file-error)
               (make-symbolic-link tmp-name1 tmp-name2)
+              (should (file-symlink-p tmp-name1))
               (should (file-symlink-p tmp-name2))
+              (should-not (file-regular-p tmp-name1))
+              (should-not (file-regular-p tmp-name2))
               (should-error
                (file-truename tmp-name1)
+               :type 'file-error)
+              (should-error
+               (file-truename tmp-name2)
                :type 'file-error))))
 
        ;; Cleanup.
@@ -4515,17 +4547,17 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                  (and (string-match-p tramp-ipv6-regexp host)
                       tramp-postfix-ipv6-format)))
               ;; Complete method name.
-             (unless (or (zerop (length method))
-                          (zerop (length tramp-method-regexp)))
+             (unless (or (tramp-string-empty-or-nil-p method)
+                          (string-empty-p tramp-method-regexp))
                (should
                 (member
                  (concat prefix-format method tramp-postfix-method-format)
                  (file-name-all-completions
                    (concat prefix-format (substring method 0 1)) "/"))))
               ;; Complete host name.
-             (unless (or (zerop (length method))
-                          (zerop (length tramp-method-regexp))
-                          (zerop (length host))
+             (unless (or (tramp-string-empty-or-nil-p method)
+                          (string-empty-p tramp-method-regexp)
+                          (tramp-string-empty-or-nil-p host)
                          (tramp--test-gvfs-p method))
                (should
                 (member
@@ -4851,8 +4883,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        ;; Cleanup.
        (ignore-errors (delete-process proc)))
 
-      ;; Disabled process filter.  "sshfs" does not cooperate.
-      (unless (tramp--test-sshfs-p)
+      ;; Disabled process filter.  It doesn't work reliable.
+      (unless t
        (unwind-protect
            (with-temp-buffer
            (setq command '("cat")
@@ -4903,13 +4935,10 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                    (while (accept-process-output proc 0 nil t))))
                (should
                 (string-match-p
-                 (if (and (memq process-connection-type '(nil pipe))
-                           (not (tramp--test-macos-p)))
-                      ;; On macOS, there is always newline conversion.
-                     ;; "telnet" converts \r to <CR><NUL> if `crlf'
-                     ;; flag is FALSE.  See telnet(1) man page.
-                     (rx "66\n6F\n6F\n0D" (? "\n00") "\n0A\n")
-                   (rx "66\n6F\n6F\n0A" (? "\n00") "\n0A\n"))
+                  ;; On macOS, there is always newline conversion.
+                 ;; "telnet" converts \r to <CR><NUL> if `crlf'
+                 ;; flag is FALSE.  See telnet(1) man page.
+                 (rx "66\n" "6F\n" "6F\n" (| "0D\n" "0A\n") (? "00\n") "0A\n")
                  (buffer-string))))
 
            ;; Cleanup.
@@ -5058,8 +5087,8 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
        ;; Cleanup.
        (ignore-errors (delete-process proc)))
 
-      ;; Disabled process filter.  "sshfs" does not cooperate.
-      (unless (tramp--test-sshfs-p)
+      ;; Disabled process filter.  It doesn't work reliable.
+      (unless t
        (unwind-protect
            (with-temp-buffer
              (setq command '("cat")
@@ -5215,14 +5244,10 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
                      (while (accept-process-output proc 0 nil t))))
                  (should
                   (string-match-p
-                   (if (and (memq (or connection-type process-connection-type)
-                                  '(nil pipe))
-                             (not (tramp--test-macos-p)))
-                        ;; On macOS, there is always newline conversion.
-                       ;; "telnet" converts \r to <CR><NUL> if `crlf'
-                       ;; flag is FALSE.  See telnet(1) man page.
-                       (rx "66\n6F\n6F\n0D" (? "\n00") "\n0A\n")
-                     (rx "66\n6F\n6F\n0A" (? "\n00") "\n0A\n"))
+                    ;; On macOS, there is always newline conversion.
+                   ;; "telnet" converts \r to <CR><NUL> if `crlf'
+                   ;; flag is FALSE.  See telnet(1) man page.
+                   (rx "66\n" "6F\n" "6F\n" (| "0D\n" "0A\n") (? "00\n") 
"0A\n")
                    (buffer-string))))
 
              ;; Cleanup.
@@ -5399,7 +5424,7 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
   (when-let ((default-directory ert-remote-temporary-file-directory)
              (mi (memory-info)))
     (should (consp mi))
-    (should (= (length mi) 4))
+    (should (tramp-compat-length= mi 4))
     (dotimes (i (length mi))
       (should (natnump (nth i mi))))))
 
@@ -5504,7 +5529,7 @@ INPUT, if non-nil, is a string sent to the process."
               (format "%s\n" (file-name-nondirectory tmp-name)))
              (should
               (string-match-p
-               ;; Some shells echo, for example the "adb" or "docker" methods.
+               ;; Some shells echo, for example the "adb" or container methods.
                (tramp-compat-rx
                 bos (** 1 2 (literal (file-name-nondirectory tmp-name)) "\n")
                 eos)
@@ -5978,7 +6003,8 @@ INPUT, if non-nil, is a string sent to the process."
           ;; We make a super long `tramp-remote-path'.
           (make-directory tmp-name)
           (should (file-directory-p tmp-name))
-          (while (< (length (mapconcat #'identity orig-exec-path ":")) 5000)
+          (while (tramp-compat-length<
+                 (mapconcat #'identity orig-exec-path ":") 5000)
             (let ((dir (make-temp-file (file-name-as-directory tmp-name) 
'dir)))
               (should (file-directory-p dir))
               (setq tramp-remote-path
@@ -5994,9 +6020,10 @@ INPUT, if non-nil, is a string sent to the process."
           ;; Ignore trailing newline.
          (setq path (substring (shell-command-to-string "echo $PATH") nil -1))
          ;; The shell doesn't handle such long strings.
-         (when (<= (length path)
-                   (tramp-get-connection-property
-                    tramp-test-vec "pipe-buf" 4096))
+         (unless (tramp-compat-length>
+                  path
+                  (tramp-get-connection-property
+                   tramp-test-vec "pipe-buf" 4096))
            ;; The last element of `exec-path' is `exec-directory'.
             (should
             (string-equal
@@ -6637,11 +6664,12 @@ This is used in tests which we don't want to tag
   "Check, whether the remote directory is encrypted."
   (tramp-crypt-file-name-p ert-remote-temporary-file-directory))
 
-(defun tramp--test-docker-p ()
-  "Check, whether the docker method is used.
+(defun tramp--test-container-p ()
+  "Check, whether a container method is used.
 This does not support some special file names."
-  (string-equal
-   "docker" (file-remote-p ert-remote-temporary-file-directory 'method)))
+  (string-match-p
+   (rx bol (| "docker" "podman") eol)
+   (file-remote-p ert-remote-temporary-file-directory 'method)))
 
 (defun tramp--test-expensive-test-p ()
   "Whether expensive tests are run.
@@ -7026,7 +7054,7 @@ This requires restrictions of file name syntax."
   (let ((files
         (list
          (cond ((or (tramp--test-ange-ftp-p)
-                    (tramp--test-docker-p)
+                    (tramp--test-container-p)
                     (tramp--test-gvfs-p)
                     (tramp--test-rclone-p)
                     (tramp--test-sudoedit-p)
@@ -7084,7 +7112,7 @@ This requires restrictions of file name syntax."
   "Check UTF8 encoding in file names and file contents."
   (skip-unless (tramp--test-enabled))
   (skip-unless (not (getenv "EMACS_HYDRA_CI"))) ; SLOW ~ 620s
-  (skip-unless (not (tramp--test-docker-p)))
+  (skip-unless (not (tramp--test-container-p)))
   (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless (not (tramp--test-windows-nt-and-out-of-band-p)))
   (skip-unless (not (tramp--test-ksh-p)))
@@ -7121,6 +7149,9 @@ This requires restrictions of file name syntax."
          ;; Use all available language specific snippets.
          (lambda (x)
            (and
+            ;; The "Oriya" and "Odia" languages use some problematic
+            ;; composition characters.
+            (not (member (car x) '("Oriya" "Odia")))
              (stringp (setq x (eval (get-language-info (car x) 'sample-text) 
t)))
             ;; Filter out strings which use unencodable characters.
             (not (and (or (tramp--test-gvfs-p) (tramp--test-smb-p))
@@ -7155,7 +7186,7 @@ This requires restrictions of file name syntax."
   (when-let ((fsi (with-no-warnings
                    (file-system-info ert-remote-temporary-file-directory))))
     (should (consp fsi))
-    (should (= (length fsi) 3))
+    (should (tramp-compat-length= fsi 3))
     (dotimes (i (length fsi))
       (should (natnump (or (nth i fsi) 0))))))
 
@@ -7213,7 +7244,7 @@ process sentinels.  They shall not disturb each other."
   ;; remote processes in Emacs.  That doesn't work for tramp-adb.el.
   (when (tramp--test-adb-p)
     (skip-unless (tramp--test-emacs27-p)))
-  (skip-unless (not (tramp--test-docker-p)))
+  (skip-unless (not (tramp--test-container-p)))
   (skip-unless (not (tramp--test-telnet-p)))
   (skip-unless (not (tramp--test-sshfs-p)))
   (skip-unless (not (tramp--test-windows-nt-p)))
@@ -7518,7 +7549,7 @@ process sentinels.  They shall not disturb each other."
          ert-remote-temporary-file-directory)))
     (should
      (string-match-p
-      (rx "Tramp loaded: t" (+ (any "\n\r")))
+      (rx "Tramp loaded: t" (+ (any "\r\n")))
       (shell-command-to-string
        (format
        "%s -batch -Q -L %s --eval %s"
@@ -7546,9 +7577,9 @@ process sentinels.  They shall not disturb each other."
       (should
        (string-match-p
        (tramp-compat-rx
-        "Tramp loaded: nil" (+ (any "\n\r"))
-        "Tramp loaded: nil" (+ (any "\n\r"))
-        "Tramp loaded: " (literal (symbol-name tm)) (+ (any "\n\r")))
+        "Tramp loaded: nil" (+ (any "\r\n"))
+        "Tramp loaded: nil" (+ (any "\r\n"))
+        "Tramp loaded: " (literal (symbol-name tm)) (+ (any "\r\n")))
        (shell-command-to-string
         (format
          "%s -batch -Q -L %s --eval %s"
@@ -7703,6 +7734,8 @@ If INTERACTIVE is non-nil, the tests are run 
interactively."
 ;; * file-equal-p (partly done in `tramp-test21-file-links')
 ;; * file-in-directory-p
 ;; * file-name-case-insensitive-p
+;; * memory-info
+;; * tramp-get-home-directory
 ;; * tramp-get-remote-gid
 ;; * tramp-get-remote-groups
 ;; * tramp-get-remote-uid
@@ -7711,6 +7744,9 @@ If INTERACTIVE is non-nil, the tests are run 
interactively."
 ;; * Work on skipped tests.  Make a comment, when it is impossible.
 ;; * Revisit expensive tests, once problems in `tramp-error' are solved.
 ;; * Fix `tramp-test06-directory-file-name' for "ftp".
+;; * Check, why a process filter t doesn't work in
+;;   `tramp-test29-start-file-process' and
+;;   `tramp-test30-make-process'.
 ;; * Implement `tramp-test31-interrupt-process' and
 ;;   `tramp-test31-signal-process' for "adb", "sshfs" and for direct
 ;;   async processes.  Check, why they don't run stable.
diff --git a/texi/tramp.texi b/texi/tramp.texi
index 80874049fa..56436d3297 100644
--- a/texi/tramp.texi
+++ b/texi/tramp.texi
@@ -12,7 +12,7 @@
 @footnotestyle end
 
 @copying
-Copyright @copyright{} 1999--2022 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2023 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/texi/trampelpa.texi b/texi/trampelpa.texi
index a2eb2e236b..a95bc5ae2e 100644
--- a/texi/trampelpa.texi
+++ b/texi/trampelpa.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 
-@c Copyright (C) 2021-2022 Free Software Foundation, Inc.
+@c Copyright (C) 2021-2023 Free Software Foundation, Inc.
 @c See file doclicense.texi for copying conditions.
 
 @include trampver.texi
diff --git a/texi/trampver.texi b/texi/trampver.texi
index 4342b463e9..008cd5dae7 100644
--- a/texi/trampver.texi
+++ b/texi/trampver.texi
@@ -2,12 +2,12 @@
 @c texi/trampver.texi.  Generated from trampver.texi.in by configure.
 
 @c This is part of the Emacs manual.
-@c Copyright (C) 2003--2022 Free Software Foundation, Inc.
+@c Copyright (C) 2003--2023 Free Software Foundation, Inc.
 @c See file doclicense.texi for copying conditions.
 
 @c In the  Tramp GIT, the version number and the bug report address
 @c are auto-frobbed from configure.ac.
-@set trampver 2.6.0
+@set trampver 2.6.0.1
 @set trampurl https://www.gnu.org/software/tramp/
 @set tramp-bug-report-address tramp-devel@@gnu.org
 @set emacsver 26.1
diff --git a/tramp-adb.el b/tramp-adb.el
index 90020fbb1b..d4a7d770a6 100644
--- a/tramp-adb.el
+++ b/tramp-adb.el
@@ -1,6 +1,6 @@
 ;;; tramp-adb.el --- Functions for calling Android Debug Bridge from Tramp  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2023 Free Software Foundation, Inc.
 
 ;; Author: Jürgen Hötzel <juergen@archlinux.org>
 ;; Keywords: comm, processes
@@ -55,7 +55,7 @@ It is used for TCP/IP devices."
 (defconst tramp-adb-method "adb"
   "When this method name is used, forward all calls to Android Debug Bridge.")
 
-(defcustom tramp-adb-prompt (rx bol (* (not (any "#$\n\r"))) (any "#$") blank)
+(defcustom tramp-adb-prompt (rx bol (* (not (any "#$\r\n"))) (any "#$") blank)
   "Regexp used as prompt in almquist shell."
   :type 'regexp
   :version "28.1"
@@ -1032,17 +1032,19 @@ implementation will be used."
                            ;; file will exist until the process is
                            ;; deleted.
                            (when (bufferp stderr)
-                             (with-current-buffer stderr
-                               (insert-file-contents-literally
-                                remote-tmpstderr 'visit))
+                             (ignore-errors
+                               (with-current-buffer stderr
+                                 (insert-file-contents-literally
+                                  remote-tmpstderr 'visit)))
                              ;; Delete tmpstderr file.
                              (add-function
                               :after (process-sentinel p)
                               (lambda (_proc _msg)
-                                (with-current-buffer stderr
-                                  (insert-file-contents-literally
-                                   remote-tmpstderr 'visit nil nil 'replace))
-                                (delete-file remote-tmpstderr))))
+                                (ignore-errors
+                                  (with-current-buffer stderr
+                                    (insert-file-contents-literally
+                                     remote-tmpstderr 'visit nil nil 'replace))
+                                  (delete-file remote-tmpstderr)))))
                            ;; Return process.
                            p))))
 
@@ -1106,11 +1108,12 @@ E.g. a host name \"192.168.1.1#5555\" returns 
\"192.168.1.1:5555\"
              (format "%s:%s" host port))
             ;; An empty host name shall be mapped as well, when there
             ;; is exactly one entry in `devices'.
-            ((and (zerop (length host)) (= (length devices) 1))
+            ((and (tramp-string-empty-or-nil-p host)
+                  (tramp-compat-length= devices 1))
              (car devices))
             ;; Try to connect device.
             ((and tramp-adb-connect-if-not-connected
-                  (not (zerop (length host)))
+                  (tramp-compat-length> host 0)
                   (tramp-adb-execute-adb-command
                     vec "connect"
                     (tramp-compat-string-replace
@@ -1127,7 +1130,7 @@ E.g. a host name \"192.168.1.1#5555\" returns 
\"192.168.1.1:5555\"
   "Execute an adb command.
 Insert the result into the connection buffer.  Return nil on
 error and non-nil on success."
-  (when (and (> (length (tramp-file-name-host vec)) 0)
+  (when (and (tramp-compat-length> (tramp-file-name-host vec) 0)
             ;; The -s switch is only available for ADB device commands.
             (not (member (car args) '("connect" "disconnect"))))
     (setq args (append (list "-s" (tramp-adb-get-device vec)) args)))
@@ -1254,7 +1257,7 @@ connection if a previous connection has died for some 
reason."
     (unless (process-live-p p)
       (save-match-data
        (when (and p (processp p)) (delete-process p))
-       (if (zerop (length device))
+       (if (tramp-string-empty-or-nil-p device)
            (tramp-error vec 'file-error "Device %s not connected" host))
        (with-tramp-progress-reporter vec 3 "Opening adb shell connection"
          (let* ((coding-system-for-read 'utf-8-dos) ; Is this correct?
diff --git a/tramp-archive.el b/tramp-archive.el
index 49b0c0bb6b..5874e18479 100644
--- a/tramp-archive.el
+++ b/tramp-archive.el
@@ -1,6 +1,6 @@
 ;;; tramp-archive.el --- Tramp archive manager  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -631,7 +631,7 @@ offered."
 (defun tramp-archive-handle-directory-file-name (directory)
   "Like `directory-file-name' for file archives."
   (with-parsed-tramp-archive-file-name directory nil
-    (if (and (not (zerop (length localname)))
+    (if (and (tramp-compat-length> localname 0)
             (eq (aref localname (1- (length localname))) ?/)
             (not (string= localname "/")))
        (substring directory 0 -1)
@@ -643,23 +643,22 @@ offered."
 (defun tramp-archive-handle-directory-files
     (directory &optional full match nosort count)
   "Like `directory-files' for Tramp files."
-  (unless (file-exists-p directory)
-    (tramp-error (tramp-dissect-file-name directory) 'file-missing directory))
-  (when (file-directory-p directory)
-    (setq directory (file-name-as-directory (expand-file-name directory)))
-    (let ((temp (nreverse (file-name-all-completions "" directory)))
-         result item)
-
-      (while temp
-       (setq item (directory-file-name (pop temp)))
-       (when (or (null match) (string-match-p match item))
-         (push (if full (concat directory item) item)
-               result)))
-      (unless nosort
-        (setq result (sort result #'string<)))
-      (when (and (natnump count) (> count 0))
-       (setq result (tramp-compat-ntake count result)))
-      result)))
+  (tramp-barf-if-file-missing (tramp-dissect-file-name directory) directory
+    (when (file-directory-p directory)
+      (setq directory (file-name-as-directory (expand-file-name directory)))
+      (let ((temp (nreverse (file-name-all-completions "" directory)))
+           result item)
+
+       (while temp
+         (setq item (directory-file-name (pop temp)))
+         (when (or (null match) (string-match-p match item))
+           (push (if full (concat directory item) item)
+                 result)))
+       (unless nosort
+          (setq result (sort result #'string<)))
+       (when (and (natnump count) (> count 0))
+         (setq result (tramp-compat-ntake count result)))
+       result))))
 
 (defun tramp-archive-handle-dired-uncache (dir)
   "Like `dired-uncache' for file archives."
diff --git a/tramp-cache.el b/tramp-cache.el
index 912ea5f8bb..09e43a9903 100644
--- a/tramp-cache.el
+++ b/tramp-cache.el
@@ -1,6 +1,6 @@
 ;;; tramp-cache.el --- file information caching for Tramp  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2000, 2005-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2005-2023 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pittman <daniel@inanna.danann.net>
 ;;         Michael Albinus <michael.albinus@gmx.de>
diff --git a/tramp-cmds.el b/tramp-cmds.el
index 0442fa7409..fde814fa5a 100644
--- a/tramp-cmds.el
+++ b/tramp-cmds.el
@@ -1,6 +1,6 @@
 ;;; tramp-cmds.el --- Interactive commands for Tramp  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -127,7 +127,7 @@ When called interactively, a Tramp connection has to be 
selected."
                 (or (not keep-processes)
                     (eq key (tramp-get-process vec))))
        (tramp-flush-connection-properties key)
-       (delete-process key)))
+       (ignore-errors (delete-process key))))
 
     ;; Remove buffers.
     (dolist
diff --git a/tramp-compat.el b/tramp-compat.el
index 252eab0f3b..e2681c4ad1 100644
--- a/tramp-compat.el
+++ b/tramp-compat.el
@@ -1,6 +1,6 @@
 ;;; tramp-compat.el --- Tramp compatibility functions  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -119,7 +119,8 @@ NAME is unquoted."
              (localname (file-local-name name)))
        (when (tramp-compat-file-name-quoted-p localname top)
          (setq
-          localname (if (= (length localname) 2) "/" (substring localname 2))))
+          localname
+          (if (tramp-compat-length= localname 2) "/" (substring localname 2))))
        (concat (file-remote-p name) localname)))))
 
 ;; `tramp-syntax' has changed its meaning in Emacs 26.1.  We still
@@ -326,6 +327,48 @@ CONDITION can also be a list of error conditions."
                          (car components))
                 (cdr components)))))))
 
+;; Function `replace-regexp-in-region' is new in Emacs 28.1.
+(defalias 'tramp-compat-replace-regexp-in-region
+  (if (fboundp 'replace-regexp-in-region)
+      #'replace-regexp-in-region
+    (lambda (regexp replacement &optional start end)
+      (if start
+         (when (< start (point-min))
+            (error "Start before start of buffer"))
+       (setq start (point)))
+      (if end
+         (when (> end (point-max))
+            (error "End after end of buffer"))
+       (setq end (point-max)))
+      (save-excursion
+       (let ((matches 0)
+              (case-fold-search nil))
+         (goto-char start)
+         (while (re-search-forward regexp end t)
+            (replace-match replacement t)
+            (setq matches (1+ matches)))
+         (and (not (zerop matches))
+               matches))))))
+
+;; `length<', `length>' and `length=' are added to Emacs 28.1.
+(defalias 'tramp-compat-length<
+  (if (fboundp 'length<)
+      #'length<
+    (lambda (sequence length)
+      (< (length sequence) length))))
+
+(defalias 'tramp-compat-length>
+  (if (fboundp 'length>)
+      #'length>
+    (lambda (sequence length)
+      (> (length sequence) length))))
+
+(defalias 'tramp-compat-length=
+  (if (fboundp 'length=)
+      #'length=
+    (lambda (sequence length)
+      (= (length sequence) length))))
+
 ;; `permission-denied' is introduced in Emacs 29.1.
 (defconst tramp-permission-denied
   (if (get 'permission-denied 'error-conditions) 'permission-denied 
'file-error)
@@ -353,7 +396,7 @@ CONDITION can also be a list of error conditions."
       #'take
     (lambda (n list)
       (when (and (natnump n) (> n 0))
-       (if (>= n (length list))
+       (if (tramp-compat-length< list n)
            list (butlast list (- (length list) n)))))))
 
 ;; Function `ntake' is new in Emacs 29.1.
@@ -362,7 +405,7 @@ CONDITION can also be a list of error conditions."
       #'ntake
     (lambda (n list)
       (when (and (natnump n) (> n 0))
-       (if (>= n (length list))
+       (if (tramp-compat-length< list n)
            list (nbutlast list (- (length list) n)))))))
 
 ;; Function `string-equal-ignore-case' is new in Emacs 29.1.
@@ -382,29 +425,6 @@ CONDITION can also be a list of error conditions."
       (autoload 'netrc-parse "netrc")
       (netrc-parse file))))
 
-;; Function `replace-regexp-in-region' is new in Emacs 28.1.
-(defalias 'tramp-compat-replace-regexp-in-region
-  (if (fboundp 'replace-regexp-in-region)
-      #'replace-regexp-in-region
-    (lambda (regexp replacement &optional start end)
-      (if start
-         (when (< start (point-min))
-            (error "Start before start of buffer"))
-       (setq start (point)))
-      (if end
-         (when (> end (point-max))
-            (error "End after end of buffer"))
-       (setq end (point-max)))
-      (save-excursion
-       (let ((matches 0)
-              (case-fold-search nil))
-         (goto-char start)
-         (while (re-search-forward regexp end t)
-            (replace-match replacement t)
-            (setq matches (1+ matches)))
-         (and (not (zerop matches))
-               matches))))))
-
 (dolist (elt (all-completions "tramp-compat-" obarray 'functionp))
   (put (intern elt) 'tramp-suppress-trace t))
 
diff --git a/tramp-container.el b/tramp-container.el
index 7b94253226..e45b73a213 100644
--- a/tramp-container.el
+++ b/tramp-container.el
@@ -1,6 +1,6 @@
 ;;; tramp-container.el --- Tramp integration for Docker-like containers  -*- 
lexical-binding: t; -*-
 
-;; Copyright © 2022 Free Software Foundation, Inc.
+;; Copyright © 2022-2023 Free Software Foundation, Inc.
 
 ;; Author: Brian Cully <bjc@kublai.com>
 ;; Keywords: comm, processes
@@ -96,15 +96,16 @@
   "Tramp method name to use to connect to Kubernetes containers.")
 
 ;;;###tramp-autoload
-(defun tramp-docker--completion-function (&rest _args)
-  "List Docker-like containers available for connection.
+(defun tramp-container--completion-function (program)
+  "List running containers available for connection.
+PROGRAM is the program to be run for \"ps\", either
+`tramp-docker-program' or `tramp-podman-program'.
 
 This function is used by `tramp-set-completion-function', please
 see its function help for a description of the format."
   (when-let ((default-directory tramp-compat-temporary-file-directory)
             (raw-list (shell-command-to-string
-                       (concat tramp-docker-program
-                               " ps --format '{{.ID}}\t{{.Names}}'")))
+                       (concat program " ps --format '{{.ID}}\t{{.Names}}'")))
              (lines (split-string raw-list "\n" 'omit))
              (names (mapcar
                     (lambda (line)
@@ -114,7 +115,7 @@ see its function help for a description of the format."
                              line)
                         (or (match-string 2 line) (match-string 1 line))))
                      lines)))
-    (mapcar (lambda (m) (list nil m)) (delq nil names))))
+    (mapcar (lambda (name) (list nil name)) (delq nil names))))
 
 ;;;###tramp-autoload
 (defun tramp-kubernetes--completion-function (&rest _args)
@@ -128,9 +129,7 @@ see its function help for a description of the format."
                                 " get pods --no-headers "
                                 "-o custom-columns=NAME:.metadata.name")))
              (names (split-string raw-list "\n" 'omit)))
-    (mapcar (lambda (name)
-              (list nil name))
-            names)))
+    (mapcar (lambda (name) (list nil name)) names)))
 
 (defun tramp-kubernetes--current-context-data (vec)
   "Return Kubernetes current context data as JSON string."
@@ -167,6 +166,7 @@ see its function help for a description of the format."
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-i" "-c"))))
+
  (add-to-list 'tramp-methods
               `(,tramp-podman-method
                 (tramp-login-program ,tramp-podman-program)
@@ -179,6 +179,7 @@ see its function help for a description of the format."
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-i" "-c"))))
+
  (add-to-list 'tramp-methods
               `(,tramp-kubernetes-method
                 (tramp-login-program ,tramp-kubernetes-program)
@@ -195,11 +196,13 @@ see its function help for a description of the format."
 
  (tramp-set-completion-function
   tramp-docker-method
-  '((tramp-docker--completion-function "")))
+  `((tramp-container--completion-function
+     ,(executable-find tramp-docker-program))))
 
  (tramp-set-completion-function
   tramp-podman-method
-  '((tramp-docker--completion-function "")))
+  `((tramp-container--completion-function
+     ,(executable-find tramp-podman-program))))
 
  (tramp-set-completion-function
   tramp-kubernetes-method
diff --git a/tramp-crypt.el b/tramp-crypt.el
index 249b3fcd4d..c7696a51da 100644
--- a/tramp-crypt.el
+++ b/tramp-crypt.el
@@ -1,6 +1,6 @@
 ;;; tramp-crypt.el --- Tramp crypt utilities  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/tramp-ftp.el b/tramp-ftp.el
index ad736256ca..1712c00b0a 100644
--- a/tramp-ftp.el
+++ b/tramp-ftp.el
@@ -1,6 +1,6 @@
 ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/tramp-fuse.el b/tramp-fuse.el
index ea6b5a0622..e1ad0c2e5d 100644
--- a/tramp-fuse.el
+++ b/tramp-fuse.el
@@ -1,6 +1,6 @@
 ;;; tramp-fuse.el --- Tramp access functions for FUSE mounts  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/tramp-gvfs.el b/tramp-gvfs.el
index da7641774f..9d766a1438 100644
--- a/tramp-gvfs.el
+++ b/tramp-gvfs.el
@@ -1,6 +1,6 @@
 ;;; tramp-gvfs.el --- Tramp access functions for GVFS daemon  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -1157,7 +1157,8 @@ file names."
   ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
   (setq dir (or dir default-directory "/"))
   ;; Handle empty NAME.
-  (when (zerop (length name)) (setq name "."))
+  (when (string-empty-p name)
+    (setq name "."))
   ;; Unless NAME is absolute, concat DIR and NAME.
   (unless (file-name-absolute-p name)
     (setq name (tramp-compat-file-name-concat dir name)))
@@ -1173,7 +1174,7 @@ file names."
        (let ((uname (match-string 1 localname))
              (fname (match-string 2 localname))
              hname)
-         (when (zerop (length uname))
+         (when (tramp-string-empty-or-nil-p uname)
            (setq uname user))
          (when (setq hname (tramp-get-home-directory v uname))
            (setq localname (concat hname fname)))))
@@ -1536,7 +1537,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
            'file-notify-callback (list proc action file file1)))))
 
     ;; Save rest of the string.
-    (when (zerop (length string)) (setq string nil))
+    (when (string-empty-p string) (setq string nil))
     (when string (tramp-message proc 10 "Rest string:\n%s" string))
     (process-put proc 'rest-string string)))
 
@@ -1636,7 +1637,7 @@ VEC or USER, or if there is no home directory, return 
nil."
   (let ((localname (tramp-get-connection-property vec "default-location"))
        result)
     (cond
-     ((zerop (length localname))
+     ((tramp-string-empty-or-nil-p localname)
       (tramp-get-connection-property (tramp-get-process vec) "share"))
      ;; Google-drive.
      ((not (string-prefix-p "/" localname))
@@ -1769,11 +1770,11 @@ a downcased host name only."
 
     (condition-case nil
        (with-parsed-tramp-file-name filename l
-         (when (and (zerop (length user))
+         (when (and (tramp-string-empty-or-nil-p user)
                     (not
                      (zerop (logand flags tramp-gvfs-password-need-username))))
            (setq user (read-string "User name: ")))
-         (when (and (zerop (length domain))
+         (when (and (tramp-string-empty-or-nil-p domain)
                     (not
                      (zerop (logand flags tramp-gvfs-password-need-domain))))
            (setq domain (read-string "Domain name: ")))
@@ -2212,7 +2213,7 @@ connection if a previous connection has died for some 
reason."
 
       (with-tramp-progress-reporter
          vec 3
-         (if (zerop (length user))
+         (if (tramp-string-empty-or-nil-p user)
              (format "Opening connection for %s using %s" host method)
            (format "Opening connection for %s@%s using %s" user host method))
 
@@ -2262,7 +2263,7 @@ connection if a previous connection has died for some 
reason."
        (with-timeout
            ((or (tramp-get-method-parameter vec 'tramp-connection-timeout)
                 tramp-connection-timeout)
-            (if (zerop (length (tramp-file-name-user vec)))
+            (if (tramp-string-empty-or-nil-p (tramp-file-name-user vec))
                 (tramp-error
                  vec 'file-error
                  "Timeout reached mounting %s using %s" host method)
@@ -2441,7 +2442,7 @@ VEC is used only for traces."
     ;; Adapt default host name, supporting /mtp:: when possible.
     (setq tramp-default-host-alist
          (append
-          `(("mtp" nil ,(if (= (length devices) 1) (car devices) "")))
+          `(("mtp" nil ,(if (tramp-compat-length= devices 1) (car devices) 
"")))
           (delete
            (assoc "mtp" tramp-default-host-alist)
            tramp-default-host-alist)))))
diff --git a/tramp-integration.el b/tramp-integration.el
index 78107e1a03..cff0877555 100644
--- a/tramp-integration.el
+++ b/tramp-integration.el
@@ -1,6 +1,6 @@
 ;;; tramp-integration.el --- Tramp integration into other packages  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/tramp-rclone.el b/tramp-rclone.el
index 8e583cc402..0d87163aa1 100644
--- a/tramp-rclone.el
+++ b/tramp-rclone.el
@@ -1,6 +1,6 @@
 ;;; tramp-rclone.el --- Tramp access functions to cloud storages  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -361,7 +361,7 @@ connection if a previous connection has died for some 
reason."
 
   (let ((host (tramp-file-name-host vec)))
     (when (rassoc `(,host) (tramp-rclone-parse-device-names nil))
-      (if (zerop (length host))
+      (if (tramp-string-empty-or-nil-p host)
          (tramp-error vec 'file-error "Storage %s not connected" host))
       ;; We need a process bound to the connection buffer.  Therefore,
       ;; we create a dummy process.  Maybe there is a better solution?
diff --git a/tramp-sh.el b/tramp-sh.el
index ac5de22cb8..933f909c12 100644
--- a/tramp-sh.el
+++ b/tramp-sh.el
@@ -1,6 +1,6 @@
 ;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2023 Free Software Foundation, Inc.
 
 ;; (copyright statements below in code to be updated with the above notice)
 
@@ -838,7 +838,6 @@ characters need to be doubled.")
 (defconst tramp-perl-encode
   "%p -e '
 # This script contributed by Juanma Barranquero <lektu@terra.es>.
-# Copyright (C) 2002-2022 Free Software Foundation, Inc.
 use strict;
 
 my %%trans = do {
@@ -877,7 +876,6 @@ characters need to be doubled.")
 (defconst tramp-perl-decode
   "%p -e '
 # This script contributed by Juanma Barranquero <lektu@terra.es>.
-# Copyright (C) 2002-2022 Free Software Foundation, Inc.
 use strict;
 
 my %%trans = do {
@@ -1746,7 +1744,7 @@ ID-FORMAT valid values are `string' and `integer'."
     ;; Sometimes, when a connection is not established yet, it is
     ;; desirable to return t immediately for "/method:foo:".  It can
     ;; be expected that this is always a directory.
-    (or (zerop (length localname))
+    (or (tramp-string-empty-or-nil-p localname)
        (with-tramp-file-property v localname "file-directory-p"
          (if-let
              ((truename (tramp-get-file-property v localname "file-truename"))
@@ -2359,7 +2357,7 @@ The method used must be an out-of-band method."
         copy-program copy-args copy-env copy-keep-date listener spec
         options source target remote-copy-program remote-copy-args p)
 
-    (if (and v1 v2 (zerop (length (tramp-scp-direct-remote-copying v1 v2))))
+    (if (and v1 v2 (string-empty-p (tramp-scp-direct-remote-copying v1 v2)))
 
        ;; Both are Tramp files.  We cannot use direct remote copying.
        (let* ((dir-flag (file-directory-p filename))
@@ -2707,9 +2705,9 @@ The method used must be an out-of-band method."
                   (tramp-get-ls-command v)
                   switches
                   (if (or wildcard
-                          (zerop (length
-                                  (tramp-run-real-handler
-                                   #'file-name-nondirectory (list 
localname)))))
+                          (tramp-string-empty-or-nil-p
+                           (tramp-run-real-handler
+                            #'file-name-nondirectory (list localname))))
                       ""
                     (tramp-shell-quote-argument
                      (tramp-run-real-handler
@@ -2826,7 +2824,8 @@ the result will be a local, non-Tramp, file name."
   ;; If DIR is not given, use `default-directory' or "/".
   (setq dir (or dir default-directory "/"))
   ;; Handle empty NAME.
-  (when (zerop (length name)) (setq name "."))
+  (when (string-empty-p name)
+    (setq name "."))
   ;; On MS Windows, some special file names are not returned properly
   ;; by `file-name-absolute-p'.  If `tramp-syntax' is `simplified',
   ;; there could be the false positive "/:".
@@ -2864,7 +2863,7 @@ the result will be a local, non-Tramp, file name."
            ;; the default user name for tilde expansion is not
            ;; appropriate either, because ssh and companions might
            ;; use a user name from the config file.
-           (when (and (zerop (length uname))
+           (when (and (tramp-string-empty-or-nil-p uname)
                       (string-match-p (rx bos "su" (? "do") eos) method))
              (setq uname user))
            (when (setq hname (tramp-get-home-directory v uname))
@@ -2965,7 +2964,7 @@ implementation will be used."
                 (heredoc (and (not (bufferp stderr))
                               (stringp program)
                               (string-match-p (rx "sh" eol) program)
-                              (= (length args) 2)
+                              (tramp-compat-length= args 2)
                               (string-equal "-c" (car args))
                               ;; Don't if there is a quoted string.
                               (not
@@ -2975,7 +2974,7 @@ implementation will be used."
                 ;; When PROGRAM is nil, we just provide a tty.
                 (args (if (not heredoc) args
                         (let ((i 250))
-                          (while (and (< i (length (cadr args)))
+                          (while (and (not (tramp-compat-length< (cadr args) 
i))
                                       (string-match " " (cadr args) i))
                             (setcdr
                              args
@@ -3957,7 +3956,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
     ;; Save rest of the string.
     (while (string-match (rx bol "\n") string)
       (setq string (replace-match "" nil nil string)))
-    (when (zerop (length string)) (setq string nil))
+    (when (string-empty-p string) (setq string nil))
     (when string (tramp-message proc 10 "Rest string:\n%s" string))
     (process-put proc 'rest-string string)))
 
@@ -3965,7 +3964,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
   "Read output from \"inotifywait\" and add corresponding `file-notify' 
events."
   (let ((events (process-get proc 'events)))
     (tramp-message proc 6 "%S\n%s" proc string)
-    (dolist (line (split-string string "[\n\r]+" 'omit))
+    (dolist (line (split-string string (rx (+ (any "\r\n"))) 'omit))
       ;; Check, whether there is a problem.
       (unless (string-match
               (rx bol (+ (not blank)) (+ blank) (group (+ (not blank)))
@@ -4213,7 +4212,7 @@ variable PATH."
             'noerror)))
        tmpfile chunk chunksize)
     (tramp-message vec 5 "Setting $PATH environment variable")
-    (if (< (length command) pipe-buf)
+    (if (tramp-compat-length< command pipe-buf)
        (tramp-send-command vec command)
       ;; Use a temporary file.  We cannot use `write-region' because
       ;; setting the remote path happens in the early connection
@@ -4604,7 +4603,7 @@ process to set up.  VEC specifies the connection."
 
     ;; Set `remote-tty' process property.
     (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"" 
'noerror)))
-      (unless (zerop (length tty))
+      (unless (string-empty-p tty)
        (process-put proc 'remote-tty tty)
        (tramp-set-connection-property proc "remote-tty" tty)))
 
@@ -5177,7 +5176,7 @@ connection if a previous connection has died for some 
reason."
        (unless (process-live-p p)
          (with-tramp-progress-reporter
              vec 3
-             (if (zerop (length (tramp-file-name-user vec)))
+             (if (tramp-string-empty-or-nil-p (tramp-file-name-user vec))
                  (format "Opening connection %s for %s using %s"
                          process-name
                          (tramp-file-name-host vec)
@@ -5551,7 +5550,7 @@ raises an error."
     (cond
      ((tramp-get-method-parameter vec 'tramp-remote-copy-program)
       localname)
-     ((zerop (length user)) (format "%s:%s" host localname))
+     ((tramp-string-empty-or-nil-p user) (format "%s:%s" host localname))
      (t (format "%s@%s:%s" user host localname)))))
 
 (defun tramp-method-out-of-band-p (vec size)
diff --git a/tramp-smb.el b/tramp-smb.el
index cd73b9b8ec..56d0af6540 100644
--- a/tramp-smb.el
+++ b/tramp-smb.el
@@ -1,6 +1,6 @@
 ;;; tramp-smb.el --- Tramp access functions for SMB servers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -487,9 +487,9 @@ arguments to pass to the OPERATION."
                       (args      (list (concat "//" host "/" share) "-E"))
                       (options   tramp-smb-options))
 
-                 (if (not (zerop (length user)))
-                     (setq args (append args (list "-U" user)))
-                   (setq args (append args (list "-N"))))
+                 (if (tramp-string-empty-or-nil-p user)
+                     (setq args (append args (list "-N")))
+                   (setq args (append args (list "-U" user))))
 
                  (when domain (setq args (append args (list "-W" domain))))
                  (when port   (setq args (append args (list "-p" port))))
@@ -719,7 +719,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
   ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
   (setq dir (or dir default-directory "/"))
   ;; Handle empty NAME.
-  (when (zerop (length name)) (setq name "."))
+  (when (string-empty-p name)
+    (setq name "."))
   ;; Unless NAME is absolute, concat DIR and NAME.
   (unless (file-name-absolute-p name)
     (setq name (tramp-compat-file-name-concat dir name)))
@@ -735,7 +736,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
        (let ((uname (match-string 1 localname))
              (fname (match-string 2 localname))
              hname)
-         (when (zerop (length uname))
+         (when (tramp-string-empty-or-nil-p uname)
            (setq uname user))
          (when (setq hname (tramp-get-home-directory v uname))
            (setq localname (concat hname fname)))))
@@ -789,9 +790,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                 (args      (list (concat "//" host "/" share) "-E"))
                 (options   tramp-smb-options))
 
-           (if (not (zerop (length user)))
-               (setq args (append args (list "-U" user)))
-             (setq args (append args (list "-N"))))
+           (if (tramp-string-empty-or-nil-p user)
+               (setq args (append args (list "-N")))
+             (setq args (append args (list "-U" user))))
 
            (when domain (setq args (append args (list "-W" domain))))
            (when port   (setq args (append args (list "-p" port))))
@@ -1079,7 +1080,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          (setq entries
                (delq
                 nil
-                (if (or wildcard (zerop (length base)))
+                (if (or wildcard (string-empty-p base))
                     ;; Check for matching entries.
                     (mapcar
                      (lambda (x)
@@ -1105,7 +1106,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          (when (tramp-compat-string-search "F" switches)
            (mapc
             (lambda (x)
-              (unless (zerop (length (car x)))
+              (unless (string-empty-p (car x))
                 (cond
                  ((char-equal ?d (string-to-char (nth 1 x)))
                   (setcar x (concat (car x) "/")))
@@ -1125,7 +1126,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          ;; Print entries.
          (mapc
           (lambda (x)
-            (unless (zerop (length (nth 0 x)))
+            (unless (string-empty-p (nth 0 x))
               (let ((attr
                      (when (tramp-smb-get-stat-capability v)
                        (ignore-errors
@@ -1229,7 +1230,10 @@ component is used as the target of the symlink."
     (let ((non-essential t))
       (when (and (tramp-tramp-file-p target)
                 (tramp-file-name-equal-p v (tramp-dissect-file-name target)))
-       (setq target (tramp-file-local-name (expand-file-name target)))))
+       (setq target (tramp-file-local-name (expand-file-name target))))
+      ;; There could be a cyclic link.
+      (tramp-flush-file-properties
+       v (expand-file-name target (tramp-file-local-name default-directory))))
 
     ;; If TARGET is still remote, quote it.
     (if (tramp-tramp-file-p target)
@@ -1455,9 +1459,9 @@ component is used as the target of the symlink."
                                 "\n" "," acl-string)))
               (options   tramp-smb-options))
 
-         (if (not (zerop (length user)))
-             (setq args (append args (list "-U" user)))
-           (setq args (append args (list "-N"))))
+         (if (tramp-string-empty-or-nil-p user)
+             (setq args (append args (list "-N")))
+           (setq args (append args (list "-U" user))))
 
          (when domain (setq args (append args (list "-W" domain))))
          (when port   (setq args (append args (list "-p" port))))
@@ -1607,7 +1611,7 @@ If USER is a string, return its home directory instead of 
the
 user identified by VEC.  If there is no user specified in either
 VEC or USER, or if there is no home directory, return nil."
   (let ((user (or user (tramp-file-name-user vec))))
-    (unless (zerop (length user))
+    (unless (tramp-string-empty-or-nil-p user)
       (concat "/" user))))
 
 (defun tramp-smb-handle-write-region
@@ -1956,7 +1960,7 @@ If ARGUMENT is non-nil, use it as argument for
          (setq tramp-smb-version (shell-command-to-string command))
          (tramp-message vec 6 command)
          (tramp-message vec 6 "\n%s" tramp-smb-version)
-         (if (string-match (rx (+ (any " \t\n\r")) eos) tramp-smb-version)
+         (if (string-match (rx (+ (any " \t\r\n")) eos) tramp-smb-version)
              (setq tramp-smb-version
                    (replace-match "" nil nil tramp-smb-version))))
 
@@ -2009,9 +2013,9 @@ If ARGUMENT is non-nil, use it as argument for
           (t
            (setq args (list "-g" "-L" host ))))
 
-         (if (not (zerop (length user)))
-             (setq args (append args (list "-U" user)))
-           (setq args (append args (list "-N"))))
+         (if (tramp-string-empty-or-nil-p user)
+             (setq args (append args (list "-N")))
+           (setq args (append args (list "-U" user))))
 
          (when domain (setq args (append args (list "-W" domain))))
          (when port   (setq args (append args (list "-p" port))))
@@ -2026,7 +2030,8 @@ If ARGUMENT is non-nil, use it as argument for
          (with-tramp-progress-reporter
              vec 3
              (format "Opening connection for //%s%s/%s"
-                     (if (not (zerop (length user))) (concat user "@") "")
+                     (if (tramp-string-empty-or-nil-p user)
+                         "" (concat user "@"))
                      host (or share ""))
 
            (let* (coding-system-for-read
diff --git a/tramp-sshfs.el b/tramp-sshfs.el
index 44c55041ff..2d3c436632 100644
--- a/tramp-sshfs.el
+++ b/tramp-sshfs.el
@@ -1,6 +1,6 @@
 ;;; tramp-sshfs.el --- Tramp access functions via sshfs  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/tramp-sudoedit.el b/tramp-sudoedit.el
index fcc27dd834..ef3090cc9b 100644
--- a/tramp-sudoedit.el
+++ b/tramp-sudoedit.el
@@ -1,6 +1,6 @@
 ;;; tramp-sudoedit.el --- Functions for accessing under root permissions  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -366,7 +366,8 @@ the result will be a local, non-Tramp, file name."
   ;; If DIR is not given, use `default-directory' or "/".
   (setq dir (or dir default-directory "/"))
   ;; Handle empty NAME.
-  (when (zerop (length name)) (setq name "."))
+  (when (string-empty-p name)
+    (setq name "."))
   ;; Unless NAME is absolute, concat DIR and NAME.
   (unless (file-name-absolute-p name)
     (setq name (tramp-compat-file-name-concat dir name)))
@@ -377,7 +378,7 @@ the result will be a local, non-Tramp, file name."
       ;; Tilde expansion if necessary.  We cannot accept "~/", because
       ;; under sudo "~/" is expanded to the local user home directory
       ;; but to the root home directory.
-      (when (zerop (length localname))
+      (when (tramp-string-empty-or-nil-p localname)
        (setq localname "~"))
       (unless (file-name-absolute-p localname)
        (setq localname (format "~%s/%s" user localname)))
@@ -387,7 +388,7 @@ the result will be a local, non-Tramp, file name."
        (let ((uname (match-string 1 localname))
              (fname (match-string 2 localname))
              hname)
-         (when (zerop (length uname))
+         (when (tramp-string-empty-or-nil-p uname)
            (setq uname user))
          (when (setq hname (tramp-get-home-directory v uname))
            (setq localname (concat hname fname)))))
@@ -476,11 +477,11 @@ the result will be a local, non-Tramp, file name."
      (with-tramp-file-property v localname "file-name-all-completions"
        (tramp-sudoedit-send-command
        v "ls" "-a1" "--quoting-style=literal" "--show-control-chars"
-       (if (zerop (length localname))
+       (if (tramp-string-empty-or-nil-p localname)
            "" (tramp-compat-file-name-unquote localname)))
        (mapcar
        (lambda (f)
-         (if (file-directory-p (expand-file-name f directory))
+         (if (ignore-errors (file-directory-p (expand-file-name f directory)))
              (file-name-as-directory f)
            f))
        (delq
@@ -653,7 +654,10 @@ component is used as the target of the symlink."
     (let ((non-essential t))
       (when (and (tramp-tramp-file-p target)
                 (tramp-file-name-equal-p v (tramp-dissect-file-name target)))
-       (setq target (tramp-file-local-name (expand-file-name target)))))
+       (setq target (tramp-file-local-name (expand-file-name target))))
+      ;; There could be a cyclic link.
+      (tramp-flush-file-properties
+       v (expand-file-name target (tramp-file-local-name default-directory))))
 
     ;; If TARGET is still remote, quote it.
     (if (tramp-tramp-file-p target)
diff --git a/tramp-uu.el b/tramp-uu.el
index 2bbdb299a6..e7527f06e8 100644
--- a/tramp-uu.el
+++ b/tramp-uu.el
@@ -1,6 +1,6 @@
 ;;; tramp-uu.el --- uuencode in Lisp  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2023 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
diff --git a/tramp.el b/tramp.el
index ca8963fbf5..7f1d848fc1 100644
--- a/tramp.el
+++ b/tramp.el
@@ -1,6 +1,6 @@
 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2023 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;;         Michael Albinus <michael.albinus@gmx.de>
@@ -82,6 +82,7 @@
 (progn
   (defvar tramp--startup-hook nil
     "Forms to be executed at the end of tramp.el.")
+
   (put 'tramp--startup-hook 'tramp-suppress-trace t)
 
   (defmacro tramp--with-startup (&rest body)
@@ -643,7 +644,7 @@ This regexp must match both `tramp-initial-end-of-output' 
and
   (tramp-compat-rx
    bol (* nonl)
    (group (regexp (regexp-opt password-word-equivalents)))
-   (* nonl) ":" (? "\^@") (* blank))
+   (* nonl) (any "::៖") (? "\^@") (* blank))
   "Regexp matching password-like prompts.
 The regexp should match at end of buffer.
 
@@ -653,20 +654,19 @@ usually more convenient to add new passphrases to that 
variable
 instead of altering this variable.
 
 The `sudo' program appears to insert a `^@' character into the prompt."
-  :version "24.4"
+  :version "29.1"
   :type 'regexp)
 
 (defcustom tramp-wrong-passwd-regexp
   (rx bol (* nonl)
       (| "Permission denied"
-        "Login [Ii]ncorrect"
-        "Connection refused"
-        "Connection closed"
         "Timeout, server not responding."
         "Sorry, try again."
         "Name or service not known"
         "Host key verification failed."
         "No supported authentication methods left to try!"
+        (: "Login " (| "Incorrect" "incorrect"))
+        (: "Connection " (| "refused" "closed"))
         (: "Received signal " (+ digit)))
       (* nonl))
   "Regexp matching a `login failed' message.
@@ -789,6 +789,7 @@ It shall be used in combination with 
`generate-new-buffer-name'.")
 (defvar tramp-temp-buffer-file-name nil
   "File name of a persistent local temporary file.
 Useful for \"rsync\" like methods.")
+
 (make-variable-buffer-local 'tramp-temp-buffer-file-name)
 (put 'tramp-temp-buffer-file-name 'permanent-local t)
 
@@ -1427,6 +1428,7 @@ the (optional) timestamp of last activity on this 
connection.")
   "Password save function.
 Will be called once the password has been verified by successful
 authentication.")
+
 (put 'tramp-password-save-function 'tramp-suppress-trace t)
 
 (defvar tramp-password-prompt-not-unique nil
@@ -1654,7 +1656,7 @@ This is USER, if non-nil.  Otherwise, do a lookup in
 This is HOST, if non-nil.  Otherwise, do a lookup in
 `tramp-default-host-alist' and `tramp-default-host'."
   (let ((result
-        (or (and (> (length host) 0) host)
+        (or (and (tramp-compat-length> host 0) host)
             (let ((choices tramp-default-host-alist)
                   lhost item)
               (while choices
@@ -1666,7 +1668,7 @@ This is HOST, if non-nil.  Otherwise, do a lookup in
               lhost)
             tramp-default-host)))
     ;; We must mark, whether a default value has been used.
-    (if (or (> (length host) 0) (null result))
+    (if (or (tramp-compat-length> host 0) (null result))
        result
       (propertize result 'tramp-default t))))
 
@@ -1772,14 +1774,18 @@ See `tramp-dissect-file-name' for details."
 
 (put #'tramp-dissect-hop-name 'tramp-suppress-trace t)
 
+(defsubst tramp-string-empty-or-nil-p (string)
+  "Check whether STRING is empty or nil."
+  (or (null string) (string= string "")))
+
 (defun tramp-buffer-name (vec)
   "A name for the connection buffer VEC."
   (let ((method (tramp-file-name-method vec))
        (user-domain (tramp-file-name-user-domain vec))
        (host-port (tramp-file-name-host-port vec)))
-    (if (not (zerop (length user-domain)))
-       (format "*tramp/%s %s@%s*" method user-domain host-port)
-      (format "*tramp/%s %s*" method host-port))))
+    (if (tramp-string-empty-or-nil-p user-domain)
+       (format "*tramp/%s %s*" method host-port)
+      (format "*tramp/%s %s@%s*" method user-domain host-port))))
 
 (put #'tramp-buffer-name 'tramp-suppress-trace t)
 
@@ -1824,23 +1830,23 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME 
&optional HOP)."
              hop (nth 6 args))))
 
     ;; Unless `tramp-syntax' is `simplified', we need a method.
-    (when (and (not (zerop (length tramp-postfix-method-format)))
-              (zerop (length method)))
+    (when (and (not (string-empty-p tramp-postfix-method-format))
+              (tramp-string-empty-or-nil-p method))
       (signal 'wrong-type-argument (list #'stringp method)))
     (concat tramp-prefix-format hop
-           (unless (zerop (length tramp-postfix-method-format))
+           (unless (string-empty-p tramp-postfix-method-format)
              (concat method tramp-postfix-method-format))
            user
-           (unless (zerop (length domain))
+           (unless (tramp-string-empty-or-nil-p domain)
              (concat tramp-prefix-domain-format domain))
-           (unless (zerop (length user))
+           (unless (tramp-string-empty-or-nil-p user)
              tramp-postfix-user-format)
            (when host
              (if (string-match-p tramp-ipv6-regexp host)
                  (concat
                   tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
                host))
-           (unless (zerop (length port))
+           (unless (tramp-string-empty-or-nil-p port)
              (concat tramp-prefix-port-format port))
            tramp-postfix-host-format
            localname)))
@@ -1865,12 +1871,12 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME 
&optional HOP)."
 It must not be a complete Tramp file name, but as long as there are
 necessary only.  This function will be used in file name completion."
   (concat tramp-prefix-format
-         (unless (or (zerop (length method))
-                      (zerop (length tramp-postfix-method-format)))
+         (unless (or (tramp-string-empty-or-nil-p method)
+                      (string-empty-p tramp-postfix-method-format))
             (concat method tramp-postfix-method-format))
-          (unless (zerop (length user))
+          (unless (tramp-string-empty-or-nil-p user)
            (concat user tramp-postfix-user-format))
-         (unless (zerop (length host))
+         (unless (tramp-string-empty-or-nil-p host)
            (concat
             (if (string-match-p tramp-ipv6-regexp host)
                 (concat
@@ -1965,9 +1971,9 @@ of `current-buffer'."
   (let ((method (tramp-file-name-method vec))
        (user-domain (tramp-file-name-user-domain vec))
        (host-port (tramp-file-name-host-port vec)))
-    (if (not (zerop (length user-domain)))
-       (format "*debug tramp/%s %s@%s*" method user-domain host-port)
-      (format "*debug tramp/%s %s*" method host-port))))
+    (if (tramp-string-empty-or-nil-p user-domain)
+       (format "*debug tramp/%s %s*" method host-port)
+      (format "*debug tramp/%s %s@%s*" method user-domain host-port))))
 
 (put #'tramp-debug-buffer-name 'tramp-suppress-trace t)
 
@@ -2320,12 +2326,12 @@ the resulting error message."
          (progn ,@body)
        (error (tramp-message ,vec-or-proc 3 ,format ,err) nil))))
 
-;; This macro shall optimize the cases where an `file-exists-p' call
-;; is invoked first.  Often, the file exists, so the remote command is
+;; This macro shall optimize the cases where a `file-exists-p' call is
+;; invoked first.  Often, the file exists, so the remote command is
 ;; superfluous.
 (defmacro tramp-barf-if-file-missing (vec filename &rest body)
   "Execute BODY and return the result.
-In case if an error, raise a `file-missing' error if FILENAME
+In case of an error, raise a `file-missing' error if FILENAME
 does not exist, otherwise propagate the error."
   (declare (indent 2) (debug (symbolp form body)))
   (let ((err (make-symbol "err")))
@@ -2478,13 +2484,14 @@ Example:
        (setcdr v (delete (car v) (cdr v))))
       ;; Check for function and file or registry key.
       (unless (and (functionp (nth 0 (car v)))
+                  (stringp (nth 1 (car v)))
                   (cond
                    ;; Windows registry.
                    ((string-prefix-p "HKEY_CURRENT_USER" (nth 1 (car v)))
                     (and (memq system-type '(cygwin windows-nt))
                          (zerop
                           (tramp-call-process
-                           v "reg" nil nil nil "query" (nth 1 (car v))))))
+                           nil "reg" nil nil nil "query" (nth 1 (car v))))))
                    ;; DNS-SD service type.
                    ((string-match-p
                      tramp-dns-sd-service-regexp (nth 1 (car v))))
@@ -2972,10 +2979,10 @@ not in completion mode."
         (tramp-drop-volume-letter (expand-file-name filename directory)))
        ;; When `tramp-syntax' is `simplified', we need a default method.
        (tramp-default-method
-        (and (zerop (length tramp-postfix-method-format))
+        (and (string-empty-p tramp-postfix-method-format)
              tramp-default-method))
        (tramp-default-method-alist
-        (and (zerop (length tramp-postfix-method-format))
+        (and (string-empty-p tramp-postfix-method-format)
              tramp-default-method-alist))
        tramp-default-user tramp-default-user-alist
        tramp-default-host tramp-default-host-alist
@@ -3761,7 +3768,7 @@ Let-bind it when necessary.")
   ;; Otherwise, remove any trailing slash from localname component.
   ;; Method, host, etc, are unchanged.
   (while (with-parsed-tramp-file-name directory nil
-          (and (not (zerop (length localname)))
+          (and (tramp-compat-length> localname 0)
                (eq (aref localname (1- (length localname))) ?/)
                (not (string= localname "/"))))
     (setq directory (substring directory 0 -1)))
@@ -3792,7 +3799,8 @@ Let-bind it when necessary.")
   ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
   (setq dir (or dir default-directory "/"))
   ;; Handle empty NAME.
-  (when (zerop (length name)) (setq name "."))
+  (when (string-empty-p name)
+    (setq name "."))
   ;; Unless NAME is absolute, concat DIR and NAME.
   (unless (file-name-absolute-p name)
     (setq name (tramp-compat-file-name-concat dir name)))
@@ -3812,7 +3820,7 @@ Let-bind it when necessary.")
        (let ((uname (match-string 1 localname))
              (fname (match-string 2 localname))
              hname)
-         (when (zerop (length uname))
+         (when (tramp-string-empty-or-nil-p uname)
            (setq uname user))
          (when (setq hname (tramp-get-home-directory v uname))
            (setq localname (concat hname fname)))))
@@ -3841,9 +3849,10 @@ Let-bind it when necessary.")
 (defun tramp-handle-file-directory-p (filename)
   "Like `file-directory-p' for Tramp files."
   ;; `file-truename' could raise an error, for example due to a cyclic
-  ;; symlink.
-  (ignore-errors
-    (eq (file-attribute-type (file-attributes (file-truename filename))) t)))
+  ;; symlink.  We don't protect this despite it, because other errors
+  ;; might be worth to be visible, for example impossibility to mount
+  ;; in tramp-gvfs.el.
+  (eq (file-attribute-type (file-attributes (file-truename filename))) t))
 
 (defun tramp-handle-file-equal-p (filename1 filename2)
   "Like `file-equalp-p' for Tramp files."
@@ -3895,7 +3904,7 @@ Let-bind it when necessary.")
     ;; Run the command on the localname portion only unless we are in
     ;; completion mode.
     (tramp-make-tramp-file-name
-     v (or (and (zerop (length (tramp-file-name-localname v)))
+     v (or (and (tramp-string-empty-or-nil-p (tramp-file-name-localname v))
                (not (tramp-connectable-p file)))
           (tramp-run-real-handler
            #'file-name-as-directory
@@ -3958,7 +3967,8 @@ Let-bind it when necessary.")
     ;; "." and ".." are never interesting as completions, and are
     ;; actually in the way in a directory with only one file.  See
     ;; file_name_completion() in dired.c.
-    (when (and (consp fnac) (= (length (delete "./" (delete "../" fnac))) 1))
+    (when (and (consp fnac)
+              (tramp-compat-length= (delete "./" (delete "../" fnac)) 1))
       (setq fnac (delete "./" (delete "../" fnac))))
     (or
      (try-completion
@@ -4031,9 +4041,15 @@ Let-bind it when necessary.")
   "Like `file-regular-p' for Tramp files."
   (and (file-exists-p filename)
        ;; Sometimes, `file-attributes' does not return a proper value
-       ;; even if `file-exists-p' does.
-       (when-let ((attr (file-attributes filename)))
-        (eq ?- (aref (file-attribute-modes attr) 0)))))
+       ;; even if `file-exists-p' does.  Protect by `ignore-errors',
+       ;; because `file-truename' could raise an error for cyclic
+       ;; symlinks.
+       (ignore-errors
+        (when-let ((attr (file-attributes filename)))
+          (cond
+           ((eq ?- (aref (file-attribute-modes attr) 0)))
+           ((eq ?l (aref (file-attribute-modes attr) 0))
+            (file-regular-p (file-truename filename))))))))
 
 (defun tramp-handle-file-remote-p (filename &optional identification connected)
   "Like `file-remote-p' for Tramp files."
@@ -4694,7 +4710,8 @@ Do not set it manually, it is used buffer-local in 
`tramp-get-lock-pid'.")
              (or
               ;; The host name is used for the remote shell command.
               (member
-               '("%h") (tramp-get-method-parameter item 'tramp-login-args))
+               "%h" (tramp-compat-flatten-tree
+                     (tramp-get-method-parameter item 'tramp-login-args)))
               ;; The host name must match previous hop.
               (string-match-p previous-host host))
            (setq tramp-default-proxies-alist saved-tdpa)
@@ -4732,7 +4749,7 @@ substitution.  SPEC-LIST is a list of char/value pairs 
used for
          (tramp-get-connection-property v "direct-async-process")
         ;; There's no multi-hop.
         (or (not (tramp-multi-hop-p v))
-            (= (length (tramp-compute-multi-hops v)) 1))
+            (null (cdr (tramp-compute-multi-hops v))))
         ;; There's no remote stdout or stderr file.
         (or (not (stringp buffer)) (not (tramp-tramp-file-p buffer)))
         (or (not (stringp stderr)) (not (tramp-tramp-file-p stderr))))))
@@ -4866,7 +4883,7 @@ substitution.  SPEC-LIST is a list of char/value pairs 
used for
                :command (append `(,login-program) login-args command)
                :coding coding :noquery noquery :connection-type connection-type
                :sentinel sentinel :stderr stderr))
-           ;; Set filter.  Prior Emacs 29.1, it doesn't work reliable
+           ;; Set filter.  Prior Emacs 29.1, it doesn't work reliably
            ;; to provide it as `make-process' argument when filter is
            ;; t.  See Bug#51177.
            (when filter
@@ -5088,17 +5105,19 @@ support symbolic links."
                  (add-function
                   :after (process-sentinel p)
                   (lambda (_proc _string)
-                    (with-current-buffer error-buffer
-                      (insert-file-contents-literally
-                       error-file nil nil nil 'replace))
-                    (delete-file error-file))))
+                    (ignore-errors
+                      (with-current-buffer error-buffer
+                        (insert-file-contents-literally
+                         error-file nil nil nil 'replace))
+                      (delete-file error-file)))))
                (display-buffer output-buffer '(nil (allow-no-window . t)))))
 
            ;; Insert error messages if they were separated.
            (when (and error-file (not (process-live-p p)))
-             (with-current-buffer error-buffer
-               (insert-file-contents-literally error-file))
-             (delete-file error-file))))
+             (ignore-errors
+               (with-current-buffer error-buffer
+                 (insert-file-contents-literally error-file))
+               (delete-file error-file)))))
 
       ;; Synchronous case.
       (prog1
@@ -5106,9 +5125,10 @@ support symbolic links."
          (process-file-shell-command command nil buffer)
        ;; Insert error messages if they were separated.
        (when error-file
-         (with-current-buffer error-buffer
-           (insert-file-contents-literally error-file))
-         (delete-file error-file))
+         (ignore-errors
+           (with-current-buffer error-buffer
+             (insert-file-contents-literally error-file))
+           (delete-file error-file)))
        (if current-buffer-p
            ;; This is like exchange-point-and-mark, but doesn't
            ;; activate the mark.  It is cleaner to avoid activation,
@@ -5418,7 +5438,7 @@ Wait, until the connection buffer changes."
        ;; Hide message in buffer.
        (narrow-to-region (point-max) (point-max))
        ;; Wait for new output.
-       (while (not (tramp-compat-ignore-error 'file-error
+       (while (not (tramp-compat-ignore-error file-error
                      (tramp-wait-for-regexp
                       proc 0.1 tramp-security-key-confirmed-regexp)))
          (when (tramp-check-for-regexp proc tramp-security-key-timeout-regexp)
@@ -6344,6 +6364,7 @@ It always returns a return code.  The Lisp error raised 
when
 PROGRAM is nil is trapped also, returning 1.  Furthermore, traces
 are written with verbosity of 6."
   (let ((default-directory tramp-compat-temporary-file-directory)
+       (temporary-file-directory tramp-compat-temporary-file-directory)
        (process-environment (default-toplevel-value 'process-environment))
        (destination (if (eq destination t) (current-buffer) destination))
        (vec (or vec (car tramp-current-connection)))
@@ -6364,7 +6385,7 @@ are written with verbosity of 6."
       (error
        (setq error (error-message-string err)
             result 1)))
-    (if (zerop (length error))
+    (if (tramp-string-empty-or-nil-p error)
        (tramp-message vec 6 "%s\n%s" result output)
       (tramp-message vec 6 "%s\n%s\n%s" result output error))
     result))
@@ -6376,6 +6397,7 @@ It always returns a return code.  The Lisp error raised 
when
 PROGRAM is nil is trapped also, returning 1.  Furthermore, traces
 are written with verbosity of 6."
   (let ((default-directory tramp-compat-temporary-file-directory)
+       (temporary-file-directory tramp-compat-temporary-file-directory)
        (process-environment (default-toplevel-value 'process-environment))
        (buffer (if (eq buffer t) (current-buffer) buffer))
        result)
@@ -6500,7 +6522,7 @@ Consults the auth-source package."
 
       ;; Workaround.  Prior Emacs 28.1, auth-source has saved empty
       ;; passwords.  See discussion in Bug#50399.
-      (when (zerop (length auth-passwd))
+      (when (tramp-string-empty-or-nil-p auth-passwd)
        (setq tramp-password-save-function nil))
       (tramp-set-connection-property vec "first-password-request" nil)
 
diff --git a/trampver.el b/trampver.el
index 3682505946..87360baad3 100644
--- a/trampver.el
+++ b/trampver.el
@@ -1,13 +1,13 @@
 ;;; trampver.el --- Transparent Remote Access, Multiple Protocol  -*- 
lexical-binding:t -*-
 ;;; lisp/trampver.el.  Generated from trampver.el.in by configure.
 
-;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2023 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.6.0
+;; Version: 2.6.0.1
 ;; Package-Requires: ((emacs "26.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.6.0"
+(defconst tramp-version "2.6.0.1"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -78,7 +78,7 @@
 ;; Check for Emacs version.
 (let ((x   (if (not (string-version-lessp emacs-version "26.1"))
       "ok"
-    (format "Tramp 2.6.0 is not fit for %s"
+    (format "Tramp 2.6.0.1 is not fit for %s"
             (replace-regexp-in-string "\n" "" (emacs-version))))))
   (unless (string-equal "ok" x) (error "%s" x)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]