unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 53284@debbugs.gnu.org
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	[thread overview]
Message-ID: <871r18lram.fsf@gmx.de> (raw)
In-Reply-To: <wvr4sftpmab0.fsf@gmail.com> (Philipp Stephani's message of "Sat,  15 Jan 2022 13:51:31 +0100")

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

Philipp Stephani <p.stephani2@gmail.com> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1975 bytes --]

*** /tmp/ediffDAueJg	2022-01-15 20:40:02.604224925 +0100
--- /home/albinus/src/tramp/lisp/tramp-sshfs.el	2022-01-15 20:36:50.765907615 +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) "")
--- 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 ****
--- 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 ""))))))


  reply	other threads:[~2022-01-15 19:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-15 12:51 bug#53284: 28.0.91; TRAMP SSHFS: process-file with remote input file doesn't work Philipp Stephani
2022-01-15 19:42 ` Michael Albinus [this message]
2022-01-15 20:30   ` Philipp Stephani
2022-01-17  9:53     ` Michael Albinus
2022-01-17 10:07       ` Philipp Stephani
2022-01-17 10:38         ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871r18lram.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=53284@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).