[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master e6476c9: Improve backward compatibility of Tramp
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master e6476c9: Improve backward compatibility of Tramp |
Date: |
Fri, 22 Jun 2018 10:17:26 -0400 (EDT) |
branch: master
commit e6476c914ebd60971708e0ea0a292e1616d928fd
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Improve backward compatibility of Tramp
* lisp/net/tramp-adb.el (tramp-adb-handle-exec-path):
* lisp/net/tramp-sh.el (tramp-sh-handle-exec-path): Use ´file-remote-p'.
(tramp-get-ls-command-with): Handle busybox specially.
* test/lisp/net/tramp-tests.el (tramp-test34-exec-path): Check for
`fboundp'. Use `file-remote-p'. Hide compiler warning for older
Emacsen.
---
lisp/net/tramp-adb.el | 2 +-
lisp/net/tramp-sh.el | 27 ++++++++++++++++-----------
test/lisp/net/tramp-tests.el | 20 ++++++++++++--------
3 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 7cb61ad..297bdd7 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1130,7 +1130,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are
completely ignored."
(read (current-buffer)))
":" 'omit)))
;; The equivalent to `exec-directory'.
- `(,(file-local-name default-directory))))
+ `(,(file-remote-p default-directory 'localname))))
(defun tramp-adb-get-device (vec)
"Return full host name from VEC to be used in shell execution.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 0b3c123..26bf3cd 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3089,7 +3089,7 @@ the result will be a local, non-Tramp, file name."
(append
(tramp-get-remote-path (tramp-dissect-file-name default-directory))
;; The equivalent to `exec-directory'.
- `(,(file-local-name default-directory))))
+ `(,(file-remote-p default-directory 'localname))))
(defun tramp-sh-handle-file-local-copy (filename)
"Like `file-local-copy' for Tramp files."
@@ -5349,16 +5349,21 @@ Nonexistent directories are removed from spec."
(defun tramp-get-ls-command-with (vec option)
"Return OPTION, if the remote `ls' command supports the OPTION option."
- (save-match-data
- (with-tramp-connection-property vec (concat "ls" option)
- (tramp-message vec 5 "Checking, whether `ls %s' works" option)
- ;; Some "ls" versions are sensible wrt the order of arguments,
- ;; they fail when "-al" is after the "--dired" argument (for
- ;; example on FreeBSD).
- (and
- (tramp-send-command-and-check
- vec (format "%s %s -al /dev/null" (tramp-get-ls-command vec) option))
- option))))
+ (with-tramp-connection-property vec (concat "ls" option)
+ (tramp-message vec 5 "Checking, whether `ls %s' works" option)
+ ;; Some "ls" versions are sensible wrt the order of arguments,
+ ;; they fail when "-al" is after the "--dired" argument (for
+ ;; example on FreeBSD). Busybox does not support this kind of
+ ;; options.
+ (and
+ (not
+ (tramp-send-command-and-check
+ vec
+ (format
+ "%s ls --help 2>&1 | grep -iq busybox" (tramp-get-ls-command vec))))
+ (tramp-send-command-and-check
+ vec (format "%s %s -al /dev/null" (tramp-get-ls-command vec) option))
+ option)))
(defun tramp-get-test-command (vec)
"Determine remote `test' command."
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index df07a8f..f2d9b0a 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -4021,13 +4021,15 @@ This tests also `make-symbolic-link', `file-truename'
and `add-name-to-file'."
(put 'explicit-shell-file-name 'permanent-local nil)
(kill-buffer "*shell*"))))
-;; The function was introduced in Emacs 27.1.
+;; `exec-path' was introduced in Emacs 27.1. `executable-find' has
+;; changed the number of parameters, so we use `apply' for older
+;; Emacsen.
(ert-deftest tramp-test34-exec-path ()
"Check `exec-path' and `executable-find'."
(skip-unless (tramp--test-enabled))
(skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
;; Since Emacs 27.1.
- (skip-unless (boundp 'exec-path))
+ (skip-unless (fboundp 'exec-path))
(let ((tmp-name (tramp--test-make-temp-name))
(default-directory tramp-test-temporary-file-directory))
@@ -4038,9 +4040,9 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(should
(string-equal
(car (last (with-no-warnings (exec-path))))
- (file-local-name default-directory)))
+ (file-remote-p default-directory 'localname)))
;; The shell "sh" shall always exist.
- (should (executable-find "sh" 'remote))
+ (should (apply 'executable-find '("sh" remote)))
;; Since the last element in `exec-path' is the current
;; directory, an executable file in that directory will be
;; found.
@@ -4050,11 +4052,13 @@ This tests also `make-symbolic-link', `file-truename'
and `add-name-to-file'."
(should (file-executable-p tmp-name))
(should
(string-equal
- (executable-find (file-name-nondirectory tmp-name) 'remote)
- (file-local-name tmp-name)))
+ (apply
+ 'executable-find `(,(file-name-nondirectory tmp-name) remote))
+ (file-remote-p tmp-name 'localname)))
(should-not
- (executable-find
- (concat (file-name-nondirectory tmp-name) "foo") 'remote)))
+ (apply
+ 'executable-find
+ `(,(concat (file-name-nondirectory tmp-name) "foo") remote))))
;; Cleanup.
(ignore-errors (delete-file tmp-name)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master e6476c9: Improve backward compatibility of Tramp,
Michael Albinus <=