branch: externals/tramp commit 692f57b8c7d87eecf04e5f0ad062d9b14286eb96 Author: Michael Albinus <michael.albi...@gmx.de> Commit: Michael Albinus <michael.albi...@gmx.de>
Tramp ELPA version 2.5.1.3 released --- test/tramp-tests.el | 25 +++++++++++++++++++------ texi/tramp.texi | 26 +++++++++++++------------- texi/trampver.texi | 2 +- tramp-cmds.el | 2 ++ tramp-gvfs.el | 11 +++++++---- tramp-sh.el | 54 ++++++++++++++++++++++++++++++++++++----------------- tramp.el | 6 +++--- trampver.el | 6 +++--- 8 files changed, 85 insertions(+), 47 deletions(-) diff --git a/test/tramp-tests.el b/test/tramp-tests.el index 4c452ed..28aadbb 100644 --- a/test/tramp-tests.el +++ b/test/tramp-tests.el @@ -52,6 +52,7 @@ (require 'vc-git) (require 'vc-hg) +(declare-function tramp-check-remote-uname "tramp-sh") (declare-function tramp-find-executable "tramp-sh") (declare-function tramp-get-remote-chmod-h "tramp-sh") (declare-function tramp-get-remote-gid "tramp-sh") @@ -4587,7 +4588,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (while (accept-process-output proc 0 nil t)))) (should (string-match-p - (if (memq process-connection-type '(nil pipe)) + (if (and (memq process-connection-type '(nil pipe)) + (not (tramp--test-macos-p))) + ;; On macOS, there is always newline conversion. ;; `telnet' converts \r to <CR><NUL> if `crlf' ;; flag is FALSE. See telnet(1) man page. "66\n6F\n6F\n0D\\(\n00\\)?\n0A\n" @@ -4852,8 +4855,10 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." (while (accept-process-output proc 0 nil t)))) (should (string-match-p - (if (memq (or connection-type process-connection-type) - '(nil pipe)) + (if (and (memq (or connection-type process-connection-type) + '(nil pipe)) + (not (tramp--test-macos-p))) + ;; On macOS, there is always newline conversion. ;; `telnet' converts \r to <CR><NUL> if `crlf' ;; flag is FALSE. See telnet(1) man page. "66\n6F\n6F\n0D\\(\n00\\)?\n0A\n" @@ -6062,7 +6067,7 @@ This requires restrictions of file name syntax." 'tramp-ftp-file-name-handler)) (defun tramp--test-crypt-p () - "Check, whether the remote directory is crypted" + "Check, whether the remote directory is crypted." (tramp-crypt-file-name-p tramp-test-temporary-file-directory)) (defun tramp--test-docker-p () @@ -6099,8 +6104,7 @@ If optional METHOD is given, it is checked first." Several special characters do not work properly there." ;; We must refill the cache. `file-truename' does it. (file-truename tramp-test-temporary-file-directory) - (string-match-p - "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" ""))) + (tramp-check-remote-uname tramp-test-vec "^HP-UX")) (defun tramp--test-ksh-p () "Check, whether the remote shell is ksh. @@ -6111,6 +6115,12 @@ a $'' syntax." (string-match-p "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" ""))) +(defun tramp--test-macos-p () + "Check, whether the remote host runs macOS." + ;; We must refill the cache. `file-truename' does it. + (file-truename tramp-test-temporary-file-directory) + (tramp-check-remote-uname tramp-test-vec "Darwin")) + (defun tramp--test-mock-p () "Check, whether the mock method is used. This does not support external Emacs calls." @@ -6788,6 +6798,8 @@ process sentinels. They shall not disturb each other." (default-directory tmp-name) (file (buffer-name + ;; Use `seq-random-elt' once <26.1 support + ;; is dropped. (nth (random (length buffers)) buffers))) ;; A remote operation in a timer could ;; confuse Tramp heavily. So we ignore this @@ -6853,6 +6865,7 @@ process sentinels. They shall not disturb each other." ;; the buffers. Mix with regular operation. (let ((buffers (copy-sequence buffers))) (while buffers + ;; Use `seq-random-elt' once <26.1 support is dropped. (let* ((buf (nth (random (length buffers)) buffers)) (proc (get-buffer-process buf)) (file (process-get proc 'foo)) diff --git a/texi/tramp.texi b/texi/tramp.texi index e7b1995..4f786d9 100644 --- a/texi/tramp.texi +++ b/texi/tramp.texi @@ -2610,7 +2610,7 @@ where @samp{192.168.0.1} is the remote host IP address @node FUSE setup @section @acronym{FUSE} setup hints -The @acronym{FUSE} file systems are mounted per default at +The @acronym{FUSE} file systems are mounted by default at @file{/tmp/tramp.method.user@@host#port}. The user name and port number are optional. If the file system is already mounted, it will be used as it is. If the mount point does not exist yet, @@ -3741,27 +3741,27 @@ To open @command{powershell} as a remote shell, use this: @vindex process-connection-type @cindex tramp-process-connection-type -Asynchronous processes differ in the way, whether they use a pseudo -tty, or not. This is controlled by the variable +Asynchronous processes behave differently based on whether they use a +pseudo tty or not. This is controlled by the variable @code{process-connection-type}, which can be @code{t} or @code{pty} -(use a pseudo tty), or @code{nil} or @code{pipe} (don't use it). +(use a pseudo tty), or @code{nil} or @code{pipe} (don't use one). @value{tramp} is based on running shells on the remote host, which -require a pseudo tty. Therefore, it declares the variable +requires a pseudo tty. Therefore, it declares the variable @code{tramp-process-connection-type}, which carries this information -for remote processes. Per default, its value is @code{t}, and there's -no need to change it. The name of the remote pseudo tty is returned -by the function @code{process-tty-name}. +for remote processes. Its default value is @code{t}, and there is no +need to change it. The name of the remote pseudo tty is returned by +the function @code{process-tty-name}. -If a remote process, started by @code{start-file-process}, shouldn't -use a pseudo tty, this can be indicated by setting +If a remote process, started by @code{start-file-process}, should +@emph{not} use a pseudo tty, this can be requested by setting @code{process-connection-type} to @code{nil} or @code{pipe}. There is still a pseudo tty for the started process, but some terminal properties are changed, like suppressing translation of carriage return characters into newline. -The function @code{make-process} allows an explicit setting by the -@code{:connection-type} keyword. If this keyword is not used, the -value of @code{process-connection-type} is applied instead. +The function @code{make-process} allows controlling this explicitly by +using the @code{:connection-type} keyword. If this keyword is not +used, the value of @code{process-connection-type} is applied instead. @anchor{Improving performance of asynchronous remote processes} diff --git a/texi/trampver.texi b/texi/trampver.texi index e8e5010..9ce8330 100644 --- a/texi/trampver.texi +++ b/texi/trampver.texi @@ -8,7 +8,7 @@ @c In the Tramp GIT, the version numbers are auto-frobbed from @c tramp.el, and the bug report address is auto-frobbed from @c configure.ac. -@set trampver 2.5.1.2 +@set trampver 2.5.1.3 @set trampurl https://www.gnu.org/software/tramp/ @set tramp-bug-report-address tramp-devel@@gnu.org @set emacsver 25.1 diff --git a/tramp-cmds.el b/tramp-cmds.el index bfd9287..63eab1b 100644 --- a/tramp-cmds.el +++ b/tramp-cmds.el @@ -131,6 +131,8 @@ When called interactively, a Tramp connection has to be selected." (buf (list (get-buffer (tramp-buffer-name vec)) (unless keep-debug (get-buffer (tramp-debug-buffer-name vec))) + (unless keep-debug + (get-buffer (tramp-trace-buffer-name vec))) (tramp-get-connection-property vec "process-buffer" nil))) (when (bufferp buf) (kill-buffer buf))) diff --git a/tramp-gvfs.el b/tramp-gvfs.el index 5f0e7bc..115d005 100644 --- a/tramp-gvfs.el +++ b/tramp-gvfs.el @@ -1833,8 +1833,9 @@ a downcased host name only." result)))) (defun tramp-gvfs-handler-mounted-unmounted (mount-info) - "Signal handler for the \"org.gtk.vfs.MountTracker.mounted\" and \ -\"org.gtk.vfs.MountTracker.unmounted\" signals." + "Signal handler for the gvfs \"mounted\" and \"unmounted\" signals. +Their full names are \"org.gtk.vfs.MountTracker.mounted\" and +\"org.gtk.vfs.MountTracker.unmounted\"." (ignore-errors (let ((signal-name (dbus-event-member-name last-input-event)) (elt mount-info)) @@ -2090,8 +2091,10 @@ It was \"a(say)\", but has changed to \"a{sv})\"." `(:struct ,(tramp-gvfs-dbus-string-to-byte-array mount-pref) ,mount-spec))) (defun tramp-gvfs-handler-volumeadded-volumeremoved (_dbus-name _id volume) - "Signal handler for the \"org.gtk.Private.RemoteVolumeMonitor.VolumeAdded\" \ -and \"org.gtk.Private.RemoteVolumeMonitor.VolumeRemoved\" signals." + "Signal handler for the gvfs \"VolumeAdded\" and \"VolumeRemoved\" signals. +Their full names are +\"org.gtk.Private.RemoteVolumeMonitor.VolumeAdded\" and +\"org.gtk.Private.RemoteVolumeMonitor.VolumeRemoved\"." (ignore-errors (let* ((signal-name (dbus-event-member-name last-input-event)) (uri (url-generic-parse-url (nth 5 volume))) diff --git a/tramp-sh.el b/tramp-sh.el index 18599f7..dd92f22 100644 --- a/tramp-sh.el +++ b/tramp-sh.el @@ -1628,9 +1628,7 @@ ID-FORMAT valid values are `string' and `integer'." ;; On BSD-derived systems files always inherit the ;; parent directory's group, so skip the group-gid ;; test. - (string-match-p - "BSD\\|DragonFly\\|Darwin" - (tramp-get-connection-property v "uname" "")) + (tramp-check-remote-uname v "BSD\\|DragonFly\\|Darwin") (= (tramp-compat-file-attribute-group-id attributes) (tramp-get-remote-gid v 'integer))))))))) @@ -1701,7 +1699,7 @@ ID-FORMAT valid values are `string' and `integer'." ;; FIXME: Fix function to work with count parameter. (defun tramp-do-directory-files-and-attributes-with-stat (vec localname &optional id-format) - "Implement `directory-files-and-attributes' for Tramp files using stat(1) command." + "Implement `directory-files-and-attributes' for Tramp files with stat(1) command." (tramp-message vec 5 "directory-files-and-attributes with stat: %s" localname) (tramp-send-command-and-read vec @@ -2883,10 +2881,14 @@ implementation will be used." ;; Handle error buffer. (when (bufferp stderr) + (unless (tramp-get-remote-mknod-or-mkfifo v) + (tramp-error + v 'file-error "Stderr buffer `%s' not supported" stderr)) (with-current-buffer stderr (setq buffer-read-only nil)) ;; Create named pipe. - (tramp-send-command v (format "mknod %s p" tmpstderr)) + (tramp-send-command + v (format (tramp-get-remote-mknod-or-mkfifo v) tmpstderr)) ;; Create stderr process. (make-process :name (buffer-name stderr) @@ -2933,8 +2935,11 @@ implementation will be used." (setq p (tramp-get-connection-process v)) (process-put p 'remote-pid pid) (tramp-set-connection-property p "remote-pid" pid)) - ;; Disable carriage return to newline translation. - (when (memq connection-type '(nil pipe)) + ;; Disable carriage return to newline + ;; translation. This does not work on + ;; macOS, see Bug#50748. + (when (and (memq connection-type '(nil pipe)) + (not (tramp-check-remote-uname v "Darwin"))) (tramp-send-command v "stty -icrnl")) ;; `tramp-maybe-open-connection' and ;; `tramp-send-command-and-read' could have @@ -2963,7 +2968,7 @@ implementation will be used." (ignore-errors (set-process-query-on-exit-flag p (null noquery)) (set-marker (process-mark p) (point))) - ;; Kill stderr process delete and named pipe. + ;; Kill stderr process and delete named pipe. (when (bufferp stderr) (add-function :after (process-sentinel p) @@ -4004,10 +4009,7 @@ This function expects to be in the right *tramp* buffer." ;; number of words it returns. "SunOS 5.10" (and maybe "SunOS ;; 5.11") have problems with this command, we disable the call ;; therefore. - (unless (or ignore-path - (string-match-p - tramp-sunos-unames - (tramp-get-connection-property vec "uname" ""))) + (unless (or ignore-path (tramp-check-remote-uname vec tramp-sunos-unames)) (tramp-send-command vec (format "which \\%s | wc -w" progname)) (goto-char (point-min)) (if (looking-at-p "^\\s-*1$") @@ -4217,9 +4219,7 @@ file exists and nonzero exit status otherwise." ;; The default shell (ksh93) of OpenSolaris ;; and Solaris is buggy. We've got reports ;; for "SunOS 5.10" and "SunOS 5.11" so far. - (string-match-p - tramp-sunos-unames - (tramp-get-connection-property vec "uname" ""))) + (tramp-check-remote-uname vec tramp-sunos-unames)) (or (tramp-find-executable vec "bash" (tramp-get-remote-path vec) t t) @@ -5336,6 +5336,10 @@ Return ATTR." ;; Variables local to connection. +(defun tramp-check-remote-uname (vec regexp) + "Check whether REGEXP matches the connection property \"uname\"." + (string-match-p regexp (tramp-get-connection-property vec "uname" ""))) + (defun tramp-get-remote-path (vec) "Compile list of remote directories for PATH. Nonexistent directories are removed from spec." @@ -5560,8 +5564,7 @@ Nonexistent directories are removed from spec." (with-tramp-connection-property vec "stat" ;; stat on Solaris is buggy. We've got reports for "SunOS 5.10" ;; and "SunOS 5.11" so far. - (unless (string-match-p - tramp-sunos-unames (tramp-get-connection-property vec "uname" "")) + (unless (tramp-check-remote-uname vec tramp-sunos-unames) (tramp-message vec 5 "Finding a suitable `stat' command") (let ((result (tramp-find-executable vec "stat" (tramp-get-remote-path vec))) @@ -5796,6 +5799,23 @@ This command is returned only if `delete-by-moving-to-trash' is non-nil." (tramp-file-local-name tmpfile) (tramp-file-local-name tmpfile))) (delete-file tmpfile))))) +(defun tramp-get-remote-mknod-or-mkfifo (vec) + "Determine remote `mknod' or `mkfifo' command." + (with-tramp-connection-property vec "mknod-or-mkfifo" + (tramp-message vec 5 "Finding a suitable `mknod' or `mkfifo' command") + (let ((tmpfile (tramp-make-tramp-temp-name vec)) + command) + (prog1 + (or (and (setq command "mknod %s p") + (tramp-send-command-and-check + vec (format command (tramp-file-local-name tmpfile))) + command) + (and (setq command "mkfifo %s") + (tramp-send-command-and-check + vec (format command (tramp-file-local-name tmpfile))) + command)) + (delete-file tmpfile))))) + ;; Some predefined connection properties. (defun tramp-get-inline-compress (vec prop size) "Return the compress command related to PROP. diff --git a/tramp.el b/tramp.el index efa28e7..c883935 100644 --- a/tramp.el +++ b/tramp.el @@ -183,7 +183,7 @@ See the variable `tramp-encoding-shell' for more information." :version "24.1" :type '(choice (const nil) string)) -;; Since Emacs 26.1, `system-name' can return `nil' at build time if +;; Since Emacs 26.1, `system-name' can return nil at build time if ;; Emacs is compiled with "--no-build-details". We do expect it to be ;; a string. (Bug#44481) (defconst tramp-system-name (or (system-name) "") @@ -5463,8 +5463,8 @@ this file, if that variable is non-nil." ;; Create directory. (unless (or (null tramp-auto-save-directory) (file-exists-p tramp-auto-save-directory)) - (make-directory tramp-auto-save-directory t) - (set-file-modes tramp-auto-save-directory #o0700)) + (with-file-modes #o0700 + (make-directory tramp-auto-save-directory t))) (let ((system-type (if (and (stringp tramp-auto-save-directory) diff --git a/trampver.el b/trampver.el index 1c3acf2..299a49b 100644 --- a/trampver.el +++ b/trampver.el @@ -7,7 +7,7 @@ ;; Maintainer: Michael Albinus <michael.albi...@gmx.de> ;; Keywords: comm, processes ;; Package: tramp -;; Version: 2.5.1.2 +;; Version: 2.5.1.3 ;; Package-Requires: ((emacs "25.1")) ;; Package-Type: multi ;; URL: https://www.gnu.org/software/tramp/ @@ -40,7 +40,7 @@ ;; ./configure" to change them. ;;;###tramp-autoload -(defconst tramp-version "2.5.1.2" +(defconst tramp-version "2.5.1.3" "This version of Tramp.") ;;;###tramp-autoload @@ -76,7 +76,7 @@ ;; Check for Emacs version. (let ((x (if (not (string-lessp emacs-version "25.1")) "ok" - (format "Tramp 2.5.1.2 is not fit for %s" + (format "Tramp 2.5.1.3 is not fit for %s" (replace-regexp-in-string "\n" "" (emacs-version)))))) (unless (string-equal "ok" x) (error "%s" x)))