]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve Tramp error message
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 7 Aug 2022 14:35:50 +0000 (16:35 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 7 Aug 2022 14:35:50 +0000 (16:35 +0200)
* lisp/net/tramp-sh.el (tramp-sh-handle-file-local-copy):
Simplify for empty files.  Better error message.  (Bug#56879)

lisp/net/tramp-sh.el

index 38fffadd4ecfb1d6c973a17ff6731271be089544..a2b675cf88530da64c316a85b33f8c726130c55a 100644 (file)
@@ -3270,6 +3270,9 @@ implementation will be used."
 
       (condition-case err
          (cond
+          ;; Empty file.
+          ((zerop size))
+
           ;; `copy-file' handles direct copy and out-of-band methods.
           ((or (tramp-local-host-p v)
                (tramp-method-out-of-band-p v size))
@@ -3285,6 +3288,11 @@ implementation will be used."
               v (format rem-enc (tramp-shell-quote-argument localname))
               "Encoding remote file failed"))
 
+           ;; Check error.  `rem-enc' could be a pipe, which doesn't
+           ;; flag the error in the first command.
+           (when (zerop (buffer-size (tramp-get-buffer v)))
+             (tramp-error v 'file-error' "Encoding remote file failed"))
+
            (with-tramp-progress-reporter
                v 3 (format-message
                     "Decoding local file `%s' with `%s'" tmpfile loc-dec)