Some minor changes to Tramp, do not merge with master

* lisp/net/tramp.el (tramp-handle-directory-files)
(tramp-handle-directory-files-and-attributes):
* lisp/net/tramp-adb.el
(tramp-adb-handle-directory-files-and-attributes):
* lisp/net/tramp-rclone.el (tramp-rclone-handle-directory-files):
* lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes):
* lisp/net/tramp-smb.el (tramp-smb-handle-directory-files): Add _COUNT.
Make the functions forward compatible.

* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled):
Increase `max-specpdl-size' temporarily.

* test/lisp/net/tramp-tests.el (tramp--test-share-p): New defun.
(tramp-test05-expand-file-name-relative): Use it.
This commit is contained in:
Michael Albinus 2020-11-11 13:24:50 +01:00
parent ac1a2b2160
commit 658952a57a
7 changed files with 23 additions and 18 deletions

View file

@ -383,7 +383,7 @@ ARGUMENTS to pass to the OPERATION."
file-properties)))
(defun tramp-adb-handle-directory-files-and-attributes
(directory &optional full match nosort id-format)
(directory &optional full match nosort id-format _count)
"Like `directory-files-and-attributes' for Tramp files."
(unless (file-exists-p directory)
(tramp-error

View file

@ -2091,7 +2091,10 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
;; Add completion functions for AFP, DAV, DAVS, SFTP and SMB methods.
(when tramp-gvfs-enabled
;; Suppress D-Bus error messages.
(let (tramp-gvfs-dbus-event-vector)
(let (tramp-gvfs-dbus-event-vector
;; Sometimes, it fails with "Variable binding depth exceeds
;; max-specpdl-size". Shall be fixed in Emacs 27.
(max-specpdl-size (* 2 max-specpdl-size)))
(zeroconf-init tramp-gvfs-zeroconf-domain)
(if (zeroconf-list-service-types)
(progn

View file

@ -300,7 +300,7 @@ file names."
(tramp-rclone-flush-directory-cache v)))
(defun tramp-rclone-handle-directory-files
(directory &optional full match nosort)
(directory &optional full match nosort _count)
"Like `directory-files' for Tramp files."
(unless (file-exists-p directory)
(tramp-error

View file

@ -1721,7 +1721,7 @@ of."
;; Directory listings.
(defun tramp-sh-handle-directory-files-and-attributes
(directory &optional full match nosort id-format)
(directory &optional full match nosort id-format _count)
"Like `directory-files-and-attributes' for Tramp files."
(unless id-format (setq id-format 'integer))
(unless (file-exists-p directory)

View file

@ -695,7 +695,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
v 'file-error "%s `%s'" (match-string 0) filename))))))
(defun tramp-smb-handle-directory-files
(directory &optional full match nosort)
(directory &optional full match nosort _count)
"Like `directory-files' for Tramp files."
(unless (file-exists-p directory)
(tramp-error

View file

@ -3102,7 +3102,8 @@ User is always nil."
(setq directory (substring directory 0 -1)))
directory)
(defun tramp-handle-directory-files (directory &optional full match nosort)
(defun tramp-handle-directory-files
(directory &optional full match nosort _count)
"Like `directory-files' for Tramp files."
(unless (file-exists-p directory)
(tramp-error
@ -3121,7 +3122,7 @@ User is always nil."
(if nosort result (sort result #'string<)))))
(defun tramp-handle-directory-files-and-attributes
(directory &optional full match nosort id-format)
(directory &optional full match nosort id-format _count)
"Like `directory-files-and-attributes' for Tramp files."
(mapcar
(lambda (x)

View file

@ -2144,20 +2144,14 @@ properly. BODY shall not contain a timeout."
"/method:host:/:/~/path/file"))))
;; 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 prior 28.1. Test added for later, when they are fixed.
;; were bugs in `expand-file-name'.
(ert-deftest tramp-test05-expand-file-name-relative ()
"Check `expand-file-name'."
:expected-result (if (>= emacs-major-version 28) :passed :failed)
(skip-unless (tramp--test-enabled))
;; These are the methods the test doesn't fail.
(when (or (tramp--test-adb-p) (tramp--test-ange-ftp-p) (tramp--test-gvfs-p)
(tramp--test-rclone-p)
(tramp-smb-file-name-p tramp-test-temporary-file-directory))
(setf (ert-test-expected-result-type
(ert-get-test 'tramp-test05-expand-file-name-relative))
:passed))
;; The bugs are fixed in Emacs 28.1.
(skip-unless (tramp--test-emacs28-p))
;; Methods with a share do not expand "/path/..".
(skip-unless (not (tramp--test-share-p)))
(should
(string-equal
@ -5517,6 +5511,13 @@ This does not support special file names."
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
'tramp-sh-file-name-handler))
(defun tramp--test-share-p ()
"Check, whether the method needs a share."
(and (tramp--test-gvfs-p)
(string-match-p
"^\\(afp\\|davs?\\|smb\\)$"
(file-remote-p tramp-test-temporary-file-directory 'method))))
(defun tramp--test-sudoedit-p ()
"Check, whether the sudoedit method is used."
(tramp-sudoedit-file-name-p tramp-test-temporary-file-directory))