From 658952a57a48c3cd80d62fcf0199ab9432ef8166 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 11 Nov 2020 13:24:50 +0100 Subject: [PATCH] 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. --- lisp/net/tramp-adb.el | 2 +- lisp/net/tramp-gvfs.el | 5 ++++- lisp/net/tramp-rclone.el | 2 +- lisp/net/tramp-sh.el | 2 +- lisp/net/tramp-smb.el | 2 +- lisp/net/tramp.el | 5 +++-- test/lisp/net/tramp-tests.el | 23 ++++++++++++----------- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 0efe055b084..2f20c8d93e5 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -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 diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index ddb535fea6e..e369061664a 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -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 diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index fcbd2010a26..1567a24e272 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -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 diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index df6720b99b7..4dca040aebb 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -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) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 902fcf4b6e3..b76308ac441 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -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 diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e7432f2aa09..08bc0ffdd7d 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -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) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index cc9ccefb0df..cc65421619d 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -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)) -- 2.39.2