@@ -1051,9 +1051,7 @@ component is used as the target of the symlink."
1051
1051
(let ((non-essential t))
1052
1052
(when (and (tramp-tramp-file-p target)
1053
1053
(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)))))
1057
1055
1058
1056
;; If TARGET is still remote, quote it.
1059
1057
(if (tramp-tramp-file-p target)
@@ -2171,8 +2169,8 @@ the uid and gid from FILENAME."
2171
2169
v 'file-error
2172
2170
"Unknown operation `%s', must be `copy' or `rename'"
2173
2171
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))
2176
2174
(prefix (file-remote-p (if t1 filename newname)))
2177
2175
cmd-result)
2178
2176
(when (and (eq op 'copy) (file-directory-p filename))
@@ -2797,7 +2795,8 @@ the result will be a local, non-Tramp, file name."
2797
2795
;; this, its original contents must be saved, and restored once
2798
2796
;; connection has been setup.
2799
2797
(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."
2801
2800
(when args
2802
2801
(with-parsed-tramp-file-name (expand-file-name default-directory) nil
2803
2802
(let ((name (plist-get args :name))
@@ -2829,14 +2828,21 @@ the result will be a local, non-Tramp, file name."
2829
2828
(signal 'wrong-type-argument (list #'functionp sentinel)))
2830
2829
(unless (or (null stderr) (bufferp stderr) (stringp stderr))
2831
2830
(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)))
2832
2834
2833
2835
(let* ((buffer
2834
2836
(if buffer
2835
2837
(get-buffer-create buffer)
2836
2838
;; BUFFER can be nil. We use a temporary buffer.
2837
2839
(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))))
2840
2846
(program (car command))
2841
2847
(args (cdr command))
2842
2848
;; When PROGRAM matches "*sh", and the first arg is
@@ -2965,21 +2971,34 @@ the result will be a local, non-Tramp, file name."
2965
2971
(ignore-errors
2966
2972
(set-process-query-on-exit-flag p (null noquery))
2967
2973
(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))))
2968
2982
;; Provide error buffer. This shows only
2969
2983
;; initial error messages; messages arriving
2970
2984
;; 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)
2975
2988
;; We must flush them here already; otherwise
2976
2989
;; `insert-file-contents' will fail.
2977
2990
(tramp-flush-connection-property v "process-name")
2978
2991
(tramp-flush-connection-property v "process-buffer")
2979
2992
(with-current-buffer stderr
2980
2993
(insert-file-contents
2981
2994
(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)))))
2983
3002
;; Return process.
2984
3003
p)))
2985
3004
@@ -3028,7 +3047,7 @@ the result will be a local, non-Tramp, file name."
3028
3047
(setq infile (expand-file-name infile))
3029
3048
(if (tramp-equal-remote default-directory infile)
3030
3049
;; 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))
3032
3051
;; INFILE must be copied to remote host.
3033
3052
(setq input (tramp-make-tramp-temp-file v)
3034
3053
tmpinput (tramp-make-tramp-file-name v input 'nohop))
@@ -3059,8 +3078,7 @@ the result will be a local, non-Tramp, file name."
3059
3078
(setcar (cdr destination) (expand-file-name (cadr destination)))
3060
3079
(if (tramp-equal-remote default-directory (cadr destination))
3061
3080
;; 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)))
3064
3082
;; stderr must be copied to remote host. The temporary
3065
3083
;; file must be deleted after execution.
3066
3084
(setq stderr (tramp-make-tramp-temp-file v)
@@ -3122,7 +3140,7 @@ the result will be a local, non-Tramp, file name."
3122
3140
(append
3123
3141
(tramp-get-remote-path (tramp-dissect-file-name default-directory))
3124
3142
;; The equivalent to `exec-directory'.
3125
- `(,(tramp-compat- file-local-name default-directory))))
3143
+ `(,(tramp-file-local-name (expand-file-name default-directory) ))))
3126
3144
3127
3145
(defun tramp-sh-handle-file-local-copy (filename)
3128
3146
"Like `file-local-copy' for Tramp files."
@@ -3995,8 +4013,7 @@ variable PATH."
3995
4013
(setq tmpfile
3996
4014
(tramp-make-tramp-file-name vec (tramp-make-tramp-temp-file vec)))
3997
4015
(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)))
4000
4017
(delete-file tmpfile))))
4001
4018
4002
4019
;; ------------------------------------------------------------
@@ -4513,7 +4530,7 @@ Goes through the list `tramp-local-coding-commands' and
4513
4530
(format-spec
4514
4531
value
4515
4532
(format-spec-make
4516
- ?t (tramp-compat- file-local-name tmpfile)))))
4533
+ ?t (tramp-file-local-name tmpfile)))))
4517
4534
(tramp-maybe-send-script vec value name)
4518
4535
(setq rem-dec name)))
4519
4536
(tramp-message
@@ -4796,7 +4813,7 @@ If there is just some editing, retry it after 5 seconds."
4796
4813
vec 5 "Cannot timeout session, trying it again in %s seconds." 5)
4797
4814
(run-at-time 5 nil 'tramp-timeout-session vec))
4798
4815
(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 ))
4800
4817
(tramp-cleanup-connection vec 'keep-debug)))
4801
4818
4802
4819
(defun tramp-maybe-open-connection (vec)
@@ -5594,7 +5611,7 @@ This command is returned only if `delete-by-moving-to-trash' is non-nil."
5594
5611
"%s -t %s %s"
5595
5612
result
5596
5613
(format-time-string "%Y%m%d%H%M.%S")
5597
- (tramp-compat- file-local-name tmpfile))))
5614
+ (tramp-file-local-name tmpfile))))
5598
5615
(delete-file tmpfile))
5599
5616
result)))
5600
5617
0 commit comments