summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2021-09-16 16:50:24 +0200
committerMichael Albinus <michael.albinus@gmx.de>2021-09-16 16:50:24 +0200
commit36474a1e490a5eae266805a0e04615741d56692c (patch)
tree8ad8f0d09436f5537d1e264935ab96669bc84c80 /lisp
parent85c7993631ce49d2082971df8743b2e1ba2fa81d (diff)
downloademacs-36474a1e490a5eae266805a0e04615741d56692c.tar.gz
Tramp code cleanup
* lisp/net/tramp-sh.el (tramp-methods) <telnet, nc>: Reintroduce "%n" marker. (tramp-maybe-open-connection): Handle it. * lisp/net/tramp.el (tramp-prefix-regexp): * lisp/net/tramp-smb.el (tramp-smb-options): Fix docstring. * lisp/net/tramp*.el: Fix typos. Remove trailing space from `yes-or-no-p' and `y-or-n-p' prompts. * test/lisp/net/tramp-tests.el (tramp--test-telnet-p): New defun. (tramp-test29-start-file-process, tramp-test30-make-process) (tramp-test35-remote-path, tramp-test44-asynchronous-requests): Adapt tests.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/net/tramp-adb.el4
-rw-r--r--lisp/net/tramp-archive.el2
-rw-r--r--lisp/net/tramp-cmds.el4
-rw-r--r--lisp/net/tramp-crypt.el2
-rw-r--r--lisp/net/tramp-ftp.el6
-rw-r--r--lisp/net/tramp-gvfs.el10
-rw-r--r--lisp/net/tramp-sh.el32
-rw-r--r--lisp/net/tramp-smb.el16
-rw-r--r--lisp/net/tramp-sshfs.el2
-rw-r--r--lisp/net/tramp-sudoedit.el4
-rw-r--r--lisp/net/tramp.el24
-rw-r--r--lisp/net/trampver.el2
12 files changed, 57 insertions, 51 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index a35ac37a207..46064a85745 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -361,7 +361,7 @@ arguments to pass to the OPERATION."
(tramp-message vec 5 "Finding a suitable `ls' command")
(cond
;; Support Android derived systems where "ls" command is provided
- ;; by GNU Coreutils. Force "ls" to print one column and set
+ ;; by GNU Coreutils. Force "ls" to print one column and set
;; time-style to imitate other "ls" flavors.
((tramp-adb-send-command-and-check
vec (concat "ls --time-style=long-iso "
@@ -548,7 +548,7 @@ But handle the case, if the \"test\" command is not available."
(or (eq mustbenew 'excl)
(not
(y-or-n-p
- (format "File %s exists; overwrite anyway? " filename)))))
+ (format "File %s exists; overwrite anyway?" filename)))))
(tramp-error v 'file-already-exists filename))
(let ((file-locked (eq (file-locked-p lockname) t))
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 67798e892ab..5e2e1f06023 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -190,7 +190,7 @@ It must be supported by libarchive(3).")
;; In older Emacsen (prior 27.1), `tramp-archive-autoload-file-name-regexp'
;; is not autoloaded. So we cannot expect it to be known in
-;; tramp-loaddefs.el. But it exists, when tramp-archive.el is loaded.
+;; tramp-loaddefs.el. But it exists, when tramp-archive.el is loaded.
;;;###tramp-autoload
(defconst tramp-archive-file-name-regexp
(ignore-errors (tramp-archive-autoload-file-name-regexp))
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 6278fd302af..bfd928731a3 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -312,7 +312,7 @@ The remote connection identified by SOURCE is flushed by
(if (null connections)
(tramp-user-error nil "There are no remote connections.")
(setq source
- ;; Likely, the source remote connection is broken. So we
+ ;; Likely, the source remote connection is broken. So we
;; shall avoid any action on it.
(let (non-essential)
(completing-read-default
@@ -717,7 +717,7 @@ the debug buffer(s).")
(setq buffer-read-only t)
(goto-char (point-min))
- (when (y-or-n-p "Do you want to append the buffer(s)? ")
+ (when (y-or-n-p "Do you want to append the buffer(s)?")
;; OK, let's send. First we delete the buffer list.
(kill-buffer nil)
(switch-to-buffer curbuf)
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index fdb2907ec32..5f86767ef94 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -517,7 +517,7 @@ kept in their encrypted form."
tramp-crypt-encfs-config
(directory-files name nil directory-files-no-dot-files-regexp))
(yes-or-no-p
- "There exist encrypted files, do you want to continue? "))
+ "There exist encrypted files, do you want to continue?"))
(setq tramp-crypt-directories (delete name tramp-crypt-directories))
(tramp-register-file-name-handlers)))
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index fa2df89e495..11ccdc8a4c9 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -120,15 +120,15 @@ pass to the OPERATION."
(nth 2 tramp-file-name-structure)
(nth 4 tramp-file-name-structure)))
;; ange-ftp uses `ange-ftp-ftp-name-arg' and `ange-ftp-ftp-name-res'
- ;; for optimization in `ange-ftp-ftp-name'. If Tramp wasn't active,
+ ;; for optimization in `ange-ftp-ftp-name'. If Tramp wasn't active,
;; there could be incorrect values from previous calls in case the
- ;; "ftp" method is used in the Tramp file name. So we unset
+ ;; "ftp" method is used in the Tramp file name. So we unset
;; those values.
(ange-ftp-ftp-name-arg "")
(ange-ftp-ftp-name-res nil))
(cond
;; If argument is a symlink, `file-directory-p' and
- ;; `file-exists-p' call the traversed file recursively. So we
+ ;; `file-exists-p' call the traversed file recursively. So we
;; cannot disable the file-name-handler this case. We set the
;; connection property "started" in order to put the remote
;; location into the cache, which is helpful for further
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 25deead8133..5f0e7bcd98c 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1815,10 +1815,8 @@ a downcased host name only."
(message "%s" message)
(pop-to-buffer (current-buffer)))
(if (yes-or-no-p
- (concat
- (buffer-substring
- (line-beginning-position) (point))
- " "))
+ (buffer-substring
+ (line-beginning-position) (point)))
0 1)))))
;; When QUIT is raised, we shall return this
@@ -1840,7 +1838,7 @@ a downcased host name only."
(ignore-errors
(let ((signal-name (dbus-event-member-name last-input-event))
(elt mount-info))
- ;; Jump over the first elements of the mount info. Since there
+ ;; Jump over the first elements of the mount info. Since there
;; were changes in the entries, we cannot access dedicated
;; elements.
(while (stringp (car elt)) (setq elt (cdr elt)))
@@ -1936,7 +1934,7 @@ a downcased host name only."
:session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
tramp-gvfs-interface-mounttracker tramp-gvfs-listmounts))
nil)
- ;; Jump over the first elements of the mount info. Since there
+ ;; Jump over the first elements of the mount info. Since there
;; were changes in the entries, we cannot access dedicated
;; elements.
(while (stringp (car elt)) (setq elt (cdr elt)))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index d0a340a5df7..22d4712985c 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -244,14 +244,14 @@ The string is used in `tramp-methods'.")
(add-to-list 'tramp-methods
`("telnet"
(tramp-login-program "telnet")
- (tramp-login-args (("%h") ("%p")))
+ (tramp-login-args (("%h") ("%p") ("%n")))
(tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(add-to-list 'tramp-methods
`("nc"
(tramp-login-program "telnet")
- (tramp-login-args (("%h") ("%p")))
+ (tramp-login-args (("%h") ("%p") ("%n")))
(tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
@@ -1064,7 +1064,7 @@ component is used as the target of the symlink."
(not
(yes-or-no-p
(format
- "File %s already exists; make it a link anyway? "
+ "File %s already exists; make it a link anyway?"
localname)))))
(tramp-error v 'file-already-exists localname)
(delete-file linkname)))
@@ -1073,7 +1073,7 @@ component is used as the target of the symlink."
;; Right, they are on the same host, regardless of user,
;; method, etc. We now make the link on the remote
- ;; machine. This will occur as the user that TARGET belongs to.
+ ;; machine. This will occur as the user that TARGET belongs to.
(and (tramp-send-command-and-check
v (format "cd %s" (tramp-shell-quote-argument cwd)))
(tramp-send-command-and-check
@@ -1825,7 +1825,7 @@ ID-FORMAT valid values are `string' and `integer'."
(and (numberp ok-if-already-exists)
(not (yes-or-no-p
(format
- "File %s already exists; make it a link anyway? "
+ "File %s already exists; make it a link anyway?"
v2-localname)))))
(tramp-error v2 'file-already-exists newname)
(delete-file newname)))
@@ -2231,7 +2231,7 @@ the uid and gid from FILENAME."
;; Save exit.
(ignore-errors (delete-file tmpfile)))))))))
- ;; Set the time and mode. Mask possible errors.
+ ;; Set the time and mode. Mask possible errors.
(ignore-errors
(when keep-date
(tramp-compat-set-file-times
@@ -2748,7 +2748,7 @@ the result will be a local, non-Tramp, file name."
;;; Remote commands:
-;; We use BUFFER also as connection buffer during setup. Because of
+;; We use BUFFER also as connection buffer during setup. Because of
;; this, its original contents must be saved, and restored once
;; connection has been setup.
(defun tramp-sh-handle-make-process (&rest args)
@@ -3269,7 +3269,7 @@ implementation will be used."
(or (eq mustbenew 'excl)
(not
(y-or-n-p
- (format "File %s exists; overwrite anyway? " filename)))))
+ (format "File %s exists; overwrite anyway?" filename)))))
(tramp-error v 'file-already-exists filename))
(let ((file-locked (eq (file-locked-p lockname) t))
@@ -4000,7 +4000,7 @@ Returns the absolute file name of PROGNAME, if found, and nil otherwise.
This function expects to be in the right *tramp* buffer."
(with-current-buffer (tramp-get-connection-buffer vec)
(let (result)
- ;; Check whether the executable is in $PATH. "which(1)" does not
+ ;; Check whether the executable is in $PATH. "which(1)" does not
;; report always a correct error code; therefore we check the
;; number of words it returns. "SunOS 5.10" (and maybe "SunOS
;; 5.11") have problems with this command, we disable the call
@@ -4904,6 +4904,8 @@ connection if a previous connection has died for some reason."
(tramp-error vec 'file-error "`tramp-encoding-shell' not set"))
(let* ((current-host tramp-system-name)
(target-alist (tramp-compute-multi-hops vec))
+ ;; Needed for `tramp-get-remote-null-device'.
+ (previous-hop nil)
;; We will apply `tramp-ssh-controlmaster-options'
;; only for the first hop.
(options (tramp-ssh-controlmaster-options vec))
@@ -5016,6 +5018,8 @@ connection if a previous connection has died for some reason."
hop 'tramp-login-args
?h (or l-host "") ?u (or l-user "") ?p (or l-port "")
?c (format-spec options (format-spec-make ?t tmpfile))
+ ?n (concat
+ "2>" (tramp-get-remote-null-device previous-hop))
?l (concat remote-shell " " extra-args " -i"))
;; A restricted shell does not allow "exec".
(when r-shell '("&&" "exit" "||" "exit")))
@@ -5031,10 +5035,12 @@ connection if a previous connection has died for some reason."
tramp-actions-before-shell
(or connection-timeout tramp-connection-timeout))
(tramp-message
- vec 3 "Found remote shell prompt on `%s'" l-host))
- ;; Next hop.
- (setq options ""
- target-alist (cdr target-alist)))
+ vec 3 "Found remote shell prompt on `%s'" l-host)
+
+ ;; Next hop.
+ (setq options ""
+ target-alist (cdr target-alist)
+ previous-hop hop)))
;; Activate session timeout.
(when (tramp-get-connection-property p "session-timeout" nil)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 5cfe874f00a..fa5bce74bb1 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -48,7 +48,7 @@
;; Another guess. We might implement a better check later on.
(tramp-case-insensitive t)))))
-;; Add a default for `tramp-default-user-alist'. Rule: For the SMB method,
+;; Add a default for `tramp-default-user-alist'. Rule: For the SMB method,
;; the anonymous user is chosen.
;;;###tramp-autoload
(tramp--with-startup
@@ -83,7 +83,7 @@ call, letting the SMB client use the default one."
They are added to the `tramp-smb-program' call via \"--option '...'\".
For example, if the deprecated SMB1 protocol shall be used, add to
-this variable (\"client min protocol=NT1\") ."
+this variable \"client min protocol=NT1\"."
:group 'tramp
:type '(repeat string)
:version "28.1")
@@ -376,7 +376,7 @@ arguments to pass to the OPERATION."
(and (numberp ok-if-already-exists)
(not (yes-or-no-p
(format
- "File %s already exists; make it a link anyway? "
+ "File %s already exists; make it a link anyway?"
v2-localname)))))
(tramp-error v2 'file-already-exists newname)
(delete-file newname)))
@@ -1247,7 +1247,7 @@ component is used as the target of the symlink."
(and (numberp ok-if-already-exists)
(not (yes-or-no-p
(format
- "File %s already exists; make it a link anyway? "
+ "File %s already exists; make it a link anyway?"
localname)))))
(tramp-error v 'file-already-exists localname)
(delete-file linkname)))
@@ -1526,7 +1526,7 @@ component is used as the target of the symlink."
(tramp-error
v 'file-error "Error while changing file's mode %s" filename))))))
-;; We use BUFFER also as connection buffer during setup. Because of
+;; We use BUFFER also as connection buffer during setup. Because of
;; this, its original contents must be saved, and restored once
;; connection has been setup.
(defun tramp-smb-handle-start-file-process (name buffer program &rest args)
@@ -1603,7 +1603,7 @@ errors for shares like \"C$/\", which are common in Microsoft Windows."
(or (eq mustbenew 'excl)
(not
(y-or-n-p
- (format "File %s exists; overwrite anyway? " filename)))))
+ (format "File %s exists; overwrite anyway?" filename)))))
(tramp-error v 'file-already-exists filename))
(let ((file-locked (eq (file-locked-p lockname) t))
@@ -1703,7 +1703,7 @@ If VEC has no cifs capabilities, exchange \"/\" by \"\\\\\"."
localname)))
-;; Share names of a host are cached. It is very unlikely that the
+;; Share names of a host are cached. It is very unlikely that the
;; shares do change during connection.
(defun tramp-smb-get-file-entries (directory)
"Read entries which match DIRECTORY.
@@ -2200,5 +2200,7 @@ Removes smb prompt. Returns nil if an error message has appeared."
;;
;; * Try to remove the inclusion of dummy "" directory. Seems to be at
;; several places, especially in `tramp-smb-handle-insert-directory'.
+;;
+;; * Keep a separate connection process per share.
;;; tramp-smb.el ends here
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index c5b84a6e4e4..0019ac014f8 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -292,7 +292,7 @@ arguments to pass to the OPERATION."
(or (eq mustbenew 'excl)
(not
(y-or-n-p
- (format "File %s exists; overwrite anyway? " filename)))))
+ (format "File %s exists; overwrite anyway?" filename)))))
(tramp-error v 'file-already-exists filename))
(let ((file-locked (eq (file-locked-p lockname) t)))
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 051d145c2a2..516d46da37d 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -190,7 +190,7 @@ arguments to pass to the OPERATION."
(and (numberp ok-if-already-exists)
(not (yes-or-no-p
(format
- "File %s already exists; make it a link anyway? "
+ "File %s already exists; make it a link anyway?"
v2-localname)))))
(tramp-error v2 'file-already-exists newname)
(delete-file newname)))
@@ -632,7 +632,7 @@ component is used as the target of the symlink."
(not
(yes-or-no-p
(format
- "File %s already exists; make it a link anyway? "
+ "File %s already exists; make it a link anyway?"
localname)))))
(tramp-error v 'file-already-exists localname)
(delete-file linkname)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 0182248dfad..6ed67034f4e 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -861,7 +861,7 @@ Used in `tramp-make-tramp-file-name'.")
(defvar tramp-prefix-regexp nil ;Initialized when defining `tramp-syntax'!
"Regexp matching the very beginning of Tramp file names.
-Should always start with \"^\". Derived from `tramp-prefix-format'.")
+Should always start with \"^\". Derived from `tramp-prefix-format'.")
(defconst tramp-method-regexp-alist
'((default . "[[:alnum:]-]+")
@@ -2379,7 +2379,7 @@ For definition of that list see `tramp-set-completion-function'."
;; Inodes don't exist for some file systems. Therefore we must
;; generate virtual ones. Used in `find-buffer-visiting'. The method
-;; applied might be not so efficient (Ange-FTP uses hashes). But
+;; applied might be not so efficient (Ange-FTP uses hashes). But
;; performance isn't the major issue given that file transfer will
;; take time.
(defvar tramp-inodes 0
@@ -2908,7 +2908,7 @@ not in completion mode."
;; I misuse a little bit the `tramp-file-name' structure in order to
;; handle completion possibilities for partial methods / user names /
;; host names. Return value is a list of `tramp-file-name' structures
-;; according to possible completions. If "localname" is non-nil it
+;; according to possible completions. If "localname" is non-nil it
;; means there shouldn't be a completion anymore.
;; Expected results:
@@ -3288,7 +3288,7 @@ User is always nil."
(and (numberp ok-if-already-exists)
(not (yes-or-no-p
(format
- "File %s already exists; make it a link anyway? "
+ "File %s already exists; make it a link anyway?"
localname)))))
(tramp-error v 'file-already-exists newname)
(delete-file newname)))
@@ -3463,7 +3463,7 @@ User is always nil."
(or ;; Maybe there is a default value.
(tramp-get-method-parameter v 'tramp-case-insensitive)
- ;; There isn't. So we must check, in case there's a connection already.
+ ;; There isn't. So we must check, in case there's a connection already.
(and (file-remote-p filename nil 'connected)
(with-tramp-connection-property v "case-insensitive"
(ignore-errors
@@ -3694,7 +3694,7 @@ User is always nil."
(yes-or-no-p
(concat
"Backup file on local temporary directory, "
- "do you want to continue? ")))))
+ "do you want to continue?")))))
(tramp-error v 'file-error "Unsafe backup file name"))))))
(defun tramp-handle-insert-directory
@@ -3915,7 +3915,7 @@ Return nil when there is no lockfile."
(yes-or-no-p
(concat
"Lock file on local temporary directory, "
- "do you want to continue? ")))))
+ "do you want to continue?")))))
(tramp-error v 'file-error "Unsafe lock file name")))
;; Do the lock.
@@ -4274,13 +4274,13 @@ support symbolic links."
((eq async-shell-command-buffer 'confirm-kill-process)
;; If will kill a process, query first.
(if (yes-or-no-p
- "A command is running in the default buffer. Kill it? ")
+ "A command is running in the default buffer. Kill it?")
(kill-process p)
(tramp-user-error p "Shell command in progress")))
((eq async-shell-command-buffer 'confirm-new-buffer)
;; If will create a new buffer, query first.
(if (yes-or-no-p
- "A command is running in the default buffer. Use a new buffer? ")
+ "A command is running in the default buffer. Use a new buffer?")
(setq output-buffer (generate-new-buffer bname))
(tramp-user-error p "Shell command in progress")))
((eq async-shell-command-buffer 'new-buffer)
@@ -4289,7 +4289,7 @@ support symbolic links."
((eq async-shell-command-buffer 'confirm-rename-buffer)
;; If will rename the buffer, query first.
(if (yes-or-no-p
- "A command is running in the default buffer. Rename it? ")
+ "A command is running in the default buffer. Rename it?")
(progn
(with-current-buffer output-buffer
(rename-uniquely))
@@ -4492,7 +4492,7 @@ of."
(or (eq mustbenew 'excl)
(not
(y-or-n-p
- (format "File %s exists; overwrite anyway? " filename)))))
+ (format "File %s exists; overwrite anyway?" filename)))))
(tramp-error v 'file-already-exists filename))
(let ((file-locked (eq (file-locked-p lockname) t))
@@ -5468,7 +5468,7 @@ this file, if that variable is non-nil."
(yes-or-no-p
(concat
"Autosave file on local temporary directory, "
- "do you want to continue? ")))))
+ "do you want to continue?")))))
(tramp-error v 'file-error "Unsafe autosave file name"))))))
(defun tramp-subst-strs-in-string (alist string)
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 8ad641ee45b..8baf0780c28 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -29,7 +29,7 @@
;;; Commentary:
-;; Convenience functions around the Tramp version. Partly generated
+;; Convenience functions around the Tramp version. Partly generated
;; during Tramp configuration.
;;; Code: