summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2022-08-07 16:35:50 +0200
committerMichael Albinus <michael.albinus@gmx.de>2022-08-07 16:35:50 +0200
commit82d22ef8db1838c84dbc512b3f1628a549559504 (patch)
tree5d2294174bccd6b431e677dc06ce4be5005cfff5 /lisp/net
parent11e6c12def5e617fb07d604e82c9bf5289c6e827 (diff)
downloademacs-82d22ef8db1838c84dbc512b3f1628a549559504.tar.gz
emacs-82d22ef8db1838c84dbc512b3f1628a549559504.tar.bz2
emacs-82d22ef8db1838c84dbc512b3f1628a549559504.zip
Improve Tramp error message
* lisp/net/tramp-sh.el (tramp-sh-handle-file-local-copy): Simplify for empty files. Better error message. (Bug#56879)
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp-sh.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 38fffadd4ec..a2b675cf885 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -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)