From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#53284: 28.0.91; TRAMP SSHFS: process-file with remote input file doesn't work Date: Sat, 15 Jan 2022 20:42:09 +0100 Message-ID: <871r18lram.fsf@gmx.de> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12255"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 53284@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 15 20:43:55 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8oxu-000345-EK for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Jan 2022 20:43:54 +0100 Original-Received: from localhost ([::1]:58678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n8oxt-0003Ba-BW for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Jan 2022 14:43:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n8oxA-00039z-IJ for bug-gnu-emacs@gnu.org; Sat, 15 Jan 2022 14:43:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49005) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n8ox4-00036i-Ic for bug-gnu-emacs@gnu.org; Sat, 15 Jan 2022 14:43:08 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n8ox4-000899-5L for bug-gnu-emacs@gnu.org; Sat, 15 Jan 2022 14:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Jan 2022 19:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53284 X-GNU-PR-Package: emacs Original-Received: via spool by 53284-submit@debbugs.gnu.org id=B53284.164227573831262 (code B ref 53284); Sat, 15 Jan 2022 19:43:02 +0000 Original-Received: (at 53284) by debbugs.gnu.org; 15 Jan 2022 19:42:18 +0000 Original-Received: from localhost ([127.0.0.1]:41908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8owM-00088A-FE for submit@debbugs.gnu.org; Sat, 15 Jan 2022 14:42:18 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:44801) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8owK-00087s-LK for 53284@debbugs.gnu.org; Sat, 15 Jan 2022 14:42:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1642275730; bh=1vpUZX8B92uDIfWbC71kEPaqy4VN8RETyuNPJ0PFVt4=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=EI/QAL+OPvQHXmWQZfxnSxQLpxCcBGSfCiasAyAN1OW7l+91teTchx88LxiHej9cg jdkOVh9LsXPDCRi3KkBElVbuK393IYeSt5Ph7dhKSE6rOhRaOvtJMYz7CgWQSEP1nS CflzsRpAE3Q68TXzTey6IdoKaUC18DaSU4MYNBdA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([217.70.140.164]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MNKm0-1mxMcq0fmM-00OsRz; Sat, 15 Jan 2022 20:42:10 +0100 In-Reply-To: (Philipp Stephani's message of "Sat, 15 Jan 2022 13:51:31 +0100") X-Provags-ID: V03:K1:K3IVrDggZ2CA3wE3cZj6SqQLZQAfJKULZ6guh+ZzOBP046jDwcM io+OsmkKEfXaAcl+2ay+rVd8V4s3m1u0aI5NkQRUS7eNepZHWvea8csrnqg2WHJ7j3cow9u pexQYTTsqdf109FIzeVkFBdx064HDDXiNBbquoMh9YFkFB58BHuRr2QkK1V9jNW045JUl5J h20p8kVh5tZWYb/i12AiA== X-UI-Out-Filterresults: notjunk:1;V03:K0:6oRaiH02G7Y=:NFIQzwG5mrmh7AYeFeZDLS EXy0Xt6EhpyJqIOJ0hPNlOmbnc3KgkrUzPey/pl6Ns8JCyKZV+soYYAscg77vRXnD5gt08CVZ j5LQss4o6W2RtbUaUjuvfl/kYirlh00c0flQcghKN5ZdSgQzWgSaNRBZw2DVcW9WbCCzpMwtN YJp4Sq3pTT2IzrnKN9+ZKKDYrV0LcwpWdKss4fXeRQF1i1QN9RnU0YsJVMwfGNK8zlYtVchkR HqumBLqms0g/3ZXEFywvWugoWXkjVFwwYf74KV3wrULqJXwPHP8h/BXvAKGPVTLGwiJa1Q8OR p9v8wJXW5X3Vdr5fD2pCQJE/F+BVSPARQ7jvf3DqX+GBqfEF+UtATkxHZVDEc9qEw09J+b2+Q wEX/sLoC85gOs9DO349N9Q/QgXQ1H/KCgLfV3cOJ6liyglZdP1fKDBMVds44OlA58H+aWF+V7 v3BukD/QboMvGgg9TGD0z23944Ffx70YyGTpQ9XwOTX33ADa+ggEuNs4OQo6CEzA9QSVPFzrB 8jUfdbSGMSpskwwAzwL1cbzzNMF15V2MpyF4qTq/Wo2lU1Ike9dONt+P5yzxeLbeh74GQPrS5 aiJ1PsffjsOTi51FPLOuIQR2Xz8pSNgaYExGczLdiYIxC6FKTsQqK4sdSkYZ08Q/CL+NIyMZg FV+xysnflU4+CSbjFKCJXyPo/SWTtLamwKCY90rB4ZKJKCLXdO3ybkAmkvtyT3vtKiAIa+Ply Medo7KV3i6qx1W9TP+ljP7jvdSjYLED23XmAPt5Z4Ps2KI+3wuaMLArA7pzdlOzcCIaJkHAZ X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:224337 Archived-At: --=-=-= Content-Type: text/plain Philipp Stephani writes: Hi Philipp, > $ mkdir -p /tmp/tramptest && emacs -Q -batch -l tramp-sshfs -l tramp -eval '(let ((default-directory "/sshfs:localhost:/tmp/tramptest/")) > (write-region "hello" nil "input") > (with-temp-buffer > (print (list (process-file "cat" "input" t) > (buffer-string)))))' > > (1 "") > > I think the problem is that tramp-sshfs-handle-process-file doesn't pass > the correct input file to tramp-call-process; it should first expand the > input file against the remote default directory and then copy it locally > to pass it to the SSH process. Could you pls try the appended patch? Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable *** /tmp/ediffDAueJg 2022-01-15 20:40:02.604224925 +0100 =2D-- /home/albinus/src/tramp/lisp/tramp-sshfs.el 2022-01-15 20:36:50.7659= 07615 +0100 *************** *** 243,254 **** (format "cd %s && exec %s" localname ! (mapconcat #'tramp-shell-quote-argument (cons program args) " ")))) (unwind-protect (apply #'tramp-call-process v (tramp-get-method-parameter v 'tramp-login-program) ! infile destination display (tramp-expand-args v 'tramp-login-args ?h (or (tramp-file-name-host v) "") =2D-- 243,269 ---- (format "cd %s && exec %s" localname ! (mapconcat #'tramp-shell-quote-argument (cons program args) " "))) ! input tmpinput) ! ! ;; Determine input. ! (if (null infile) ! (setq input (tramp-get-remote-null-device v)) ! (setq infile (expand-file-name infile)) ! (if (tramp-equal-remote default-directory infile) ! ;; INFILE is on the same remote host. ! (setq input (tramp-file-local-name infile)) ! ;; INFILE must be copied to remote host. ! (setq input (tramp-make-tramp-temp-file v) ! tmpinput (tramp-make-tramp-file-name v input 'nohop)) ! (copy-file infile tmpinput t))) ! (when input (setq command (format "%s <%s" command input))) ! (unwind-protect (apply #'tramp-call-process v (tramp-get-method-parameter v 'tramp-login-program) ! nil destination display (tramp-expand-args v 'tramp-login-args ?h (or (tramp-file-name-host v) "") *************** *** 256,261 **** =2D-- 271,281 ---- ?p (or (tramp-file-name-port v) "") ?l command)) + ;; Cleanup. We remove all file cache values for the + ;; connection, because the remote process could have changed + ;; them. + (when tmpinput (delete-file tmpinput)) + (unless process-file-side-effects (tramp-flush-directory-properties v "")))))) --=-=-=--