[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tramp 269f93e: Tramp ELPA version 2.4.4.2 released
From: |
Michael Albinus |
Subject: |
[elpa] externals/tramp 269f93e: Tramp ELPA version 2.4.4.2 released |
Date: |
Sat, 29 Aug 2020 06:34:35 -0400 (EDT) |
branch: externals/tramp
commit 269f93e88c2d53d5f6c51834fb6cfd8a40b65777
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Tramp ELPA version 2.4.4.2 released
---
test/tramp-tests.el | 24 +++++++++-----
texi/trampver.texi | 2 +-
tramp-adb.el | 31 +++++++++++++++++-
tramp-loaddefs.el | 2 +-
tramp-sh.el | 94 +++++++++++++++++++++++++++++++++++++++++++++--------
tramp-smb.el | 2 +-
tramp.el | 19 +----------
tramp.info | 4 +--
trampver.el | 4 +--
9 files changed, 135 insertions(+), 47 deletions(-)
diff --git a/test/tramp-tests.el b/test/tramp-tests.el
index 9c6b3b2..e4def7e 100644
--- a/test/tramp-tests.el
+++ b/test/tramp-tests.el
@@ -2120,16 +2120,19 @@ properly. BODY shall not contain a timeout."
(expand-file-name "/method:host:/path/../file") "/method:host:/file"))
(should
(string-equal
- (expand-file-name "/method:host:/path/.") "/method:host:/path"))
+ (expand-file-name "/method:host:/path/.")
+ (if (tramp--test-emacs28-p) "/method:host:/path/" "/method:host:/path")))
(should
(string-equal
(expand-file-name "/method:host:/path/..") "/method:host:/"))
(should
(string-equal
- (expand-file-name "." "/method:host:/path/") "/method:host:/path"))
+ (expand-file-name "." "/method:host:/path/")
+ (if (tramp--test-emacs28-p) "/method:host:/path/" "/method:host:/path")))
(should
(string-equal
- (expand-file-name "" "/method:host:/path/") "/method:host:/path"))
+ (expand-file-name "" "/method:host:/path/")
+ (if (tramp--test-emacs28-p) "/method:host:/path/" "/method:host:/path")))
;; Quoting local part.
(should
(string-equal
@@ -2145,11 +2148,10 @@ properly. BODY shall not contain a timeout."
;; The following test is inspired by Bug#26911 and Bug#34834. They
;; are rather bugs in `expand-file-name', and it fails for all Emacs
-;; versions. Test added for later, when they are fixed.
+;; versions prior 28.1. Test added for later, when they are fixed.
(ert-deftest tramp-test05-expand-file-name-relative ()
"Check `expand-file-name'."
- ;; Mark as failed until bug has been fixed.
- :expected-result :failed
+ :expected-result (if (>= emacs-major-version 28) :passed :failed)
(skip-unless (tramp--test-enabled))
;; These are the methods the test doesn't fail.
@@ -4169,8 +4171,8 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
;; there's an indication for a signal describing string.
(let ((process-file-return-signal-string t))
(should
- (string-equal
- "Interrupt"
+ (string-match
+ "Interrupt\\|Signal 2"
(process-file
(if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")
nil nil nil "-c" "kill -2 $$"))))
@@ -5508,6 +5510,12 @@ 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-emacs28-p ()
+ "Check for Emacs version >= 28.1.
+Some semantics has been changed for there, w/o new functions or
+variables, so we check the Emacs version directly."
+ (>= emacs-major-version 28))
+
(defun tramp--test-adb-p ()
"Check, whether the remote host runs Android.
This requires restrictions of file name syntax."
diff --git a/texi/trampver.texi b/texi/trampver.texi
index 73c76d6..9a3d5e4 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.4.4.1
+@set trampver 2.4.4.2
@set tramp-bug-report-address tramp-devel@@gnu.org
@set emacsver 24.4
diff --git a/tramp-adb.el b/tramp-adb.el
index 0a1c34a..0efe055 100644
--- a/tramp-adb.el
+++ b/tramp-adb.el
@@ -35,6 +35,8 @@
(require 'tramp)
+(defvar process-file-return-signal-string)
+
;;;###tramp-autoload
(defcustom tramp-adb-program "adb"
"Name of the Android Debug Bridge program."
@@ -829,6 +831,33 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are
completely ignored."
filename newname ok-if-already-exists 'keep-time 'preserve-uid-gid)
(delete-file filename)))))))
+(defun tramp-adb-get-signal-strings (vec)
+ "Strings to return by `process-file' in case of signals."
+ (with-tramp-connection-property vec "signal-strings"
+ (let ((default-directory (tramp-make-tramp-file-name vec 'localname))
+ ;; `shell-file-name' and `shell-command-switch' are needed
+ ;; for Emacs < 27.1, which doesn't support connection-local
+ ;; variables in `shell-command'.
+ (shell-file-name "/system/bin/sh")
+ (shell-command-switch "-c")
+ process-file-return-signal-string signals result)
+ (dotimes (i 128) (push (format "Signal %d" i) result))
+ (setq result (reverse result)
+ signals (split-string
+ (shell-command-to-string "COLUMNS=40 kill -l") "\n" 'omit))
+ (setcar result 0)
+ (dolist (line signals)
+ (when (string-match
+ (concat
+ "^[[:space:]]*\\([[:digit:]]+\\)"
+ "[[:space:]]+\\S-+[[:space:]]+"
+ "\\([[:alpha:]].*\\)$")
+ line)
+ (setcar
+ (nthcdr (string-to-number (match-string 1 line)) result)
+ (match-string 2 line))))
+ result)))
+
(defun tramp-adb-handle-process-file
(program &optional infile destination display &rest args)
"Like `process-file' for Tramp files."
@@ -921,7 +950,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are
completely ignored."
;; since Emacs 28.1.
(when (and (bound-and-true-p process-file-return-signal-string)
(natnump ret) (> ret 128))
- (setq ret (nth (- ret 128) (tramp-get-signal-strings))))
+ (setq ret (nth (- ret 128) (tramp-adb-get-signal-strings v))))
;; Provide error file.
(when tmpstderr (rename-file tmpstderr (cadr destination) t))
diff --git a/tramp-loaddefs.el b/tramp-loaddefs.el
index 5d2e218..33ee286 100644
--- a/tramp-loaddefs.el
+++ b/tramp-loaddefs.el
@@ -663,7 +663,7 @@ UU-encode the region between BEG and END.
;;;### (autoloads nil "trampver" "trampver.el" (0 0 0 0))
;;; Generated autoloads from trampver.el
-(defconst tramp-version "2.4.4.1" "\
+(defconst tramp-version "2.4.4.2" "\
This version of Tramp.")
(defconst tramp-bug-report-address "tramp-devel@gnu.org" "\
diff --git a/tramp-sh.el b/tramp-sh.el
index e9e8065..9e8a316 100644
--- a/tramp-sh.el
+++ b/tramp-sh.el
@@ -36,6 +36,7 @@
(declare-function dired-remove-file "dired-aux")
(defvar dired-compress-file-suffixes)
+(defvar process-file-return-signal-string)
(defvar vc-handled-backends)
(defvar vc-bzr-program)
(defvar vc-git-program)
@@ -3023,6 +3024,65 @@ STDERR can also be a file name."
(tramp-flush-connection-property v "process-name")
(tramp-flush-connection-property v "process-buffer"))))))))
+(defun tramp-sh-get-signal-strings (vec)
+ "Strings to return by `process-file' in case of signals."
+ (with-tramp-connection-property
+ vec
+ (concat
+ "signal-strings-" (tramp-get-method-parameter vec 'tramp-remote-shell))
+ (let ((default-directory (tramp-make-tramp-file-name vec 'localname))
+ process-file-return-signal-string signals res result)
+ (setq signals
+ (append
+ '(0) (split-string (shell-command-to-string "kill -l") nil 'omit)))
+ ;; Sanity check. Sometimes, the first entry is "0", although we
+ ;; don't expect it. Remove it.
+ (when (and (stringp (cadr signals)) (string-equal "0" (cadr signals)))
+ (setcdr signals (cddr signals)))
+ ;; Sanity check. "kill -l" shall have returned just the signal
+ ;; names. Some shells don't, like the one in "docker alpine".
+ (let (signal-hook-function)
+ (condition-case nil
+ (dolist (sig (cdr signals))
+ (unless (string-match-p "^[[:alnum:]+-]+$" sig)
+ (error nil)))
+ (error (setq signals '(0)))))
+ (dotimes (i 128)
+ (push
+ (cond
+ ;; Some predefined values, which aren't reported sometimes,
+ ;; or would raise problems (all Stopped signals).
+ ((= i 0) 0)
+ ((string-equal (nth i signals) "HUP") "Hangup")
+ ((string-equal (nth i signals) "INT") "Interrupt")
+ ((string-equal (nth i signals) "QUIT") "Quit")
+ ((string-equal (nth i signals) "STOP") "Stopped (signal)")
+ ((string-equal (nth i signals) "TSTP") "Stopped")
+ ((string-equal (nth i signals) "TTIN") "Stopped (tty input)")
+ ((string-equal (nth i signals) "TTOU") "Stopped (tty output)")
+ (t (setq res
+ (if (null (nth i signals))
+ ""
+ (tramp-send-command
+ vec
+ (format
+ "%s %s %s"
+ (tramp-get-method-parameter vec 'tramp-remote-shell)
+ (mapconcat
+ #'identity
+ (tramp-get-method-parameter vec
'tramp-remote-shell-args)
+ " ")
+ (tramp-shell-quote-argument (format "kill -%d $$" i))))
+ (with-current-buffer (tramp-get-connection-buffer vec)
+ (goto-char (point-min))
+ (buffer-substring (point-at-bol) (point-at-eol)))))
+ (if (string-equal res "")
+ (format "Signal %d" i)
+ res)))
+ result))
+ ;; Due to Bug#41287, we cannot add this to the `dotimes' clause.
+ (reverse result))))
+
(defun tramp-sh-handle-process-file
(program &optional infile destination display &rest args)
"Like `process-file' for Tramp files."
@@ -3135,7 +3195,7 @@ STDERR can also be a file name."
;; since Emacs 28.1.
(when (and (bound-and-true-p process-file-return-signal-string)
(natnump ret) (>= ret 128))
- (setq ret (nth (- ret 128) (tramp-get-signal-strings))))
+ (setq ret (nth (- ret 128) (tramp-sh-get-signal-strings v))))
;; Provide error file.
(when tmpstderr (rename-file tmpstderr (cadr destination) t))
@@ -4017,22 +4077,30 @@ whether it exists and if so, it is added to the
environment
variable PATH."
(let ((command
(format
- "PATH=%s; export PATH" (string-join (tramp-get-remote-path vec) ":")))
+ "PATH=%s && export PATH" (string-join (tramp-get-remote-path vec)
":")))
(pipe-buf
- (or (with-tramp-connection-property vec "pipe-buf"
- (tramp-send-command-and-read
- vec "getconf PIPE_BUF / 2>/dev/null || echo nil" 'noerror))
- 4096))
- tmpfile)
+ (with-tramp-connection-property vec "pipe-buf"
+ (tramp-send-command-and-read
+ vec "getconf PIPE_BUF / 2>/dev/null || echo 4096" 'noerror)))
+ tmpfile chunk chunksize)
(tramp-message vec 5 "Setting $PATH environment variable")
(if (< (length command) pipe-buf)
(tramp-send-command vec command)
- ;; Use a temporary file.
- (setq tmpfile
- (tramp-make-tramp-file-name vec (tramp-make-tramp-temp-file vec)))
- (write-region command nil tmpfile)
- (tramp-send-command vec (format ". %s" (tramp-file-local-name tmpfile)))
- (delete-file tmpfile))))
+ ;; Use a temporary file. We cannot use `write-region' because
+ ;; setting the remote path happens in the early connection
+ ;; handshake, and not all external tools are determined yet.
+ (setq command (concat command "\n")
+ tmpfile (tramp-make-tramp-temp-file vec))
+ (while (not (string-empty-p command))
+ (setq chunksize (min (length command) (/ pipe-buf 2))
+ chunk (substring command 0 chunksize)
+ command (substring command chunksize))
+ (tramp-send-command vec (format
+ "echo -n %s >>%s"
+ (tramp-shell-quote-argument chunk)
+ (tramp-shell-quote-argument tmpfile))))
+ (tramp-send-command vec (format ". %s" tmpfile))
+ (tramp-send-command vec (format "rm -f %s" tmpfile)))))
;; ------------------------------------------------------------
;; -- Communication with external shell --
diff --git a/tramp-smb.el b/tramp-smb.el
index 0b3d57d..902fcf4 100644
--- a/tramp-smb.el
+++ b/tramp-smb.el
@@ -90,7 +90,7 @@ For example, if the deprecated SMB1 protocol shall be used,
add to
this variable (\"client min protocol=NT1\") ."
:group 'tramp
:type '(repeat string)
- :version "28.1")
+ :version "27.2")
(defvar tramp-smb-version nil
"Version string of the SMB client.")
diff --git a/tramp.el b/tramp.el
index 495c40f..bf88690 100644
--- a/tramp.el
+++ b/tramp.el
@@ -7,7 +7,7 @@
;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; Package: tramp
-;; Version: 2.4.4.1
+;; Version: 2.4.4.2
;; Package-Requires: ((emacs "24.4"))
;; Package-Type: multi
;; URL: https://savannah.gnu.org/projects/tramp
@@ -5048,23 +5048,6 @@ name of a process or buffer, or nil to default to the
current buffer."
(lambda ()
(remove-hook 'interrupt-process-functions #'tramp-interrupt-process))))
-(defun tramp-get-signal-strings ()
- "Strings to return by `process-file' in case of signals."
- ;; We use key nil for local connection properties.
- (with-tramp-connection-property nil "signal-strings"
- (let (result)
- (if (and (stringp shell-file-name) (executable-find shell-file-name))
- (dotimes (i 128)
- (push
- (if (= i 19) 1 ;; SIGSTOP
- (call-process
- shell-file-name nil nil nil "-c" (format "kill -%d $$" i)))
- result))
- (dotimes (i 128)
- (push (format "Signal %d" i) result)))
- ;; Due to Bug#41287, we cannot add this to the `dotimes' clause.
- (reverse result))))
-
;; Checklist for `tramp-unload-hook'
;; - Unload all `tramp-*' packages
;; - Reset `file-name-handler-alist'
diff --git a/tramp.info b/tramp.info
index c78cec0..dcfc3ef 100644
--- a/tramp.info
+++ b/tramp.info
@@ -21,10 +21,10 @@ END-INFO-DIR-ENTRY
File: tramp.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
-TRAMP 2.4.4.1 User Manual
+TRAMP 2.4.4.2 User Manual
*************************
-This file documents TRAMP 2.4.4.1, a remote file editing package for
+This file documents TRAMP 2.4.4.2, a remote file editing package for
Emacs.
TRAMP stands for “Transparent Remote (file) Access, Multiple
diff --git a/trampver.el b/trampver.el
index 3514f62..0af9c11 100644
--- a/trampver.el
+++ b/trampver.el
@@ -39,7 +39,7 @@
(defvar inhibit-message)
;;;###tramp-autoload
-(defconst tramp-version "2.4.4.1"
+(defconst tramp-version "2.4.4.2"
"This version of Tramp.")
;;;###tramp-autoload
@@ -75,7 +75,7 @@
;; Check for Emacs version.
(let ((x (if (not (string-lessp emacs-version "24.4"))
"ok"
- (format "Tramp 2.4.4.1 is not fit for %s"
+ (format "Tramp 2.4.4.2 is not fit for %s"
(replace-regexp-in-string "\n" "" (emacs-version))))))
(unless (string-equal "ok" x) (error "%s" x)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/tramp 269f93e: Tramp ELPA version 2.4.4.2 released,
Michael Albinus <=