Kristofer <kristofer.hjelmt...@mailbox.org> writes:

> Hello!

Hi Kristofer,

> But I noticed recently a regression in tramp-sh-handle-file-local-copy
> on the recent master of TRAMP.
> The "let* statement in the beginning of the function was replaced with
> and "if-let". The problem for me is that tramp-inline-coding returns
> nil for me, but instead I just set tramp-copy-size-limit to nil and
> use pscp or psftp for copying.
>
> Do we really need to even check for remote encoding and local encoding
> if tramp-copy-size-limit is set to nil and we are going to do and "out
> of bounds" copy anyways?

Does the appended patch fixes it for you?

> Best Regards
> Kristofer

Best regards, Michael.

diff --git a/lisp/tramp-sh.el b/lisp/tramp-sh.el
index 4a9cf2e6..3e34b696 100644
--- a/lisp/tramp-sh.el
+++ b/lisp/tramp-sh.el
@@ -3269,13 +3269,12 @@ implementation will be used."
 (defun tramp-sh-handle-file-local-copy (filename)
   "Like `file-local-copy' for Tramp files."
   (tramp-skeleton-file-local-copy filename
-    (if-let ((size (file-attribute-size (file-attributes filename)))
-	     (rem-enc (tramp-get-inline-coding v "remote-encoding" size))
-	     (loc-dec (tramp-get-inline-coding v "local-decoding" size)))
+    (if-let ((size (file-attribute-size (file-attributes filename))))
+	(let (rem-enc loc-dec)

       (condition-case err
 	  (cond
-	   ;; Empty file.
+	   ;; Empty file.  Nothing to copy.
 	   ((zerop size))

 	   ;; `copy-file' handles direct copy and out-of-band methods.
@@ -3284,7 +3283,8 @@ implementation will be used."
 	    (copy-file filename tmpfile 'ok-if-already-exists 'keep-time))

 	   ;; Use inline encoding for file transfer.
-	   (rem-enc
+	   ((and (setq rem-enc (tramp-get-inline-coding v "remote-encoding" size))
+		 (setq loc-dec (tramp-get-inline-coding v "local-decoding" size)))
 	    (with-tramp-progress-reporter
 		v 3
 		(format-message
@@ -3343,7 +3343,7 @@ implementation will be used."
 	;; Error handling.
 	((error quit)
 	 (delete-file tmpfile)
-	 (signal (car err) (cdr err))))
+	 (signal (car err) (cdr err)))))

       ;; Impossible to copy.  Trigger `file-missing' error.
       (setq tmpfile nil))))

Reply via email to