emacs-diffs
[Top][All Lists]
Advanced

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

master e3edbf577b: Fix last Tramp change, especially for bug#56963


From: Michael Albinus
Subject: master e3edbf577b: Fix last Tramp change, especially for bug#56963
Date: Thu, 4 Aug 2022 12:12:37 -0400 (EDT)

branch: master
commit e3edbf577b49bbff0527cd6f3242a98916947875
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Fix last Tramp change, especially for bug#56963
    
    * lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
    Add missing space.
    
    * lisp/net/tramp-sh.el (tramp-sh-handle-write-region): Use "cat",
    "echo -n" isn't portable.  (Bug#56963)
    
    * lisp/net/tramp.el (tramp-file-name-unify): Unquote file name in time.
---
 lisp/net/tramp-adb.el |  2 +-
 lisp/net/tramp-sh.el  |  4 +++-
 lisp/net/tramp.el     | 12 ++++++------
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 1d35f2b2ff..ef0cc2d66c 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -521,7 +521,7 @@ Emacs dired can't find files."
     ;; file is created.  Do it directly.
     (if (and (stringp start) (string-empty-p start))
        (tramp-adb-send-command-and-check
-        v (format "echo -n \"\">%s" (tramp-shell-quote-argument localname)))
+        v (format "echo -n \"\" >%s" (tramp-shell-quote-argument localname)))
 
       (let ((tmpfile (tramp-compat-make-temp-file filename)))
        (when (and append (file-exists-p filename))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index d88e388cd5..9e5347252a 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3340,7 +3340,9 @@ implementation will be used."
     ;; file is created.  Do it directly.
     (if (and (stringp start) (string-empty-p start))
        (tramp-send-command
-        v (format "echo -n \"\">%s" (tramp-shell-quote-argument localname)))
+        v (format "cat <%s >%s"
+                  (tramp-get-remote-null-device v)
+                  (tramp-shell-quote-argument localname)))
 
       ;; Short track: if we are on the local host, we can run directly.
       (if (and (tramp-local-host-p v)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 0446e5754a..a35b9baaa8 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1487,21 +1487,21 @@ If nil, return `tramp-default-port'."
 (put #'tramp-file-name-port-or-default 'tramp-suppress-trace t)
 
 ;;;###tramp-autoload
-(defun tramp-file-name-unify (vec &optional file)
+(defun tramp-file-name-unify (vec &optional localname)
   "Unify VEC by removing localname and hop from `tramp-file-name' structure.
-If FILE is a string, set it as localname.
+If LOCALNAME is a string, set it as localname.
 Objects returned by this function compare `equal' if they refer to the
 same connection.  Make a copy in order to avoid side effects."
   (when (tramp-file-name-p vec)
     (setq vec (copy-tramp-file-name vec))
     (setf (tramp-file-name-localname vec)
-         (and (stringp file)
+         (and (stringp localname)
               ;; FIXME: This is a sanity check.  When this error
               ;; doesn't happen for a while, it can be removed.
-              (or (file-name-absolute-p file)
+              (or (file-name-absolute-p localname)
                   (tramp-error
-                   vec 'file-error "File `%s' must be absolute" file))
-              (directory-file-name (tramp-compat-file-name-unquote file)))
+                   vec 'file-error "File `%s' must be absolute" localname))
+              (tramp-compat-file-name-unquote (directory-file-name localname)))
          (tramp-file-name-hop vec) nil))
   vec)
 



reply via email to

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