@@ -1051,9 +1051,7 @@ component is used as the target of the symlink."
10511051 (let ((non-essential t))
10521052 (when (and (tramp-tramp-file-p target)
10531053 (tramp-file-name-equal-p v (tramp-dissect-file-name target)))
1054- (setq target
1055- (tramp-file-name-localname
1056- (tramp-dissect-file-name (expand-file-name target))))))
1054+ (setq target (tramp-file-local-name (expand-file-name target)))))
10571055
10581056 ;; If TARGET is still remote, quote it.
10591057 (if (tramp-tramp-file-p target)
@@ -2171,8 +2169,8 @@ the uid and gid from FILENAME."
21712169 v 'file-error
21722170 "Unknown operation `%s', must be `copy' or `rename'"
21732171 op))))
2174- (localname1 (tramp-compat- file-local-name filename))
2175- (localname2 (tramp-compat- file-local-name newname))
2172+ (localname1 (tramp-file-local-name filename))
2173+ (localname2 (tramp-file-local-name newname))
21762174 (prefix (file-remote-p (if t1 filename newname)))
21772175 cmd-result)
21782176 (when (and (eq op 'copy) (file-directory-p filename))
@@ -2797,7 +2795,8 @@ the result will be a local, non-Tramp, file name."
27972795;; this, its original contents must be saved, and restored once
27982796;; connection has been setup.
27992797(defun tramp-sh-handle-make-process (&rest args)
2800- "Like `make-process' for Tramp files."
2798+ "Like `make-process' for Tramp files.
2799+ STDERR can also be a file name."
28012800 (when args
28022801 (with-parsed-tramp-file-name (expand-file-name default-directory) nil
28032802 (let ((name (plist-get args :name))
@@ -2829,14 +2828,21 @@ the result will be a local, non-Tramp, file name."
28292828 (signal 'wrong-type-argument (list #'functionp sentinel)))
28302829 (unless (or (null stderr) (bufferp stderr) (stringp stderr))
28312830 (signal 'wrong-type-argument (list #'stringp stderr)))
2831+ (when (and (stringp stderr) (tramp-tramp-file-p stderr)
2832+ (not (tramp-equal-remote default-directory stderr)))
2833+ (signal 'file-error (list "Wrong stderr" stderr)))
28322834
28332835 (let* ((buffer
28342836 (if buffer
28352837 (get-buffer-create buffer)
28362838 ;; BUFFER can be nil. We use a temporary buffer.
28372839 (generate-new-buffer tramp-temp-buffer-name)))
2838- (stderr (and stderr (get-buffer-create stderr)))
2839- (tmpstderr (and stderr (tramp-make-tramp-temp-file v)))
2840+ ;; STDERR can also be a file name.
2841+ (tmpstderr
2842+ (and stderr
2843+ (if (and (stringp stderr) (tramp-tramp-file-p stderr))
2844+ (tramp-unquote-file-local-name stderr)
2845+ (tramp-make-tramp-temp-file v))))
28402846 (program (car command))
28412847 (args (cdr command))
28422848 ;; When PROGRAM matches "*sh", and the first arg is
@@ -2965,21 +2971,34 @@ the result will be a local, non-Tramp, file name."
29652971 (ignore-errors
29662972 (set-process-query-on-exit-flag p (null noquery))
29672973 (set-marker (process-mark p) (point)))
2974+ ;; Copy tmpstderr file.
2975+ (when (and (stringp stderr)
2976+ (not (tramp-tramp-file-p stderr)))
2977+ (add-function
2978+ :after (process-sentinel p)
2979+ (lambda (_proc _msg)
2980+ (rename-file
2981+ (tramp-make-tramp-file-name v tmpstderr) stderr))))
29682982 ;; Provide error buffer. This shows only
29692983 ;; initial error messages; messages arriving
29702984 ;; later on shall be inserted by `auto-revert'.
2971- ;; The temporary file will still be existing.
2972- ;; TODO: Write a sentinel, which deletes the
2973- ;; temporary file.
2974- (when tmpstderr
2985+ ;; The temporary file will exist until the
2986+ ;; process is deleted.
2987+ (when (bufferp stderr)
29752988 ;; We must flush them here already; otherwise
29762989 ;; `insert-file-contents' will fail.
29772990 (tramp-flush-connection-property v "process-name")
29782991 (tramp-flush-connection-property v "process-buffer")
29792992 (with-current-buffer stderr
29802993 (insert-file-contents
29812994 (tramp-make-tramp-file-name v tmpstderr) 'visit)
2982- (auto-revert-mode)))
2995+ (auto-revert-mode))
2996+ ;; Delete tmpstderr file.
2997+ (add-function
2998+ :after (process-sentinel p)
2999+ (lambda (_proc _msg)
3000+ (delete-file
3001+ (tramp-make-tramp-file-name v tmpstderr)))))
29833002 ;; Return process.
29843003 p)))
29853004
@@ -3028,7 +3047,7 @@ the result will be a local, non-Tramp, file name."
30283047 (setq infile (expand-file-name infile))
30293048 (if (tramp-equal-remote default-directory infile)
30303049 ;; INFILE is on the same remote host.
3031- (setq input (with-parsed- tramp-file-name infile nil localname ))
3050+ (setq input (tramp-file-local- name infile))
30323051 ;; INFILE must be copied to remote host.
30333052 (setq input (tramp-make-tramp-temp-file v)
30343053 tmpinput (tramp-make-tramp-file-name v input 'nohop))
@@ -3059,8 +3078,7 @@ the result will be a local, non-Tramp, file name."
30593078 (setcar (cdr destination) (expand-file-name (cadr destination)))
30603079 (if (tramp-equal-remote default-directory (cadr destination))
30613080 ;; stderr is on the same remote host.
3062- (setq stderr (with-parsed-tramp-file-name
3063- (cadr destination) nil localname))
3081+ (setq stderr (tramp-file-local-name (cadr destination)))
30643082 ;; stderr must be copied to remote host. The temporary
30653083 ;; file must be deleted after execution.
30663084 (setq stderr (tramp-make-tramp-temp-file v)
@@ -3122,7 +3140,7 @@ the result will be a local, non-Tramp, file name."
31223140 (append
31233141 (tramp-get-remote-path (tramp-dissect-file-name default-directory))
31243142 ;; The equivalent to `exec-directory'.
3125- `(,(tramp-compat- file-local-name default-directory))))
3143+ `(,(tramp-file-local-name (expand-file-name default-directory) ))))
31263144
31273145(defun tramp-sh-handle-file-local-copy (filename)
31283146 "Like `file-local-copy' for Tramp files."
@@ -3995,8 +4013,7 @@ variable PATH."
39954013 (setq tmpfile
39964014 (tramp-make-tramp-file-name vec (tramp-make-tramp-temp-file vec)))
39974015 (write-region command nil tmpfile)
3998- (tramp-send-command
3999- vec (format ". %s" (tramp-compat-file-local-name tmpfile)))
4016+ (tramp-send-command vec (format ". %s" (tramp-file-local-name tmpfile)))
40004017 (delete-file tmpfile))))
40014018
40024019;; ------------------------------------------------------------
@@ -4513,7 +4530,7 @@ Goes through the list `tramp-local-coding-commands' and
45134530 (format-spec
45144531 value
45154532 (format-spec-make
4516- ?t (tramp-compat- file-local-name tmpfile)))))
4533+ ?t (tramp-file-local-name tmpfile)))))
45174534 (tramp-maybe-send-script vec value name)
45184535 (setq rem-dec name)))
45194536 (tramp-message
@@ -4796,7 +4813,7 @@ If there is just some editing, retry it after 5 seconds."
47964813 vec 5 "Cannot timeout session, trying it again in %s seconds." 5)
47974814 (run-at-time 5 nil 'tramp-timeout-session vec))
47984815 (tramp-message
4799- vec 3 "Timeout session %s" (tramp-make-tramp-file-name vec 'localname ))
4816+ vec 3 "Timeout session %s" (tramp-make-tramp-file-name vec 'noloc ))
48004817 (tramp-cleanup-connection vec 'keep-debug)))
48014818
48024819(defun tramp-maybe-open-connection (vec)
@@ -5594,7 +5611,7 @@ This command is returned only if `delete-by-moving-to-trash' is non-nil."
55945611 "%s -t %s %s"
55955612 result
55965613 (format-time-string "%Y%m%d%H%M.%S")
5597- (tramp-compat- file-local-name tmpfile))))
5614+ (tramp-file-local-name tmpfile))))
55985615 (delete-file tmpfile))
55995616 result)))
56005617
0 commit comments