@c In the Tramp GIT, the version number is auto-frobbed from
@c configure.ac, so you should edit that file and run
@c "autoconf && ./configure" to change the version number.
-@set trampver 2.3.3.26.1
+@set trampver 2.3.4-pre
@c Other flags from configuration
@set instprefix /usr/local
"Name of the Android Debug Bridge program."
:group 'tramp
:version "24.4"
- :type 'string
- :require 'tramp)
+ :type 'string)
;;;###tramp-autoload
(defcustom tramp-adb-connect-if-not-connected nil
It is used for TCP/IP devices."
:group 'tramp
:version "25.1"
- :type 'boolean
- :require 'tramp)
+ :type 'boolean)
;;;###tramp-autoload
(defconst tramp-adb-method "adb"
"Regexp used as prompt in almquist shell."
:type 'string
:version "24.4"
- :group 'tramp
- :require 'tramp)
+ :group 'tramp)
(defconst tramp-adb-ls-date-regexp
"[[:space:]][0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9][[:space:]][0-9][0-9]:[0-9][0-9][[:space:]]"
(tramp-error v 'file-error "Cannot write: `%s'" filename))
(delete-file tmpfile)))
- (when (or (eq visit t) (stringp visit))
- (set-visited-file-modtime))
-
(unless (equal curbuf (current-buffer))
(tramp-error
v 'file-error
- "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))))))
+ "Buffer has changed from `%s' to `%s'" curbuf (current-buffer)))
+
+ ;; Set file modification time.
+ (when (or (eq visit t) (stringp visit))
+ (set-visited-file-modtime
+ (tramp-compat-file-attribute-modification-time
+ (file-attributes filename))))
+
+ ;; The end.
+ (when (and (null noninteractive)
+ (or (eq visit t) (null visit) (stringp visit)))
+ (tramp-message v 0 "Wrote %s" filename))
+ (run-hooks 'tramp-handle-write-region-hook))))
(defun tramp-adb-handle-set-file-modes (filename mode)
"Like `set-file-modes' for Tramp files."
(or (null program) tramp-process-connection-type))
(bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
(name1 name)
- (i 0))
+ (i 0)
+ ;; We do not want to run timers.
+ timer-list timer-idle-list)
(while (get-process name1)
;; NAME must be unique as process name.
:version "24.4"
:type '(repeat (list (choice :tag "File Name regexp" regexp (const nil))
(choice :tag " Property" string)
- (choice :tag " Value" sexp)))
- :require 'tramp)
+ (choice :tag " Value" sexp))))
;;;###tramp-autoload
(defcustom tramp-persistency-file-name
(expand-file-name (locate-user-emacs-file "tramp"))
"File which keeps connection history for Tramp connections."
:group 'tramp
- :type 'file
- :require 'tramp)
+ :type 'file)
(defvar tramp-cache-data-changed nil
"Whether persistent cache data have been changed.")
(unless (string-equal input "")
(list (intern input)))))
(when syntax
- (custom-set-variables `(tramp-syntax ',syntax))))
+ (customize-set-variable 'tramp-syntax syntax)))
(defun tramp-list-tramp-buffers ()
"Return a list of all Tramp connection buffers."
;; 'car
;; (dbus-call-method
;; :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
-;; tramp-gvfs-interface-mounttracker "listMountableInfo")))
+;; tramp-gvfs-interface-mounttracker "ListMountableInfo")))
;; Note that all other connection methods are not tested, beside the
;; ones offered for customization in `tramp-gvfs-methods'. If you
(const "obex")
(const "sftp")
(const "smb")
- (const "synce")))
- :require 'tramp)
+ (const "synce"))))
;; Add defaults for `tramp-default-user-alist' and `tramp-default-host-alist'.
;;;###tramp-autoload
"Zeroconf domain to be used for discovering services, like host names."
:group 'tramp
:version "23.2"
- :type 'string
- :require 'tramp)
+ :type 'string)
;; Add the methods to `tramp-methods', in order to allow minibuffer
;; completion.
devices."
:group 'tramp
:version "23.2"
- :type '(choice (const nil) integer)
- :require 'tramp)
+ :type '(choice (const nil) integer))
(defvar tramp-bluez-discovery nil
"Indicator for a running bluetooth device discovery.
(file-attributes filename))))
;; The end.
- (when (or (eq visit t) (null visit) (stringp visit))
+ (when (and (null noninteractive)
+ (or (eq visit t) (null visit) (stringp visit)))
(tramp-message v 0 "Wrote %s" filename))
(run-hooks 'tramp-handle-write-region-hook)))
whose size is this value or above (up to `tramp-copy-size-limit').
If it is nil, no compression at all will be applied."
:group 'tramp
- :type '(choice (const nil) integer)
- :require 'tramp)
+ :type '(choice (const nil) integer))
;;;###tramp-autoload
(defcustom tramp-copy-size-limit 10240
out-of-the-band copy.
If it is nil, out-of-the-band copy will be used without a check."
:group 'tramp
- :type '(choice (const nil) integer)
- :require 'tramp)
+ :type '(choice (const nil) integer))
;;;###tramp-autoload
(defcustom tramp-terminal-type "dumb"
confused by ANSI color escape sequences and suchlike. Often, shell init
files conditionalize this setup based on the TERM environment variable."
:group 'tramp
- :type 'string
- :require 'tramp)
+ :type 'string)
;;;###tramp-autoload
(defcustom tramp-histfile-override "~/.tramp_history"
:version "25.2"
:type '(choice (const :tag "Do not override HISTFILE" nil)
(const :tag "Unset HISTFILE" t)
- (string :tag "Redirect to a file"))
- :require 'tramp)
+ (string :tag "Redirect to a file")))
;;;###tramp-autoload
(defconst tramp-display-escape-sequence-regexp "\e[[;0-9]+m"
"Whether to use `tramp-ssh-controlmaster-options'."
:group 'tramp
:version "24.4"
- :type 'boolean
- :require 'tramp)
+ :type 'boolean)
(defvar tramp-ssh-controlmaster-options nil
"Which ssh Control* arguments to use.
:type '(repeat (choice
(const :tag "Default Directories" tramp-default-remote-path)
(const :tag "Private Directories" tramp-own-remote-path)
- (string :tag "Directory")))
- :require 'tramp)
+ (string :tag "Directory"))))
;;;###tramp-autoload
(defcustom tramp-remote-process-environment
based on the TRAMP and Emacs versions, and should not be set here."
:group 'tramp
:version "26.1"
- :type '(repeat string)
- :require 'tramp)
+ :type '(repeat string))
;;;###tramp-autoload
(defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile"))
for tilde expansion. The extra arguments should typically prevent the
shell from reading its init file."
:group 'tramp
- :type '(alist :key-type regexp :value-type string)
- :require 'tramp)
+ :type '(alist :key-type regexp :value-type string))
(defconst tramp-actions-before-shell
'((tramp-login-prompt-regexp tramp-action-login)
;; The default directory must be remote.
(let ((default-directory
(file-name-directory (if t1 filename newname)))
- (process-environment (copy-sequence process-environment)))
+ (process-environment (copy-sequence process-environment))
+ ;; We do not want to run timers.
+ timer-list timer-idle-list)
;; Set the transfer process properties.
(tramp-set-connection-property
v "process-name" (buffer-name (current-buffer)))
;; We do not want to raise an error when
;; `start-file-process' has been started several times in
;; `eshell' and friends.
- (tramp-current-connection nil)
+ tramp-current-connection
+ ;; We do not want to run timers.
+ timer-list timer-idle-list
p)
(while (get-process name1)
;; Set the ownership.
(when need-chown
(tramp-set-file-uid-gid filename uid gid))
- (when (or (eq visit t) (null visit) (stringp visit))
+ (when (and (null noninteractive)
+ (or (eq visit t) (null visit) (stringp visit)))
(tramp-message v 0 "Wrote %s" filename))
(run-hooks 'tramp-handle-write-region-hook)))))
(with-current-buffer (process-buffer proc)
;; Use MULE to select the right EOL convention for communicating
;; with the process.
- (let ((cs (or (and (memq 'utf-8 (coding-system-list))
+ (let ((cs (or (and (memq 'utf-8-hfs (coding-system-list))
+ (string-match "^Darwin" uname)
+ (cons 'utf-8-hfs 'utf-8-hfs))
+ (and (memq 'utf-8 (coding-system-list))
(string-match "utf-?8" (tramp-get-remote-locale vec))
(cons 'utf-8 'utf-8))
(process-coding-system proc)
cs-encode
(coding-system-change-eol-conversion
cs-encode (if (string-match "^Darwin" uname) 'mac 'unix)))
- (tramp-send-command vec "echo foo ; echo bar" t)
+ (tramp-send-command vec "(echo foo ; echo bar)" t)
(goto-char (point-min))
(when (search-forward "\r" nil t)
(setq cs-decode (coding-system-change-eol-conversion cs-decode 'dos)))
- ;; Special setting for macOS.
- (when (and (string-match "^Darwin" uname)
- (memq 'utf-8-hfs (coding-system-list)))
- (setq cs-decode 'utf-8-hfs
- cs-encode 'utf-8-hfs))
- (set-buffer-process-coding-system cs-decode cs-encode)
+ (set-process-coding-system proc cs-decode cs-encode)
(tramp-message
vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)))
(zerop
(tramp-call-local-coding-command
(format
+ "echo %s | %s | %s" magic
;; Windows shells need the program file name after
;; the pipe symbol be quoted if they use forward
;; slashes as directory separators.
- (if (memq system-type '(windows-nt))
- "echo %s | \"%s\" | \"%s\""
- "echo %s | %s | %s")
- magic compress decompress)
+ (mapconcat
+ 'shell-quote-argument (split-string compress) " ")
+ (mapconcat
+ 'shell-quote-argument (split-string decompress) " "))
nil nil))
(throw 'next nil))
(tramp-message
(defcustom tramp-smb-program "smbclient"
"Name of SMB client to run."
:group 'tramp
- :type 'string
- :require 'tramp)
+ :type 'string)
;;;###tramp-autoload
(defcustom tramp-smb-acl-program "smbcacls"
"Name of SMB acls to run."
:group 'tramp
:type 'string
- :version "24.4"
- :require 'tramp)
+ :version "24.4")
;;;###tramp-autoload
(defcustom tramp-smb-conf "/dev/null"
If it is nil, no smb.conf will be added to the `tramp-smb-program'
call, letting the SMB client use the default one."
:group 'tramp
- :type '(choice (const nil) (file :must-match t))
- :require 'tramp)
+ :type '(choice (const nil) (file :must-match t)))
(defvar tramp-smb-version nil
"Version string of the SMB client.")
"NT_STATUS_OBJECT_NAME_NOT_FOUND"
"NT_STATUS_OBJECT_PATH_SYNTAX_BAD"
"NT_STATUS_PASSWORD_MUST_CHANGE"
+ "NT_STATUS_RESOURCE_NAME_NOT_FOUND"
"NT_STATUS_SHARING_VIOLATION"
"NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE"
"NT_STATUS_UNSUCCESSFUL"
shall be given. This is needed for remote processes."
:group 'tramp
:type 'string
- :version "24.3"
- :require 'tramp)
+ :version "24.3")
;;;###tramp-autoload
(defcustom tramp-smb-winexe-shell-command "powershell.exe"
This must be Powershell V2 compatible."
:group 'tramp
:type 'string
- :version "24.3"
- :require 'tramp)
+ :version "24.3")
;;;###tramp-autoload
(defcustom tramp-smb-winexe-shell-command-switch "-file -"
This can be used to disable echo etc."
:group 'tramp
:type 'string
- :version "24.3"
- :require 'tramp)
+ :version "24.3")
;; It must be a `defsubst' in order to push the whole code into
;; tramp-loaddefs.el. Otherwise, there would be recursive autoloading.
(expand-file-name
tramp-temp-name-prefix
(tramp-compat-temporary-file-directory))))
- (args (list (concat "//" host "/" share) "-E")))
+ (args (list (concat "//" host "/" share) "-E"))
+ ;; We do not want to run timers.
+ timer-list timer-idle-list)
(if (not (zerop (length user)))
(setq args (append args (list "-U" user)))
(let* ((share (tramp-smb-get-share v))
(localname (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v)))
- (args (list (concat "//" host "/" share) "-E")))
+ (args (list (concat "//" host "/" share) "-E"))
+ ;; We do not want to run timers.
+ timer-list timer-idle-list)
(if (not (zerop (length user)))
(setq args (append args (list "-U" user)))
(let* ((name (file-name-nondirectory program))
(name1 name)
(i 0)
+ ;; We do not want to run timers.
+ timer-list timer-idle-list
input tmpinput outbuf command ret)
;; Determine input.
"\\\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" host "/" share) "-E" "-S"
(replace-regexp-in-string
- "\n" "," acl-string))))
+ "\n" "," acl-string)))
+ ;; We do not want to run timers.
+ timer-list timer-idle-list)
(if (not (zerop (length user)))
(setq args (append args (list "-U" user)))
(command (mapconcat 'identity (cons program args) " "))
(bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
(name1 name)
- (i 0))
+ (i 0)
+ ;; We do not want to run timers.
+ timer-list timer-idle-list)
(unwind-protect
(save-excursion
(save-restriction
(tramp-error
v 'file-error
"Buffer has changed from `%s' to `%s'" curbuf (current-buffer)))
- (when (eq visit t)
- (set-visited-file-modtime)))))
+ ;; Set file modification time.
+ (when (or (eq visit t) (stringp visit))
+ (set-visited-file-modtime
+ (tramp-compat-file-attribute-modification-time
+ (file-attributes filename))))
+
+ ;; The end.
+ (when (and (null noninteractive)
+ (or (eq visit t) (null visit) (stringp visit)))
+ (tramp-message v 0 "Wrote %s" filename))
+ (run-hooks 'tramp-handle-write-region-hook))))
;; Internal file name functions.
"Whether Tramp is enabled.
If it is set to nil, all remote file names are used literally."
:group 'tramp
- :type 'boolean
- :require 'tramp)
+ :type 'boolean)
(defcustom tramp-verbose 3
"Verbosity level for Tramp messages.
9 test commands
10 traces (huge)."
:group 'tramp
- :type 'integer
- :require 'tramp)
+ :type 'integer)
(defcustom tramp-backup-directory-alist nil
"Alist of filename patterns and backup directory names.
policy for local files."
:group 'tramp
:type '(repeat (cons (regexp :tag "Regexp matching filename")
- (directory :tag "Backup directory name")))
- :require 'tramp)
+ (directory :tag "Backup directory name"))))
(defcustom tramp-auto-save-directory nil
"Put auto-save files in this directory, if set.
This setting has precedence over `auto-save-file-name-transforms'."
:group 'tramp
:type '(choice (const :tag "Use default" nil)
- (directory :tag "Auto save directory name"))
- :require 'tramp)
+ (directory :tag "Auto save directory name")))
(defcustom tramp-encoding-shell
(or (tramp-compat-funcall 'w32-shell-name) "/bin/sh")
mechanisms in tramp.el which automatically determine the right shell to
use for the remote host."
:group 'tramp
- :type '(file :must-match t)
- :require 'tramp)
+ :type '(file :must-match t))
(defcustom tramp-encoding-command-switch
(if (tramp-compat-funcall 'w32-shell-dos-semantics) "/c" "-c")
"Use this switch together with `tramp-encoding-shell' for local commands.
See the variable `tramp-encoding-shell' for more information."
:group 'tramp
- :type 'string
- :require 'tramp)
+ :type 'string)
(defcustom tramp-encoding-command-interactive
(unless (tramp-compat-funcall 'w32-shell-dos-semantics) "-i")
See the variable `tramp-encoding-shell' for more information."
:version "24.1"
:group 'tramp
- :type '(choice (const nil) string)
- :require 'tramp)
+ :type '(choice (const nil) string))
;;;###tramp-autoload
(defvar tramp-methods nil
See `tramp-methods' for possibilities.
Also see `tramp-default-method-alist'."
:group 'tramp
- :type 'string
- :require 'tramp)
+ :type 'string)
;;;###tramp-autoload
(defcustom tramp-default-method-alist nil
:group 'tramp
:type '(repeat (list (choice :tag "Host regexp" regexp sexp)
(choice :tag "User regexp" regexp sexp)
- (choice :tag "Method name" string (const nil))))
- :require 'tramp)
+ (choice :tag "Method name" string (const nil)))))
(defconst tramp-default-method-marker "-"
"Marker for default method in remote file names.")
This variable is regarded as obsolete, and will be removed soon."
:group 'tramp
- :type '(choice (const nil) string)
- :require 'tramp)
+ :type '(choice (const nil) string))
;;;###tramp-autoload
(defcustom tramp-default-user-alist nil
"Default user to use for specific method/host pairs.
This is an alist of items (METHOD HOST USER). The first matching item
specifies the user to use for a file name which does not specify a
-user. METHOD and USER are regular expressions or nil, which is
+user. METHOD and HOST are regular expressions or nil, which is
interpreted as a regular expression which always matches. If no entry
matches, the variable `tramp-default-user' takes effect.
:group 'tramp
:type '(repeat (list (choice :tag "Method regexp" regexp sexp)
(choice :tag " Host regexp" regexp sexp)
- (choice :tag " User name" string (const nil))))
- :require 'tramp)
+ (choice :tag " User name" string (const nil)))))
(defcustom tramp-default-host (system-name)
"Default host to use for transferring files.
Useful for su and sudo methods mostly."
:group 'tramp
- :type 'string
- :require 'tramp)
+ :type 'string)
;;;###tramp-autoload
(defcustom tramp-default-host-alist nil
"Default host to use for specific method/user pairs.
This is an alist of items (METHOD USER HOST). The first matching item
specifies the host to use for a file name which does not specify a
-host. METHOD and HOST are regular expressions or nil, which is
+host. METHOD and USER are regular expressions or nil, which is
interpreted as a regular expression which always matches. If no entry
matches, the variable `tramp-default-host' takes effect.
:version "24.4"
:type '(repeat (list (choice :tag "Method regexp" regexp sexp)
(choice :tag " User regexp" regexp sexp)
- (choice :tag " Host name" string (const nil))))
- :require 'tramp)
+ (choice :tag " Host name" string (const nil)))))
(defcustom tramp-default-proxies-alist nil
"Route to be followed for specific host/user pairs.
:group 'tramp
:type '(repeat (list (choice :tag "Host regexp" regexp sexp)
(choice :tag "User regexp" regexp sexp)
- (choice :tag " Proxy name" string (const nil))))
- :require 'tramp)
+ (choice :tag " Proxy name" string (const nil)))))
(defcustom tramp-save-ad-hoc-proxies nil
"Whether to save ad-hoc proxies persistently."
:group 'tramp
:version "24.3"
- :type 'boolean
- :require 'tramp)
+ :type 'boolean)
(defcustom tramp-restricted-shell-hosts-alist
(when (memq system-type '(windows-nt))
host runs a registered shell, it shall be added to this list, too."
:version "24.3"
:group 'tramp
- :type '(repeat (regexp :tag "Host regexp"))
- :require 'tramp)
+ :type '(repeat (regexp :tag "Host regexp")))
;;;###tramp-autoload
(defconst tramp-local-host-regexp
"String used for end of line in local processes."
:version "24.1"
:group 'tramp
- :type 'string
- :require 'tramp)
+ :type 'string)
(defcustom tramp-rsh-end-of-line "\n"
"String used for end of line in rsh connections.
I don't think this ever needs to be changed, so please tell me about it
if you need to change this."
:group 'tramp
- :type 'string
- :require 'tramp)
+ :type 'string)
(defcustom tramp-login-prompt-regexp
".*\\(user\\|login\\)\\( .*\\)?: *"
Sometimes the prompt is reported to look like \"login as:\"."
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defcustom tramp-shell-prompt-pattern
;; Allow a prompt to start right after a ^M since it indeed would be
This regexp must match both `tramp-initial-end-of-output' and
`tramp-end-of-output'."
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defcustom tramp-password-prompt-regexp
(format "^.*\\(%s\\).*:\^@? *"
The `sudo' program appears to insert a `^@' character into the prompt."
:version "24.4"
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defcustom tramp-wrong-passwd-regexp
(concat "^.*"
"Regexp matching a `login failed' message.
The regexp should match at end of buffer."
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defcustom tramp-yesno-prompt-regexp
(concat
The regexp should match at end of buffer.
See also `tramp-yn-prompt-regexp'."
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defcustom tramp-yn-prompt-regexp
(concat
The regexp should match at end of buffer.
See also `tramp-yesno-prompt-regexp'."
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defcustom tramp-terminal-prompt-regexp
(concat "\\("
The regexp should match at end of buffer.
The answer will be provided by `tramp-action-terminal', which see."
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defcustom tramp-operation-not-permitted-regexp
(concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*"
Copying has been performed successfully already, so this message can
be ignored safely."
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defcustom tramp-copy-failed-regexp
(concat "\\(.+: "
"\\)\\s-*")
"Regular expression matching copy problems in (s)cp operations."
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defcustom tramp-process-alive-regexp
""
The answer will be provided by `tramp-action-process-alive',
`tramp-action-out-of-band', which see."
:group 'tramp
- :type 'regexp
- :require 'tramp)
+ :type 'regexp)
(defconst tramp-temp-name-prefix "tramp."
"Prefix to use for temporary files.
Please raise a bug report via \"M-x tramp-bug\" if your system needs
this variable to be set as well."
:group 'tramp
- :type '(choice (const nil) integer)
- :require 'tramp)
+ :type '(choice (const nil) integer))
;; Logging in to a remote host normally requires obtaining a pty. But
;; Emacs on macOS has process-connection-type set to nil by default,
Tramp binds `process-connection-type' to the value given here before
opening a connection to a remote host."
:group 'tramp
- :type '(choice (const nil) (const t) (const pty))
- :require 'tramp)
+ :type '(choice (const nil) (const t) (const pty)))
(defcustom tramp-connection-timeout 60
"Defines the max time to wait for establishing a connection (in seconds).
The timeout does not include the time reading a password."
:group 'tramp
:version "24.4"
- :type 'integer
- :require 'tramp)
+ :type 'integer)
(defcustom tramp-connection-min-time-diff 5
"Defines seconds between two consecutive connection attempts.
let-bind this variable."
:group 'tramp
:version "24.4"
- :type '(choice (const nil) integer)
- :require 'tramp)
+ :type '(choice (const nil) integer))
(defcustom tramp-completion-reread-directory-timeout 10
"Defines seconds since last remote command before rereading a directory.
would require an immediate reread during filename completion, nil
means to use always cached values for the directory contents."
:group 'tramp
- :type '(choice (const nil) (const t) integer)
- :require 'tramp)
+ :type '(choice (const nil) (const t) integer))
;;; Internal Variables:
tramp-default-host))
(defun tramp-dissect-file-name (name &optional nodefault)
- "Return a `tramp-file-name' structure.
-The structure consists of remote method, remote user, remote host,
-localname (file name on remote host) and hop. If NODEFAULT is
-non-nil, the file name parts are not expanded to their default
-values."
+ "Return a `tramp-file-name' structure of NAME, a remote file name.
+The structure consists of method, user, domain, host, port,
+localname (file name on remote host), and hop.
+
+Unless NODEFAULT is non-nil, method, user and host are expanded
+to their default values. For the other file name parts, no
+default values are used."
(save-match-data
(unless (tramp-tramp-file-p name)
(tramp-compat-user-error nil "Not a Tramp file name: \"%s\"" name))
(method user domain host port localname &optional hop)
"Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME.
When not nil, optional DOMAIN, PORT and HOP are used."
+ (when (zerop (length method))
+ (signal 'wrong-type-argument (list 'stringp method)))
(concat tramp-prefix-format hop
- (unless (or (zerop (length method))
- (zerop (length tramp-postfix-method-format)))
+ (unless (zerop (length tramp-postfix-method-format))
(concat method tramp-postfix-method-format))
user
(unless (zerop (length domain))
;; The message.
(insert (apply #'format-message fmt-string arguments))))
-(defvar tramp-message-show-message t
+(defvar tramp-message-show-message (null noninteractive)
"Show Tramp message in the minibuffer.
-This variable is used to disable messages from `tramp-error'.
-The messages are visible anyway, because an error is raised.")
+This variable is used to suppress progress reporter output, and
+to disable messages from `tramp-error'. Those messages are
+visible anyway, because an error is raised.")
(defsubst tramp-message (vec-or-proc level fmt-string &rest arguments)
"Emit a message depending on verbosity level.
This is needed in order to hide `last-coding-system-used', which is set
for process communication also."
(with-current-buffer (process-buffer proc)
- (let (buffer-read-only last-coding-system-used)
+ (let (buffer-read-only last-coding-system-used
+ ;; We do not want to run timers.
+ timer-list timer-idle-list)
;; Under Windows XP, `accept-process-output' doesn't return
;; sometimes. So we add an additional timeout. JUST-THIS-ONE
;; is set due to Bug#12145. It is an integer, in order to avoid
;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; Package: tramp
-;; Version: 2.3.3.26.1
+;; Version: 2.3.4-pre
;; This file is part of GNU Emacs.
;; should be changed only there.
;;;###tramp-autoload
-(defconst tramp-version "2.3.3.26.1"
+(defconst tramp-version "2.3.4-pre"
"This version of Tramp.")
;;;###tramp-autoload
;; Check for Emacs version.
(let ((x (if (>= emacs-major-version 24)
"ok"
- (format "Tramp 2.3.3.26.1 is not fit for %s"
+ (format "Tramp 2.3.4-pre is not fit for %s"
(when (string-match "^.*$" (emacs-version))
(match-string 0 (emacs-version)))))))
(unless (string-match "\\`ok\\'" x) (error "%s" x)))
;; remote host, set this environment variable to "/dev/null" or
;; whatever is appropriate on your system.
+;; For slow remote connections, `tramp-test41-asynchronous-requests'
+;; might be too heavy. Setting $REMOTE_PARALLEL_PROCESSES to a proper
+;; value less than 10 could help.
+
;; A whole test run can be performed calling the command `tramp-test-all'.
;;; Code:
(require 'dired)
(require 'ert)
+(require 'ert-x)
(require 'tramp)
(require 'vc)
(require 'vc-bzr)
(insert-file-contents tmp-name)
(should (string-equal (buffer-string) "34")))
+ ;; Check message.
+ ;; Macro `ert-with-message-capture' was introduced in Emacs 26.1.
+ (with-no-warnings (when (symbol-plist 'ert-with-message-capture)
+ (let ((tramp-message-show-message t))
+ (dolist (noninteractive '(nil t))
+ (dolist (visit '(nil t "string" no-message))
+ (ert-with-message-capture tramp--test-messages
+ (write-region "foo" nil tmp-name nil visit)
+ ;; We must check the last line. There could be
+ ;; other messages from the progress reporter.
+ (should
+ (string-match
+ (if (and (null noninteractive)
+ (or (eq visit t) (null visit) (stringp visit)))
+ (format "^Wrote %s\n\\'" tmp-name) "^\\'")
+ tramp--test-messages))))))))
+
;; Do not overwrite if excluded.
(cl-letf (((symbol-function 'y-or-n-p) (lambda (_prompt) t)))
(write-region "foo" nil tmp-name nil nil nil 'mustbenew))
"Check `copy-file'."
(skip-unless (tramp--test-enabled))
- ;; TODO: The quoted case does not work. Copy local file to remote.
- ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
- (let (quoted)
+ ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
+ (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs27-p))
+ '(nil t) '(nil)))
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
(tmp-name2 (tramp--test-make-temp-name nil quoted))
(tmp-name3 (tramp--test-make-temp-name 'local quoted)))
"Check `rename-file'."
(skip-unless (tramp--test-enabled))
- ;; TODO: The quoted case does not work.
- ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
- (let (quoted)
+ ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
+ (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs27-p))
+ '(nil t) '(nil)))
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
(tmp-name2 (tramp--test-make-temp-name nil quoted))
(tmp-name3 (tramp--test-make-temp-name 'local quoted)))
(file-symlink-p tmp-name2)))
;; `tmp-name3' is a local file name. Therefore, the link
;; target remains unchanged, even if quoted.
- (make-symbolic-link tmp-name1 tmp-name3)
- (should
- (string-equal tmp-name1 (file-symlink-p tmp-name3)))
+ ;; `make-symbolic-link' might not be permitted on w32 systems.
+ (unless (tramp--test-windows-nt)
+ (make-symbolic-link tmp-name1 tmp-name3)
+ (should
+ (string-equal tmp-name1 (file-symlink-p tmp-name3))))
;; Check directory as newname.
(make-directory tmp-name4)
(should-error
;; Symbolic links could look like a remote file name.
;; They must be quoted then.
(delete-file tmp-name2)
- (make-symbolic-link "/penguin:motd:" tmp-name2)
+ (make-symbolic-link
+ (funcall
+ (if quoted 'tramp-compat-file-name-unquote 'identity)
+ "/penguin:motd:")
+ tmp-name2)
(should (file-symlink-p tmp-name2))
(should
(string-equal
(tramp-compat-file-name-quote
(concat (file-remote-p tmp-name2) "/penguin:motd:"))))
;; `tmp-name3' is a local file name.
- (make-symbolic-link tmp-name1 tmp-name3)
- (should (file-symlink-p tmp-name3))
- (should-not (string-equal tmp-name3 (file-truename tmp-name3)))
- ;; `file-truename' returns a quoted file name for `tmp-name3'.
- ;; We must unquote it.
- (should
- (string-equal
- (file-truename tmp-name1)
- (tramp-compat-file-name-unquote (file-truename tmp-name3)))))
+ ;; `make-symbolic-link' might not be permitted on w32 systems.
+ (unless (tramp--test-windows-nt)
+ (make-symbolic-link tmp-name1 tmp-name3)
+ (should (file-symlink-p tmp-name3))
+ (should-not (string-equal tmp-name3 (file-truename tmp-name3)))
+ ;; `file-truename' returns a quoted file name for `tmp-name3'.
+ ;; We must unquote it.
+ (should
+ (string-equal
+ (funcall
+ (if (tramp--test-emacs27-p)
+ 'tramp-compat-file-name-unquote 'identity)
+ (file-truename tmp-name1))
+ (tramp-compat-file-name-unquote (file-truename tmp-name3))))))
;; Cleanup.
(ignore-errors
(skip-unless (tramp--test-enabled))
(skip-unless (file-acl tramp-test-temporary-file-directory))
- ;; TODO: The quoted case does not work. Copy local file to remote.
- ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
- (let (quoted)
+ ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
+ (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs27-p))
+ '(nil t) '(nil)))
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
(tmp-name2 (tramp--test-make-temp-name nil quoted))
(tmp-name3 (tramp--test-make-temp-name 'local quoted)))
(not (equal (file-selinux-context tramp-test-temporary-file-directory)
'(nil nil nil nil))))
- ;; TODO: The quoted case does not work. Copy local file to remote.
- ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
- (let (quoted)
+ ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
+ (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs27-p))
+ '(nil t) '(nil)))
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
(tmp-name2 (tramp--test-make-temp-name nil quoted))
(tmp-name3 (tramp--test-make-temp-name 'local quoted)))
(expand-file-name
(format
"%s~"
- ;; This is taken from `make-backup-file-name-1'.
+ ;; This is taken from `make-backup-file-name-1'. We
+ ;; call `convert-standard-filename', because on MS
+ ;; Windows the (local) colons must be replaced by
+ ;; exclamation marks.
(subst-char-in-string
- ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1)))
+ ?/ ?!
+ (replace-regexp-in-string
+ "!" "!!" (convert-standard-filename tmp-name1))))
tmp-name2)))))
;; The backup directory is created.
(should (file-directory-p tmp-name2)))
(expand-file-name
(format
"%s~"
- ;; This is taken from `make-backup-file-name-1'.
+ ;; This is taken from `make-backup-file-name-1'. We
+ ;; call `convert-standard-filename', because on MS
+ ;; Windows the (local) colons must be replaced by
+ ;; exclamation marks.
(subst-char-in-string
- ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1)))
+ ?/ ?!
+ (replace-regexp-in-string
+ "!" "!!" (convert-standard-filename tmp-name1))))
tmp-name2)))))
;; The backup directory is created.
(should (file-directory-p tmp-name2)))
(expand-file-name
(format
"%s~"
- ;; This is taken from `make-backup-file-name-1'.
+ ;; This is taken from `make-backup-file-name-1'. We
+ ;; call `convert-standard-filename', because on MS
+ ;; Windows the (local) colons must be replaced by
+ ;; exclamation marks.
(subst-char-in-string
- ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1)))
+ ?/ ?!
+ (replace-regexp-in-string
+ "!" "!!" (convert-standard-filename tmp-name1))))
tmp-name2)))))
;; The backup directory is created.
(should (file-directory-p tmp-name2)))
variables, so we check the Emacs version directly."
(>= emacs-major-version 26))
+(defun tramp--test-emacs27-p ()
+ "Check for Emacs version >= 27.1.
+Some semantics has been changed for there, w/o new functions or
+variables, so we check the Emacs version directly."
+ (>= emacs-major-version 27))
+
(defun tramp--test-adb-p ()
"Check, whether the remote host runs Android.
This requires restrictions of file name syntax."
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
'tramp-sh-file-name-handler))
+(defun tramp--test-windows-nt ()
+ "Check, whether the locale host runs MS Windows."
+ (eq system-type 'windows-nt))
+
(defun tramp--test-windows-nt-and-batch ()
"Check, whether the locale host runs MS Windows in batch mode.
This does not support special characters."
(defun tramp--test-check-files (&rest files)
"Run a simple but comprehensive test over every file in FILES."
- ;; TODO: The quoted case does not work.
- ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
- (let (quoted)
+ ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
+ (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs27-p))
+ '(nil t) '(nil)))
;; We must use `file-truename' for the temporary directory,
;; because it could be located on a symlinked directory. This
;; would let the test fail.
(inhibit-message t)
;; Do not run delayed timers.
(timer-max-repeats 0)
- ;; Number of asynchronous processes for test.
- (number-proc 10)
+ ;; Number of asynchronous processes for test. Tests on
+ ;; some machines handle less parallel processes.
+ (number-proc
+ (or
+ (ignore-errors
+ (string-to-number (getenv "REMOTE_PARALLEL_PROCESSES")))
+ 10))
;; On hydra, timings are bad.
(timer-repeat
(cond
(with-current-buffer (process-buffer proc)
(insert string))
(unless (zerop (length string))
+ (dired-uncache (process-get proc 'foo))
(should (file-attributes (process-get proc 'foo))))))
;; Add process sentinel.
(set-process-sentinel
proc
(lambda (proc _state)
+ (dired-uncache (process-get proc 'foo))
(should-not (file-attributes (process-get proc 'foo)))))))
;; Send a string. Use a random order of the buffers. Mix
(file (process-get proc 'foo))
(count (process-get proc 'bar)))
;; Regular operation prior process action.
+ (dired-uncache file)
(if (= count 0)
(should-not (file-attributes file))
(should (file-attributes file)))
;; Give the watchdog a chance.
(read-event nil nil 0.01)
;; Regular operation post process action.
+ (dired-uncache file)
(if (= count 2)
(should-not (file-attributes file))
(should (file-attributes file)))
(shell-command-to-string
(format
"%s -batch -Q -L %s --eval %s"
- (expand-file-name invocation-name invocation-directory)
+ (shell-quote-argument
+ (expand-file-name invocation-name invocation-directory))
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
(shell-command-to-string
(format
"%s -batch -Q -L %s --eval %s"
- (expand-file-name invocation-name invocation-directory)
+ (shell-quote-argument
+ (expand-file-name invocation-name invocation-directory))
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument (format code tm)))))))))
(shell-command-to-string
(format
"%s -batch -Q -L %s --eval %s"
- (expand-file-name invocation-name invocation-directory)
+ (shell-quote-argument
+ (expand-file-name invocation-name invocation-directory))
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code))))))))
(shell-command-to-string
(format
"%s -batch -Q -L %s -l tramp-sh --eval %s"
- (expand-file-name invocation-name invocation-directory)
+ (shell-quote-argument
+ (expand-file-name invocation-name invocation-directory))
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))