Skip to content

Commit 823ce3a

Browse files
committed
; Sync with Tramp repository
* doc/misc/tramp.texi (Frequently Asked Questions): Mention Emacs 28. * doc/misc/trampver.texi: * lisp/net/trampver.el: Change version to "2.4.4-pre". * lisp/net/tramp-adb.el (tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file, tramp-adb-handle-process-file): Use `tramp-file-local-name'. (tramp-adb-handle-exec-path): Expand `default-directory'. * lisp/net/tramp-cmds.el (tramp-rename-files): Use `tramp-file-local-name'. * lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link) (tramp-do-copy-or-rename-file-directly) (tramp-sh-handle-process-file, tramp-set-remote-path) (tramp-find-inline-encoding, tramp-get-remote-touch): Use `tramp-file-local-name'. (tramp-sh-handle-make-process): Support `stderr' as file name. Delete temporary stderr file. (tramp-sh-handle-exec-path): Expand `default-directory'. * lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link) (tramp-smb-handle-process-file): Use `tramp-file-local-name'. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file) (tramp-sudoedit-handle-set-file-uid-gid): Use `tramp-unquote-file-local-name'. (tramp-sudoedit-handle-make-symbolic-link): Use `tramp-file-local-name'. (tramp-sudoedit-handle-file-system-info): Fix a scoping error. * lisp/net/tramp.el: Bump version to 2.4.4-pre. (tramp-ignored-file-name-regexp, tramp-time-dont-know) (tramp-time-doesnt-exist): Fix typo. (tramp-file-local-name): Extend for non-remote file names. (tramp-unquote-file-local-name): New defun. (tramp-completion-make-tramp-file-name): Simplify. (tramp-set-connection-local-variables-for-buffer) (tramp-equal-remote, tramp-handle-make-auto-save-file-name): Use `tramp-tramp-file-p'. (tramp-handle-file-name-case-insensitive-p) (tramp-handle-file-truename, tramp-get-remote-tmpdir) (tramp-make-tramp-temp-file): Use `tramp-file-local-name'. (tramp-handle-shell-command, tramp-handle-start-file-process): Implement asynchronous `error-buffer'.
1 parent 35d5694 commit 823ce3a

File tree

11 files changed

+108
-78
lines changed

11 files changed

+108
-78
lines changed

doc/misc/tramp.texi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3840,8 +3840,8 @@ Where is the latest @value{tramp}?
38403840
@item
38413841
Which systems does it work on?
38423842

3843-
The package works successfully on Emacs 24, Emacs 25, Emacs 26, and
3844-
Emacs 27.
3843+
The package works successfully on Emacs 24, Emacs 25, Emacs 26, Emacs
3844+
27, and Emacs 28.
38453845

38463846
While Unix and Unix-like systems are the primary remote targets,
38473847
@value{tramp} has equal success connecting to other platforms, such as

doc/misc/trampver.texi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@c In the Tramp GIT, the version numbers are auto-frobbed from
99
@c tramp.el, and the bug report address is auto-frobbed from
1010
@c configure.ac.
11-
@set trampver 2.4.3.27.1
11+
@set trampver 2.4.4-pre
1212
@set tramp-bug-report-address tramp-devel@@gnu.org
1313
@set emacsver 24.4
1414

lisp/net/tramp-adb.el

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
725725
(with-tramp-progress-reporter
726726
v 0 (format "Copying %s to %s" filename newname)
727727
(if (and t1 t2 (tramp-equal-remote filename newname))
728-
(let ((l1 (tramp-compat-file-local-name filename))
729-
(l2 (tramp-compat-file-local-name newname)))
728+
(let ((l1 (tramp-file-local-name filename))
729+
(l2 (tramp-file-local-name newname)))
730730
;; We must also flush the cache of the directory,
731731
;; because `file-attributes' reads the values from
732732
;; there.
@@ -809,8 +809,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
809809
(if (and t1 t2
810810
(tramp-equal-remote filename newname)
811811
(not (file-directory-p filename)))
812-
(let ((l1 (tramp-compat-file-local-name filename))
813-
(l2 (tramp-compat-file-local-name newname)))
812+
(let ((l1 (tramp-file-local-name filename))
813+
(l2 (tramp-file-local-name newname)))
814814
;; We must also flush the cache of the directory, because
815815
;; `file-attributes' reads the values from there.
816816
(tramp-flush-file-properties v l1)
@@ -846,7 +846,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
846846
(setq infile (expand-file-name infile))
847847
(if (tramp-equal-remote default-directory infile)
848848
;; INFILE is on the same remote host.
849-
(setq input (with-parsed-tramp-file-name infile nil localname))
849+
(setq input (tramp-file-local-name infile))
850850
;; INFILE must be copied to remote host.
851851
(setq input (tramp-make-tramp-temp-file v)
852852
tmpinput (tramp-make-tramp-file-name v input))
@@ -877,8 +877,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
877877
(setcar (cdr destination) (expand-file-name (cadr destination)))
878878
(if (tramp-equal-remote default-directory (cadr destination))
879879
;; stderr is on the same remote host.
880-
(setq stderr (with-parsed-tramp-file-name
881-
(cadr destination) nil localname))
880+
(setq stderr (tramp-file-local-name (cadr destination)))
882881
;; stderr must be copied to remote host. The temporary
883882
;; file must be deleted after execution.
884883
(setq stderr (tramp-make-tramp-temp-file v)
@@ -1062,7 +1061,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
10621061
(read (current-buffer)))
10631062
":" 'omit)))
10641063
;; The equivalent to `exec-directory'.
1065-
`(,(tramp-compat-file-local-name default-directory))))
1064+
`(,(tramp-file-local-name (expand-file-name default-directory)))))
10661065

10671066
(defun tramp-adb-get-device (vec)
10681067
"Return full host name from VEC to be used in shell execution.

lisp/net/tramp-cmds.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ The remote connection identified by SOURCE is flushed by
358358

359359
;; Append local file name if none is specified.
360360
(when (string-equal (file-remote-p target) target)
361-
(setq target (concat target (file-remote-p source 'localname))))
361+
(setq target (concat target (tramp-file-local-name source))))
362362
;; Make them directory names.
363363
(setq source (directory-file-name source)
364364
target (directory-file-name target))

lisp/net/tramp-compat.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
(require 'shell)
4242
(require 'subr-x)
4343

44+
;; `temporary-file-directory' as function is introduced with Emacs 26.1.
4445
(declare-function tramp-handle-temporary-file-directory "tramp")
4546

4647
;; For not existing functions, obsolete functions, or functions with a

lisp/net/tramp-rclone.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ connection if a previous connection has died for some reason."
564564
,(tramp-rclone-mount-point vec)
565565
;; This could be nil.
566566
,(tramp-get-method-parameter vec 'tramp-mount-args))))
567-
(while (not (file-exists-p (tramp-make-tramp-file-name vec 'localname)))
567+
(while (not (file-exists-p (tramp-make-tramp-file-name vec 'noloc)))
568568
(tramp-cleanup-connection vec 'keep-debug 'keep-password))
569569

570570
;; Mark it as connected.

lisp/net/tramp-sh.el

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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

lisp/net/tramp-smb.el

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,9 +1188,7 @@ component is used as the target of the symlink."
11881188
(let ((non-essential t))
11891189
(when (and (tramp-tramp-file-p target)
11901190
(tramp-file-name-equal-p v (tramp-dissect-file-name target)))
1191-
(setq target
1192-
(tramp-file-name-localname
1193-
(tramp-dissect-file-name (expand-file-name target))))))
1191+
(setq target (tramp-file-local-name (expand-file-name target)))))
11941192

11951193
;; If TARGET is still remote, quote it.
11961194
(if (tramp-tramp-file-p target)
@@ -1244,7 +1242,7 @@ component is used as the target of the symlink."
12441242
(setq infile (expand-file-name infile))
12451243
(if (tramp-equal-remote default-directory infile)
12461244
;; INFILE is on the same remote host.
1247-
(setq input (with-parsed-tramp-file-name infile nil localname))
1245+
(setq input (tramp-file-local-name infile))
12481246
;; INFILE must be copied to remote host.
12491247
(setq input (tramp-make-tramp-temp-file v)
12501248
tmpinput (tramp-make-tramp-file-name v input))

lisp/net/tramp-sudoedit.el

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,8 @@ absolute file names."
265265
v 0 (format "%s %s to %s" msg-operation filename newname)
266266
(unless (tramp-sudoedit-send-command
267267
v sudoedit-operation
268-
(tramp-compat-file-name-unquote
269-
(tramp-compat-file-local-name filename))
270-
(tramp-compat-file-name-unquote
271-
(tramp-compat-file-local-name newname)))
268+
(tramp-unquote-file-local-name filename)
269+
(tramp-unquote-file-local-name newname))
272270
(tramp-error
273271
v 'file-error
274272
"Error %s `%s' `%s'" msg-operation filename newname))))
@@ -615,9 +613,7 @@ component is used as the target of the symlink."
615613
(let ((non-essential t))
616614
(when (and (tramp-tramp-file-p target)
617615
(tramp-file-name-equal-p v (tramp-dissect-file-name target)))
618-
(setq target
619-
(tramp-file-name-localname
620-
(tramp-dissect-file-name (expand-file-name target))))))
616+
(setq target (tramp-file-local-name (expand-file-name target)))))
621617

622618
;; If TARGET is still remote, quote it.
623619
(if (tramp-tramp-file-p target)
@@ -715,8 +711,7 @@ ID-FORMAT valid values are `string' and `integer'."
715711
(format "%d:%d"
716712
(or uid (tramp-sudoedit-get-remote-uid v 'integer))
717713
(or gid (tramp-sudoedit-get-remote-gid v 'integer)))
718-
(tramp-compat-file-name-unquote
719-
(tramp-compat-file-local-name filename)))))
714+
(tramp-unquote-file-local-name filename))))
720715

721716
(defun tramp-sudoedit-handle-write-region
722717
(start end filename &optional append visit lockname mustbenew)

0 commit comments

Comments
 (0)