2017-12-09 14:34:30 +01:00
|
|
|
;;; tramp-archive-tests.el --- Tests of file archive access -*- lexical-binding:t -*-
|
|
|
|
|
2024-01-02 09:47:10 +08:00
|
|
|
;; Copyright (C) 2017-2024 Free Software Foundation, Inc.
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; Author: Michael Albinus <michael.albinus@gmx.de>
|
|
|
|
|
2020-10-28 03:41:55 +01:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or
|
2017-12-09 14:34:30 +01:00
|
|
|
;; modify it under the terms of the GNU General Public License as
|
|
|
|
;; published by the Free Software Foundation, either version 3 of the
|
|
|
|
;; License, or (at your option) any later version.
|
|
|
|
;;
|
2020-10-28 03:41:55 +01:00
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful, but
|
2017-12-09 14:34:30 +01:00
|
|
|
;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
;; General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2020-10-28 03:41:55 +01:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2017-12-09 14:34:30 +01:00
|
|
|
|
Adapt Tramp docstrings according to checkdoc
* lisp/net/tramp.el (tramp-backup-directory-alist)
(tramp-echoed-echo-mark-regexp, tramp-syntax-values)
(tramp-lookup-syntax, tramp-build-prefix-format)
(tramp-build-prefix-regexp, tramp-build-method-regexp)
(tramp-build-postfix-method-format)
(tramp-build-postfix-method-regexp)
(tramp-build-prefix-ipv6-format, tramp-build-prefix-ipv6-regexp)
(tramp-build-postfix-ipv6-format)
(tramp-build-postfix-ipv6-regexp)
(tramp-build-postfix-host-format)
(tramp-build-postfix-host-regexp, tramp-unknown-id-string)
(tramp-unknown-id-integer, tramp-build-file-name-regexp)
(tramp-build-completion-file-name-regexp, tramp-chunksize)
(tramp-find-method, tramp-find-user, tramp-find-host)
(tramp-dissect-file-name, tramp-get-buffer)
(tramp-get-connection-buffer, tramp-debug-message, tramp-error)
(with-tramp-connection-property, tramp-run-real-handler)
(tramp-file-name-for-operation, tramp-file-name-handler)
(tramp-completion-file-name-handler)
(tramp-completion-handle-file-name-completion)
(tramp-completion-dissect-file-name)
(tramp-completion-dissect-file-name1)
(tramp-handle-file-name-as-directory)
(tramp-handle-file-name-directory)
(tramp-handle-file-name-nondirectory, tramp-mode-string-to-int)
(tramp-file-mode-from-int):
* lisp/net/tramp-adb.el (tramp-adb-file-name-p):
* lisp/net/tramp-archive.el (tramp-archive-run-real-handler)
(tramp-archive-file-name-handler)
(tramp-archive-dissect-file-name)
(with-parsed-tramp-archive-file-name)
(tramp-archive-gvfs-file-name, tramp-archive-handle-access-file):
* lisp/net/tramp-cmds.el (tramp-list-remote-buffers):
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-compat-funcall, tramp-compat-tramp-file-name-slots):
* lisp/net/tramp-ftp.el (tramp-ftp-file-name-handler)
(tramp-ftp-file-name-p):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-p)
(tramp-gvfs-file-name-handler)
(tramp-gvfs-stringify-dbus-message)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-handler-mounted-unmounted):
* lisp/net/tramp-integration.el
(tramp-rfn-eshadow-update-overlay-regexp):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-p)
(tramp-rclone-file-name-handler, tramp-rclone-send-command):
* lisp/net/tramp-sh.el (tramp-sh--quoting-style-options)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-gvfs-monitor-dir-process-filter)
(tramp-sh-inotifywait-process-filter, tramp-find-executable)
(tramp-set-remote-path, tramp-open-shell, tramp-find-shell)
(tramp-send-command-and-check, tramp-shell-case-fold)
(tramp-get-remote-path):
* lisp/net/tramp-smb.el (tramp-smb-file-name-p)
(tramp-smb-file-name-handler)
(tramp-smb-do-file-attributes-with-stat)
(tramp-smb-handle-substitute-in-file-name)
(tramp-smb-get-stat-capability, tramp-smb-shell-quote-argument):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-p)
(tramp-sudoedit-file-name-handler)
(tramp-sudoedit-send-command-string):
* test/lisp/net/tramp-archive-tests.el (tramp-archive-test-all):
* test/lisp/net/tramp-tests.el (tramp--test-gvfs-p)
(tramp--test-with-proper-process-name-and-buffer)
(tramp-test-all): Adapt docstrings according to `checkdoc'.
2019-11-13 13:10:58 +01:00
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; A testsuite for testing file archives.
|
|
|
|
|
2017-12-09 14:34:30 +01:00
|
|
|
;;; Code:
|
|
|
|
|
2017-12-17 11:31:23 +01:00
|
|
|
;; The `tramp-archive-testnn-*' tests correspond to the respective
|
|
|
|
;; tests in tramp-tests.el.
|
|
|
|
|
2017-12-09 14:34:30 +01:00
|
|
|
(require 'ert)
|
2020-09-24 02:05:58 +02:00
|
|
|
(require 'ert-x)
|
2017-12-09 14:34:30 +01:00
|
|
|
(require 'tramp-archive)
|
Reduce autoloaded objects in Tramp
* lisp/net/tramp-adb.el (tramp-adb-program)
(tramp-adb-connect-if-not-connected, tramp-adb-prompt):
Remove autoload cookie.
* lisp/net/tramp-cache.el (tramp-connection-properties)
(tramp-persistency-file-name): Remove autoload cookie.
* lisp/net/tramp-ftp.el (tramp-ftp-enable-ange-ftp):
Use `tramp-autoload' cookie.
* lisp/net/tramp-gvfs.el (tramp-gvfs-zeroconf-domain):
Remove autoload cookie.
* lisp/net/tramp-rclone.el (tramp-rclone-program): Remove autoload
cookie.
(tramp-set-completion-function): Use `tramp--with-startup'.
* lisp/net/tramp-sh.el (tramp-inline-compress-start-size)
(tramp-copy-size-limit, tramp-histfile-override)
(tramp-use-ssh-controlmaster-options, tramp-remote-path)
(tramp-remote-process-environment, tramp-sh-extra-args):
Remove autoload cookie.
(tramp-stat-marker, tramp-stat-quoted-marker): Move to tramp.el.
* lisp/net/tramp-smb.el (tramp-smb-program)
(tramp-smb-acl-program, tramp-smb-conf)
(tramp-smb-winexe-program, tramp-smb-winexe-shell-command)
(tramp-smb-winexe-shell-command-switch): Remove autoload cookie.
* lisp/net/tramp-sudoedit.el (server, tramp-sh): Do not require.
* lisp/net/tramp.el (tramp--startup-hook): Define.
(tramp-stat-marker, tramp-stat-quoted-marker): New defconsts,
taken from tramp-sh.el.
* test/lisp/net/tramp-archive-tests.el (tramp-copy-size-limit)
(tramp-persistency-file-name): Declare.
* test/lisp/net/tramp-tests.el (tramp-connection-properties)
(tramp-display-escape-sequence-regexp)
(tramp-inline-compress-start-size, tramp-remote-path): Declare.
2018-12-17 11:50:06 +01:00
|
|
|
(defvar tramp-persistency-file-name)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
2020-10-16 16:51:25 +02:00
|
|
|
;; `ert-resource-file' was introduced in Emacs 28.1.
|
|
|
|
(unless (macrop 'ert-resource-file)
|
|
|
|
(eval-and-compile
|
|
|
|
(defvar ert-resource-directory-format "%s-resources/"
|
|
|
|
"Format for `ert-resource-directory'.")
|
|
|
|
(defvar ert-resource-directory-trim-left-regexp ""
|
|
|
|
"Regexp for `string-trim' (left) used by `ert-resource-directory'.")
|
Use `rx' in Tramp where possible
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-cache.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-compat.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-ftp.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Use `rx' where possible.
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
Use `eval-when-compile'.
(tramp-adb-maybe-open-connection): Use file-property for "/". Use
`eval-when-compile'.
* lisp/net/tramp-cmds.el (mm-7bit-chars): Declare.
(tramp-reporter-dump-variable): Simplify point movement.
* lisp/net/tramp-gvfs.el (tramp-dbus-function): Fix typo.
(tramp-zeroconf-parse-device-names): Use `tramp-prefix-port-format'.
* lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell):
Use `eval-when-compile'. Improve sanity check.
* lisp/net/tramp.el (tramp-prefix-format, tramp-prefix-regexp)
(tramp-method-regexp, tramp-postfix-method-format)
(tramp-postfix-method-regexp, tramp-prefix-ipv6-format)
(tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format)
(tramp-postfix-ipv6-regexp, tramp-postfix-host-format)
(tramp-postfix-host-regexp, tramp-remote-file-name-spec-regexp)
(tramp-file-name-structure, tramp-file-name-regexp)
(tramp-completion-method-regexp)
(tramp-completion-file-name-regexp): Declare.
(tramp-set-syntax): Set also `tramp-completion-method-regexp'.
(tramp-volume-letter-regexp, tramp-completion-method-regexp-alist):
New defconsts.
(tramp-build-completion-method-regexp): New defun.
(tramp-completion-method-regexp): New defvar.
(tramp-completion-file-name-regexp-default)
(tramp-completion-file-name-regexp-simplified)
(tramp-completion-file-name-regexp-separate)
(tramp-completion-file-name-regexp-alist): Remove.
(tramp-build-completion-file-name-regexp): Rwrite.
(tramp-make-tramp-file-name): Use `tramp-archive-method'.
(tramp-handle-file-directory-p): Ignore errors.
(tramp-handle-find-backup-file-name, tramp-handle-lock-file)
(tramp-handle-make-auto-save-file-name): Use `eval-when-compile'.
* test/lisp/net/tramp-archive-tests.el:
* test/lisp/net/tramp-tests.el: Use `rx' where possible.
(tramp-test01-file-name-syntax): Adapt test.
2022-08-26 16:19:47 +02:00
|
|
|
(defvar ert-resource-directory-trim-right-regexp
|
|
|
|
(rx (? "-test" (? "s")) ".el")
|
2020-10-16 16:51:25 +02:00
|
|
|
"Regexp for `string-trim' (right) used by `ert-resource-directory'.")
|
|
|
|
|
|
|
|
(defmacro ert-resource-directory ()
|
|
|
|
"Return absolute file name of the resource directory for this file.
|
|
|
|
|
|
|
|
The path to the resource directory is the \"resources\" directory
|
|
|
|
in the same directory as the test file.
|
|
|
|
|
|
|
|
If that directory doesn't exist, use the directory named like the
|
|
|
|
test file but formatted by `ert-resource-directory-format' and trimmed
|
|
|
|
using `string-trim' with arguments
|
|
|
|
`ert-resource-directory-trim-left-regexp' and
|
|
|
|
`ert-resource-directory-trim-right-regexp'. The default values mean
|
|
|
|
that if called from a test file named \"foo-tests.el\", return
|
|
|
|
the absolute file name for \"foo-resources\"."
|
|
|
|
`(let* ((testfile ,(or (bound-and-true-p byte-compile-current-file)
|
|
|
|
(and load-in-progress load-file-name)
|
|
|
|
buffer-file-name))
|
|
|
|
(default-directory (file-name-directory testfile)))
|
|
|
|
(file-truename
|
|
|
|
(if (file-accessible-directory-p "resources/")
|
|
|
|
(expand-file-name "resources/")
|
|
|
|
(expand-file-name
|
|
|
|
(format
|
|
|
|
ert-resource-directory-format
|
|
|
|
(string-trim testfile
|
|
|
|
ert-resource-directory-trim-left-regexp
|
|
|
|
ert-resource-directory-trim-right-regexp)))))))
|
|
|
|
|
|
|
|
(defmacro ert-resource-file (file)
|
|
|
|
"Return file name of resource file named FILE.
|
|
|
|
A resource file is in the resource directory as per
|
|
|
|
`ert-resource-directory'."
|
|
|
|
`(expand-file-name ,file (ert-resource-directory)))))
|
|
|
|
|
2024-02-07 11:13:56 -05:00
|
|
|
(defvar tramp-archive-test-file-archive (ert-resource-file "foo.tar.gz")
|
2017-12-09 14:34:30 +01:00
|
|
|
"The test file archive.")
|
|
|
|
|
2020-09-13 13:25:52 +02:00
|
|
|
(defun tramp-archive-test-file-archive-hexlified ()
|
|
|
|
"Return hexlified `tramp-archive-test-file-archive'.
|
|
|
|
Do not hexlify \"/\". This hexlified string is used in `file:///' URLs."
|
|
|
|
(let* ((url-unreserved-chars (cons ?/ url-unreserved-chars)))
|
|
|
|
(url-hexify-string tramp-archive-test-file-archive)))
|
|
|
|
|
2024-02-07 11:13:56 -05:00
|
|
|
(defvar tramp-archive-test-archive
|
2017-12-09 14:34:30 +01:00
|
|
|
(file-name-as-directory tramp-archive-test-file-archive)
|
|
|
|
"The test archive.")
|
|
|
|
|
2018-01-31 15:02:46 +01:00
|
|
|
(defconst tramp-archive-test-directory
|
2020-10-16 16:51:25 +02:00
|
|
|
(file-truename (ert-resource-file "foo.iso"))
|
2018-01-31 15:02:46 +01:00
|
|
|
"A directory file name, which looks like an archive.")
|
|
|
|
|
2017-12-09 14:34:30 +01:00
|
|
|
(setq password-cache-expiry nil
|
|
|
|
tramp-cache-read-persistent-data t ;; For auth-sources.
|
2019-12-01 12:25:15 +01:00
|
|
|
tramp-persistency-file-name nil
|
|
|
|
tramp-verbose 0)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(defun tramp-archive--test-make-temp-name ()
|
|
|
|
"Return a temporary file name for test.
|
|
|
|
The temporary file is not created."
|
|
|
|
(expand-file-name
|
|
|
|
(make-temp-name "tramp-archive-test") temporary-file-directory))
|
|
|
|
|
|
|
|
(defun tramp-archive--test-delete (tmpfile)
|
|
|
|
"Delete temporary file or directory TMPFILE.
|
|
|
|
This needs special support, because archive file names, which are
|
|
|
|
the origin of the temporary TMPFILE, have no write permissions."
|
|
|
|
(unless (file-writable-p (file-name-directory tmpfile))
|
|
|
|
(set-file-modes
|
|
|
|
(file-name-directory tmpfile)
|
|
|
|
(logior (file-modes (file-name-directory tmpfile)) #o0700)))
|
|
|
|
(set-file-modes tmpfile #o0700)
|
|
|
|
(if (file-regular-p tmpfile)
|
|
|
|
(delete-file tmpfile)
|
|
|
|
(mapc
|
2019-02-28 10:33:05 +01:00
|
|
|
#'tramp-archive--test-delete
|
2017-12-09 14:34:30 +01:00
|
|
|
(directory-files tmpfile 'full directory-files-no-dot-files-regexp))
|
|
|
|
(delete-directory tmpfile)))
|
|
|
|
|
2023-05-15 16:25:23 +02:00
|
|
|
(defun tramp-archive--test-emacs28-p ()
|
|
|
|
"Check for Emacs version >= 28.1.
|
|
|
|
Some semantics has been changed for there, without new functions or
|
|
|
|
variables, so we check the Emacs version directly."
|
|
|
|
(>= emacs-major-version 28))
|
|
|
|
|
2017-12-09 14:34:30 +01:00
|
|
|
(ert-deftest tramp-archive-test00-availability ()
|
2018-02-03 18:49:56 +01:00
|
|
|
"Test availability of archive file name functions."
|
|
|
|
:expected-result (if tramp-archive-enabled :passed :failed)
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
|
|
|
(and
|
2018-02-03 18:49:56 +01:00
|
|
|
tramp-archive-enabled
|
2017-12-09 14:34:30 +01:00
|
|
|
(file-exists-p tramp-archive-test-file-archive)
|
|
|
|
(tramp-archive-file-name-p tramp-archive-test-archive))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test01-file-name-syntax ()
|
|
|
|
"Check archive file name syntax."
|
|
|
|
(should-not (tramp-archive-file-name-p tramp-archive-test-file-archive))
|
|
|
|
(should (tramp-archive-file-name-p tramp-archive-test-archive))
|
2018-01-31 15:02:46 +01:00
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(tramp-archive-file-name-archive tramp-archive-test-archive)
|
|
|
|
tramp-archive-test-file-archive))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(tramp-archive-file-name-localname tramp-archive-test-archive) "/"))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should (tramp-archive-file-name-p (concat tramp-archive-test-archive "foo")))
|
2018-01-31 15:02:46 +01:00
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(tramp-archive-file-name-localname
|
|
|
|
(concat tramp-archive-test-archive "foo"))
|
|
|
|
"/foo"))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
|
|
|
(tramp-archive-file-name-p (concat tramp-archive-test-archive "foo/bar")))
|
2018-01-31 15:02:46 +01:00
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(tramp-archive-file-name-localname
|
|
|
|
(concat tramp-archive-test-archive "foo/bar"))
|
|
|
|
"/foo/bar"))
|
2017-12-09 14:34:30 +01:00
|
|
|
;; A file archive inside a file archive.
|
|
|
|
(should
|
2018-01-30 17:34:02 +01:00
|
|
|
(tramp-archive-file-name-p (concat tramp-archive-test-archive "baz.tar")))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
2018-01-31 15:02:46 +01:00
|
|
|
(string-equal
|
|
|
|
(tramp-archive-file-name-archive
|
|
|
|
(concat tramp-archive-test-archive "baz.tar"))
|
|
|
|
tramp-archive-test-file-archive))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(tramp-archive-file-name-localname
|
|
|
|
(concat tramp-archive-test-archive "baz.tar"))
|
|
|
|
"/baz.tar"))
|
|
|
|
(should
|
|
|
|
(tramp-archive-file-name-p (concat tramp-archive-test-archive "baz.tar/")))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(tramp-archive-file-name-archive
|
|
|
|
(concat tramp-archive-test-archive "baz.tar/"))
|
|
|
|
(concat tramp-archive-test-archive "baz.tar")))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(tramp-archive-file-name-localname
|
|
|
|
(concat tramp-archive-test-archive "baz.tar/"))
|
|
|
|
"/")))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test02-file-name-dissect ()
|
|
|
|
"Check archive file name components."
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
2019-06-04 12:51:45 +02:00
|
|
|
;; Suppress method name check.
|
|
|
|
(let ((non-essential t))
|
|
|
|
(with-parsed-tramp-archive-file-name tramp-archive-test-archive nil
|
|
|
|
(should (string-equal method tramp-archive-method))
|
|
|
|
(should-not user)
|
|
|
|
(should-not domain)
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
host
|
|
|
|
(file-remote-p
|
|
|
|
(tramp-archive-gvfs-file-name tramp-archive-test-archive) 'host)))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
host
|
2020-09-13 13:25:52 +02:00
|
|
|
(url-hexify-string
|
|
|
|
(concat "file://" (tramp-archive-test-file-archive-hexlified)))))
|
2019-06-04 12:51:45 +02:00
|
|
|
(should-not port)
|
|
|
|
(should (string-equal localname "/"))
|
|
|
|
(should (string-equal archive tramp-archive-test-file-archive)))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
2019-06-04 12:51:45 +02:00
|
|
|
;; Localname.
|
|
|
|
(with-parsed-tramp-archive-file-name
|
|
|
|
(concat tramp-archive-test-archive "foo") nil
|
|
|
|
(should (string-equal method tramp-archive-method))
|
|
|
|
(should-not user)
|
|
|
|
(should-not domain)
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
host
|
|
|
|
(file-remote-p
|
|
|
|
(tramp-archive-gvfs-file-name tramp-archive-test-archive) 'host)))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
host
|
2020-09-13 13:25:52 +02:00
|
|
|
(url-hexify-string
|
|
|
|
(concat "file://" (tramp-archive-test-file-archive-hexlified)))))
|
2019-06-04 12:51:45 +02:00
|
|
|
(should-not port)
|
|
|
|
(should (string-equal localname "/foo"))
|
|
|
|
(should (string-equal archive tramp-archive-test-file-archive)))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
2019-06-04 12:51:45 +02:00
|
|
|
;; File archive in file archive.
|
|
|
|
(let* ((tramp-archive-test-file-archive
|
|
|
|
(concat tramp-archive-test-archive "baz.tar"))
|
|
|
|
(tramp-archive-test-archive
|
|
|
|
(file-name-as-directory tramp-archive-test-file-archive))
|
|
|
|
(tramp-methods (cons `(,tramp-archive-method) tramp-methods))
|
|
|
|
(tramp-gvfs-methods tramp-archive-all-gvfs-methods))
|
|
|
|
(unwind-protect
|
|
|
|
(with-parsed-tramp-archive-file-name
|
|
|
|
(expand-file-name "bar" tramp-archive-test-archive) nil
|
|
|
|
(should (string-equal method tramp-archive-method))
|
|
|
|
(should-not user)
|
|
|
|
(should-not domain)
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
host
|
|
|
|
(file-remote-p
|
|
|
|
(tramp-archive-gvfs-file-name tramp-archive-test-archive)
|
|
|
|
'host)))
|
|
|
|
;; We reimplement the logic of tramp-archive.el here.
|
|
|
|
;; Don't know, whether it is worth the test.
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
host
|
|
|
|
(url-hexify-string
|
|
|
|
(concat
|
|
|
|
(tramp-gvfs-url-file-name
|
|
|
|
(tramp-make-tramp-file-name
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
(make-tramp-file-name
|
|
|
|
:method tramp-archive-method
|
|
|
|
:host
|
|
|
|
(url-hexify-string
|
|
|
|
(concat
|
|
|
|
"file://"
|
|
|
|
;; `directory-file-name' does not leave file
|
|
|
|
;; archive boundaries. So we must cut the
|
|
|
|
;; trailing slash ourselves.
|
|
|
|
(substring
|
|
|
|
(file-name-directory
|
|
|
|
(tramp-archive-test-file-archive-hexlified))
|
|
|
|
0 -1)))
|
|
|
|
:localname "/")))
|
2019-06-04 12:51:45 +02:00
|
|
|
(file-name-nondirectory tramp-archive-test-file-archive)))))
|
|
|
|
(should-not port)
|
|
|
|
(should (string-equal localname "/bar"))
|
|
|
|
(should (string-equal archive tramp-archive-test-file-archive)))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
2019-06-04 12:51:45 +02:00
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash)))))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test05-expand-file-name ()
|
|
|
|
"Check `expand-file-name'."
|
|
|
|
(should
|
|
|
|
(string-equal
|
2021-06-20 17:50:52 +02:00
|
|
|
(expand-file-name (concat tramp-archive-test-archive "path/./file"))
|
|
|
|
(concat tramp-archive-test-archive "path/file")))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
2021-06-20 17:50:52 +02:00
|
|
|
(string-equal
|
|
|
|
(expand-file-name (concat tramp-archive-test-archive "path/../file"))
|
|
|
|
(concat tramp-archive-test-archive "file")))
|
2017-12-09 14:34:30 +01:00
|
|
|
;; `expand-file-name' does not care "~/" in archive file names.
|
|
|
|
(should
|
2021-06-20 17:50:52 +02:00
|
|
|
(string-equal
|
|
|
|
(expand-file-name (concat tramp-archive-test-archive "~/file"))
|
|
|
|
(concat tramp-archive-test-archive "~/file")))
|
2017-12-09 14:34:30 +01:00
|
|
|
;; `expand-file-name' does not care file archive boundaries.
|
2021-06-20 17:50:52 +02:00
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(expand-file-name (concat tramp-archive-test-archive "./file"))
|
|
|
|
(concat tramp-archive-test-archive "file")))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(expand-file-name (concat tramp-archive-test-archive "../file"))
|
|
|
|
(concat (ert-resource-directory) "file"))))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
2018-01-31 15:02:46 +01:00
|
|
|
;; This test is inspired by Bug#30293.
|
|
|
|
(ert-deftest tramp-archive-test05-expand-file-name-non-archive-directory ()
|
|
|
|
"Check existing directories with archive file name syntax.
|
|
|
|
They shall still be supported"
|
|
|
|
(should (file-directory-p tramp-archive-test-directory))
|
|
|
|
;; `tramp-archive-file-name-p' tests only for file name syntax. It
|
|
|
|
;; doesn't test, whether it is really a file archive.
|
|
|
|
(should
|
|
|
|
(tramp-archive-file-name-p
|
|
|
|
(file-name-as-directory tramp-archive-test-directory)))
|
|
|
|
(should
|
|
|
|
(file-directory-p (file-name-as-directory tramp-archive-test-directory)))
|
|
|
|
(should
|
|
|
|
(file-exists-p (expand-file-name "foo" tramp-archive-test-directory))))
|
|
|
|
|
2017-12-09 14:34:30 +01:00
|
|
|
(ert-deftest tramp-archive-test06-directory-file-name ()
|
|
|
|
"Check `directory-file-name'.
|
|
|
|
This checks also `file-name-as-directory', `file-name-directory',
|
|
|
|
`file-name-nondirectory' and `unhandled-file-name-directory'."
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-17 11:31:23 +01:00
|
|
|
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
|
|
|
(string-equal
|
2021-06-20 17:50:52 +02:00
|
|
|
(directory-file-name (concat tramp-archive-test-archive "path/to/file"))
|
|
|
|
(concat tramp-archive-test-archive "path/to/file")))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
|
|
|
(string-equal
|
2021-06-20 17:50:52 +02:00
|
|
|
(directory-file-name (concat tramp-archive-test-archive "path/to/file/"))
|
|
|
|
(concat tramp-archive-test-archive "path/to/file")))
|
2017-12-09 14:34:30 +01:00
|
|
|
;; `directory-file-name' does not leave file archive boundaries.
|
2021-06-20 17:50:52 +02:00
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(directory-file-name tramp-archive-test-archive) tramp-archive-test-archive))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(should
|
|
|
|
(string-equal
|
2021-06-20 17:50:52 +02:00
|
|
|
(file-name-as-directory (concat tramp-archive-test-archive "path/to/file"))
|
|
|
|
(concat tramp-archive-test-archive "path/to/file/")))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
|
|
|
(string-equal
|
2021-06-20 17:50:52 +02:00
|
|
|
(file-name-as-directory (concat tramp-archive-test-archive "path/to/file/"))
|
|
|
|
(concat tramp-archive-test-archive "path/to/file/")))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(file-name-as-directory tramp-archive-test-archive)
|
|
|
|
tramp-archive-test-archive))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(file-name-as-directory tramp-archive-test-file-archive)
|
|
|
|
tramp-archive-test-archive))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(should
|
|
|
|
(string-equal
|
2021-06-20 17:50:52 +02:00
|
|
|
(file-name-directory (concat tramp-archive-test-archive "path/to/file"))
|
|
|
|
(concat tramp-archive-test-archive "path/to/")))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
|
|
|
(string-equal
|
2021-06-20 17:50:52 +02:00
|
|
|
(file-name-directory (concat tramp-archive-test-archive "path/to/file/"))
|
|
|
|
(concat tramp-archive-test-archive "path/to/file/")))
|
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
(file-name-directory tramp-archive-test-archive) tramp-archive-test-archive))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(should
|
2021-06-20 17:50:52 +02:00
|
|
|
(string-equal
|
|
|
|
(file-name-nondirectory (concat tramp-archive-test-archive "path/to/file"))
|
|
|
|
"file"))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
2021-06-20 17:50:52 +02:00
|
|
|
(string-equal
|
|
|
|
(file-name-nondirectory (concat tramp-archive-test-archive "path/to/file/"))
|
|
|
|
""))
|
|
|
|
(should (string-equal (file-name-nondirectory tramp-archive-test-archive) ""))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(should-not
|
2021-06-20 17:50:52 +02:00
|
|
|
(unhandled-file-name-directory
|
|
|
|
(concat tramp-archive-test-archive "path/to/file"))))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test07-file-exists-p ()
|
|
|
|
"Check `file-exist-p', `write-region' and `delete-file'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(unwind-protect
|
|
|
|
(let ((default-directory tramp-archive-test-archive))
|
|
|
|
(should (file-exists-p tramp-archive-test-file-archive))
|
|
|
|
(should (file-exists-p tramp-archive-test-archive))
|
|
|
|
(should (file-exists-p "foo.txt"))
|
|
|
|
(should (file-exists-p "foo.lnk"))
|
|
|
|
(should (file-exists-p "bar"))
|
|
|
|
(should (file-exists-p "bar/bar"))
|
|
|
|
(should-error
|
|
|
|
(write-region "foo" nil "baz")
|
|
|
|
:type 'file-error)
|
|
|
|
(should-error
|
|
|
|
(delete-file "baz")
|
|
|
|
:type 'file-error))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash)))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test08-file-local-copy ()
|
|
|
|
"Check `file-local-copy'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let (tmp-name)
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(should
|
|
|
|
(setq tmp-name
|
|
|
|
(file-local-copy
|
|
|
|
(expand-file-name "bar/bar" tramp-archive-test-archive))))
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents tmp-name)
|
|
|
|
(should (string-equal (buffer-string) "bar\n")))
|
|
|
|
;; Error case.
|
|
|
|
(tramp-archive--test-delete tmp-name)
|
|
|
|
(should-error
|
|
|
|
(setq tmp-name
|
|
|
|
(file-local-copy
|
|
|
|
(expand-file-name "what" tramp-archive-test-archive)))
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
:type 'file-missing))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; Cleanup.
|
2018-01-30 17:34:02 +01:00
|
|
|
(ignore-errors (tramp-archive--test-delete tmp-name))
|
|
|
|
(tramp-archive-cleanup-hash))))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test09-insert-file-contents ()
|
|
|
|
"Check `insert-file-contents'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let ((tmp-name (expand-file-name "bar/bar" tramp-archive-test-archive)))
|
|
|
|
(unwind-protect
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents tmp-name)
|
|
|
|
(should (string-equal (buffer-string) "bar\n"))
|
|
|
|
(insert-file-contents tmp-name)
|
|
|
|
(should (string-equal (buffer-string) "bar\nbar\n"))
|
|
|
|
;; Insert partly.
|
|
|
|
(insert-file-contents tmp-name nil 1 3)
|
|
|
|
(should (string-equal (buffer-string) "arbar\nbar\n"))
|
|
|
|
;; Replace.
|
|
|
|
(insert-file-contents tmp-name nil nil nil 'replace)
|
|
|
|
(should (string-equal (buffer-string) "bar\n"))
|
|
|
|
;; Error case.
|
|
|
|
(should-error
|
|
|
|
(insert-file-contents
|
|
|
|
(expand-file-name "what" tramp-archive-test-archive))
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
:type 'file-missing))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test11-copy-file ()
|
|
|
|
"Check `copy-file'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; Copy simple file.
|
|
|
|
(let ((tmp-name1 (expand-file-name "bar/bar" tramp-archive-test-archive))
|
|
|
|
(tmp-name2 (tramp-archive--test-make-temp-name)))
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(copy-file tmp-name1 tmp-name2)
|
|
|
|
(should (file-exists-p tmp-name2))
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents tmp-name2)
|
|
|
|
(should (string-equal (buffer-string) "bar\n")))
|
|
|
|
(should-error
|
|
|
|
(copy-file tmp-name1 tmp-name2)
|
|
|
|
:type 'file-already-exists)
|
|
|
|
(copy-file tmp-name1 tmp-name2 'ok)
|
|
|
|
;; The file archive is not writable.
|
|
|
|
(should-error
|
|
|
|
(copy-file tmp-name2 tmp-name1 'ok)
|
|
|
|
:type 'file-error))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(ignore-errors (tramp-archive--test-delete tmp-name2))
|
|
|
|
(tramp-archive-cleanup-hash)))
|
|
|
|
|
|
|
|
;; Copy directory to existing directory.
|
|
|
|
(let ((tmp-name1 (expand-file-name "bar" tramp-archive-test-archive))
|
|
|
|
(tmp-name2 (tramp-archive--test-make-temp-name)))
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(make-directory tmp-name2)
|
|
|
|
(should (file-directory-p tmp-name2))
|
|
|
|
;; Directory `tmp-name2' exists already, so we must use
|
|
|
|
;; `file-name-as-directory'.
|
|
|
|
(copy-file tmp-name1 (file-name-as-directory tmp-name2))
|
|
|
|
(should
|
|
|
|
(file-exists-p
|
|
|
|
(expand-file-name
|
|
|
|
(concat (file-name-nondirectory tmp-name1) "/bar") tmp-name2))))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(ignore-errors (tramp-archive--test-delete tmp-name2))
|
|
|
|
(tramp-archive-cleanup-hash)))
|
|
|
|
|
|
|
|
;; Copy directory/file to non-existing directory.
|
|
|
|
(let ((tmp-name1 (expand-file-name "bar" tramp-archive-test-archive))
|
|
|
|
(tmp-name2 (tramp-archive--test-make-temp-name)))
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(make-directory tmp-name2)
|
|
|
|
(should (file-directory-p tmp-name2))
|
|
|
|
(copy-file
|
|
|
|
tmp-name1
|
|
|
|
(expand-file-name (file-name-nondirectory tmp-name1) tmp-name2))
|
|
|
|
(should
|
|
|
|
(file-exists-p
|
|
|
|
(expand-file-name
|
|
|
|
(concat (file-name-nondirectory tmp-name1) "/bar") tmp-name2))))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(ignore-errors (tramp-archive--test-delete tmp-name2))
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test15-copy-directory ()
|
|
|
|
"Check `copy-directory'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let* ((tmp-name1 (expand-file-name "bar" tramp-archive-test-archive))
|
|
|
|
(tmp-name2 (tramp-archive--test-make-temp-name))
|
|
|
|
(tmp-name3 (expand-file-name
|
|
|
|
(file-name-nondirectory tmp-name1) tmp-name2))
|
|
|
|
(tmp-name4 (expand-file-name "bar" tmp-name2))
|
|
|
|
(tmp-name5 (expand-file-name "bar" tmp-name3)))
|
|
|
|
|
|
|
|
;; Copy complete directory.
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
;; Copy empty directory.
|
|
|
|
(copy-directory tmp-name1 tmp-name2)
|
|
|
|
(should (file-directory-p tmp-name2))
|
|
|
|
(should (file-exists-p tmp-name4))
|
|
|
|
;; Target directory does exist already.
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
(should-error
|
|
|
|
(copy-directory tmp-name1 tmp-name2)
|
|
|
|
:type 'file-error)
|
2017-12-09 14:34:30 +01:00
|
|
|
(tramp-archive--test-delete tmp-name4)
|
|
|
|
(copy-directory tmp-name1 (file-name-as-directory tmp-name2))
|
|
|
|
(should (file-directory-p tmp-name3))
|
|
|
|
(should (file-exists-p tmp-name5)))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(ignore-errors (tramp-archive--test-delete tmp-name2))
|
|
|
|
(tramp-archive-cleanup-hash))
|
|
|
|
|
|
|
|
;; Copy directory contents.
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
;; Copy empty directory.
|
|
|
|
(copy-directory tmp-name1 tmp-name2 nil 'parents 'contents)
|
|
|
|
(should (file-directory-p tmp-name2))
|
|
|
|
(should (file-exists-p tmp-name4))
|
|
|
|
;; Target directory does exist already.
|
|
|
|
(tramp-archive--test-delete tmp-name4)
|
|
|
|
(copy-directory
|
|
|
|
tmp-name1 (file-name-as-directory tmp-name2)
|
|
|
|
nil 'parents 'contents)
|
|
|
|
(should (file-directory-p tmp-name2))
|
|
|
|
(should (file-exists-p tmp-name4))
|
|
|
|
(should-not (file-directory-p tmp-name3))
|
|
|
|
(should-not (file-exists-p tmp-name5)))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(ignore-errors (tramp-archive--test-delete tmp-name2))
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test16-directory-files ()
|
|
|
|
"Check `directory-files'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let ((tmp-name tramp-archive-test-archive)
|
2019-01-29 17:26:14 +01:00
|
|
|
(files '("." ".." "bar" "baz.tar" "foo.hrd" "foo.lnk" "foo.txt")))
|
2017-12-09 14:34:30 +01:00
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(should (file-directory-p tmp-name))
|
|
|
|
(should (equal (directory-files tmp-name) files))
|
|
|
|
(should (equal (directory-files tmp-name 'full)
|
|
|
|
(mapcar (lambda (x) (concat tmp-name x)) files)))
|
|
|
|
(should (equal (directory-files
|
|
|
|
tmp-name nil directory-files-no-dot-files-regexp)
|
2023-05-13 13:36:50 +02:00
|
|
|
(remove "." (remove ".." files))))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should (equal (directory-files
|
|
|
|
tmp-name 'full directory-files-no-dot-files-regexp)
|
|
|
|
(mapcar (lambda (x) (concat tmp-name x))
|
2023-05-13 13:36:50 +02:00
|
|
|
(remove "." (remove ".." files))))))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test17-insert-directory ()
|
|
|
|
"Check `insert-directory'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let (;; We test for the summary line. Keyword "total" could be localized.
|
|
|
|
(process-environment
|
|
|
|
(append '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment)))
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
(with-temp-buffer
|
|
|
|
(insert-directory tramp-archive-test-archive nil)
|
|
|
|
(goto-char (point-min))
|
2023-01-06 13:34:33 +01:00
|
|
|
(should (looking-at-p (rx (literal tramp-archive-test-archive)))))
|
2017-12-09 14:34:30 +01:00
|
|
|
(with-temp-buffer
|
|
|
|
(insert-directory tramp-archive-test-archive "-al")
|
|
|
|
(goto-char (point-min))
|
|
|
|
(should
|
|
|
|
(looking-at-p
|
2023-01-06 13:34:33 +01:00
|
|
|
(rx bol (+ nonl) blank (literal tramp-archive-test-archive) eol))))
|
2017-12-09 14:34:30 +01:00
|
|
|
(with-temp-buffer
|
|
|
|
(insert-directory
|
|
|
|
(file-name-as-directory tramp-archive-test-archive)
|
|
|
|
"-al" nil 'full-directory-p)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(should
|
|
|
|
(looking-at-p
|
Use `rx' in Tramp where possible
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-cache.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-compat.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-ftp.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Use `rx' where possible.
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
Use `eval-when-compile'.
(tramp-adb-maybe-open-connection): Use file-property for "/". Use
`eval-when-compile'.
* lisp/net/tramp-cmds.el (mm-7bit-chars): Declare.
(tramp-reporter-dump-variable): Simplify point movement.
* lisp/net/tramp-gvfs.el (tramp-dbus-function): Fix typo.
(tramp-zeroconf-parse-device-names): Use `tramp-prefix-port-format'.
* lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell):
Use `eval-when-compile'. Improve sanity check.
* lisp/net/tramp.el (tramp-prefix-format, tramp-prefix-regexp)
(tramp-method-regexp, tramp-postfix-method-format)
(tramp-postfix-method-regexp, tramp-prefix-ipv6-format)
(tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format)
(tramp-postfix-ipv6-regexp, tramp-postfix-host-format)
(tramp-postfix-host-regexp, tramp-remote-file-name-spec-regexp)
(tramp-file-name-structure, tramp-file-name-regexp)
(tramp-completion-method-regexp)
(tramp-completion-file-name-regexp): Declare.
(tramp-set-syntax): Set also `tramp-completion-method-regexp'.
(tramp-volume-letter-regexp, tramp-completion-method-regexp-alist):
New defconsts.
(tramp-build-completion-method-regexp): New defun.
(tramp-completion-method-regexp): New defvar.
(tramp-completion-file-name-regexp-default)
(tramp-completion-file-name-regexp-simplified)
(tramp-completion-file-name-regexp-separate)
(tramp-completion-file-name-regexp-alist): Remove.
(tramp-build-completion-file-name-regexp): Rwrite.
(tramp-make-tramp-file-name): Use `tramp-archive-method'.
(tramp-handle-file-directory-p): Ignore errors.
(tramp-handle-find-backup-file-name, tramp-handle-lock-file)
(tramp-handle-make-auto-save-file-name): Use `eval-when-compile'.
* test/lisp/net/tramp-archive-tests.el:
* test/lisp/net/tramp-tests.el: Use `rx' where possible.
(tramp-test01-file-name-syntax): Adapt test.
2022-08-26 16:19:47 +02:00
|
|
|
(rx-to-string
|
|
|
|
`(:
|
|
|
|
;; There might be a summary line.
|
2022-09-06 12:33:19 +02:00
|
|
|
(? "total" (+ nonl) (+ digit) (? blank)
|
Use `rx' in Tramp where possible
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-cache.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-compat.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-ftp.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Use `rx' where possible.
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
Use `eval-when-compile'.
(tramp-adb-maybe-open-connection): Use file-property for "/". Use
`eval-when-compile'.
* lisp/net/tramp-cmds.el (mm-7bit-chars): Declare.
(tramp-reporter-dump-variable): Simplify point movement.
* lisp/net/tramp-gvfs.el (tramp-dbus-function): Fix typo.
(tramp-zeroconf-parse-device-names): Use `tramp-prefix-port-format'.
* lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell):
Use `eval-when-compile'. Improve sanity check.
* lisp/net/tramp.el (tramp-prefix-format, tramp-prefix-regexp)
(tramp-method-regexp, tramp-postfix-method-format)
(tramp-postfix-method-regexp, tramp-prefix-ipv6-format)
(tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format)
(tramp-postfix-ipv6-regexp, tramp-postfix-host-format)
(tramp-postfix-host-regexp, tramp-remote-file-name-spec-regexp)
(tramp-file-name-structure, tramp-file-name-regexp)
(tramp-completion-method-regexp)
(tramp-completion-file-name-regexp): Declare.
(tramp-set-syntax): Set also `tramp-completion-method-regexp'.
(tramp-volume-letter-regexp, tramp-completion-method-regexp-alist):
New defconsts.
(tramp-build-completion-method-regexp): New defun.
(tramp-completion-method-regexp): New defvar.
(tramp-completion-file-name-regexp-default)
(tramp-completion-file-name-regexp-simplified)
(tramp-completion-file-name-regexp-separate)
(tramp-completion-file-name-regexp-alist): Remove.
(tramp-build-completion-file-name-regexp): Rwrite.
(tramp-make-tramp-file-name): Use `tramp-archive-method'.
(tramp-handle-file-directory-p): Ignore errors.
(tramp-handle-find-backup-file-name, tramp-handle-lock-file)
(tramp-handle-make-auto-save-file-name): Use `eval-when-compile'.
* test/lisp/net/tramp-archive-tests.el:
* test/lisp/net/tramp-tests.el: Use `rx' where possible.
(tramp-test01-file-name-syntax): Adapt test.
2022-08-26 16:19:47 +02:00
|
|
|
(? (any "EGKMPTYZk")) (? "i") (? "B") "\n")
|
|
|
|
;; We don't know in which order the files appear.
|
|
|
|
(= ,(length (directory-files tramp-archive-test-archive))
|
2022-09-06 12:33:19 +02:00
|
|
|
(+ nonl) blank
|
Use `rx' in Tramp where possible
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-cache.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-compat.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-ftp.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Use `rx' where possible.
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
Use `eval-when-compile'.
(tramp-adb-maybe-open-connection): Use file-property for "/". Use
`eval-when-compile'.
* lisp/net/tramp-cmds.el (mm-7bit-chars): Declare.
(tramp-reporter-dump-variable): Simplify point movement.
* lisp/net/tramp-gvfs.el (tramp-dbus-function): Fix typo.
(tramp-zeroconf-parse-device-names): Use `tramp-prefix-port-format'.
* lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell):
Use `eval-when-compile'. Improve sanity check.
* lisp/net/tramp.el (tramp-prefix-format, tramp-prefix-regexp)
(tramp-method-regexp, tramp-postfix-method-format)
(tramp-postfix-method-regexp, tramp-prefix-ipv6-format)
(tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format)
(tramp-postfix-ipv6-regexp, tramp-postfix-host-format)
(tramp-postfix-host-regexp, tramp-remote-file-name-spec-regexp)
(tramp-file-name-structure, tramp-file-name-regexp)
(tramp-completion-method-regexp)
(tramp-completion-file-name-regexp): Declare.
(tramp-set-syntax): Set also `tramp-completion-method-regexp'.
(tramp-volume-letter-regexp, tramp-completion-method-regexp-alist):
New defconsts.
(tramp-build-completion-method-regexp): New defun.
(tramp-completion-method-regexp): New defvar.
(tramp-completion-file-name-regexp-default)
(tramp-completion-file-name-regexp-simplified)
(tramp-completion-file-name-regexp-separate)
(tramp-completion-file-name-regexp-alist): Remove.
(tramp-build-completion-file-name-regexp): Rwrite.
(tramp-make-tramp-file-name): Use `tramp-archive-method'.
(tramp-handle-file-directory-p): Ignore errors.
(tramp-handle-find-backup-file-name, tramp-handle-lock-file)
(tramp-handle-make-auto-save-file-name): Use `eval-when-compile'.
* test/lisp/net/tramp-archive-tests.el:
* test/lisp/net/tramp-tests.el: Use `rx' where possible.
(tramp-test01-file-name-syntax): Adapt test.
2022-08-26 16:19:47 +02:00
|
|
|
(regexp
|
|
|
|
,(regexp-opt (directory-files tramp-archive-test-archive)))
|
Fix rx forms in Tramp
* lisp/net/tramp.el (tramp-restricted-shell-hosts-alist)
(tramp-local-host-regexp, tramp-echoed-echo-mark-regexp)
(tramp-login-prompt-regexp, tramp-terminal-prompt-regexp)
(tramp-antispoof-regexp)
(tramp-build-completion-file-name-regexp)
(tramp-debug-outline-regexp)
(tramp-use-absolute-autoload-file-names)
(tramp-lock-file-info-regexp, tramp-shell-quote-argument):
* lisp/net/tramp-adb.el (tramp-do-parse-file-attributes-with-ls)
* lisp/net/tramp-cache.el (tramp-flush-file-function):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name):
* lisp/net/tramp-integration.el (tramp-rfn-eshadow-update-overlay-regexp)
(info-lookup-maybe-add-help):
* lisp/net/tramp-sh.el (tramp-default-user-alist, tramp-sunos-unames)
(tramp-scp-direct-remote-copying, tramp-get-remote-locale):
* lisp/net/tramp-smb.el (tramp-smb-prompt, tramp-smb-wrong-passwd-regexp)
(tramp-smb-errors, tramp-smb-get-localname)
(tramp-smb-read-file-entry): Simplify rx forms.
* lisp/net/tramp.el (tramp-handle-find-backup-file-name)
(tramp-handle-lock-file, tramp-handle-make-auto-save-file-name):
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times)
(tramp-adb-maybe-open-connection):
* lisp/net/tramp-gvfs.el
(tramp-gvfs-file-attributes-with-gvfs-ls-regexp):
* lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell): Do not use
`eval-when-compile'.
* lisp/net/tramp-cmds.el (tramp-rename-files, tramp-rename-these-files):
Use rx.
* lisp/net/tramp-gvfs.el (tramp-gvfs-password-tcrypt): New defonst.
(tramp-gvfs-handle-file-attributes): Use `number-to-string'.
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test17-insert-directory):
* test/lisp/net/tramp-tests.el (tramp-test17-insert-directory)
(tramp--test-share-p): Simplify rx forms.
2022-09-04 13:44:30 +02:00
|
|
|
(? " ->" (+ nonl)) "\n"))))))
|
2019-02-19 14:00:17 +01:00
|
|
|
;; Check error case.
|
|
|
|
(with-temp-buffer
|
|
|
|
(should-error
|
|
|
|
(insert-directory
|
|
|
|
(expand-file-name "baz" tramp-archive-test-archive) nil)
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
:type 'file-missing)))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test18-file-attributes ()
|
|
|
|
"Check `file-attributes'.
|
2019-02-19 14:00:17 +01:00
|
|
|
This tests also `access-file', `file-readable-p' and `file-regular-p'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive))
|
|
|
|
(tmp-name2 (expand-file-name "foo.lnk" tramp-archive-test-archive))
|
|
|
|
(tmp-name3 (expand-file-name "bar" tramp-archive-test-archive))
|
2019-02-19 14:00:17 +01:00
|
|
|
(tmp-name4 (expand-file-name "baz" tramp-archive-test-archive))
|
2017-12-09 14:34:30 +01:00
|
|
|
attr)
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(should (file-exists-p tmp-name1))
|
|
|
|
(should (file-readable-p tmp-name1))
|
|
|
|
(should (file-regular-p tmp-name1))
|
2019-02-19 14:00:17 +01:00
|
|
|
(should-not (access-file tmp-name1 "error"))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; We do not test inodes and device numbers.
|
|
|
|
(setq attr (file-attributes tmp-name1))
|
|
|
|
(should (consp attr))
|
|
|
|
(should (null (car attr)))
|
|
|
|
(should (numberp (nth 1 attr))) ;; Link.
|
|
|
|
(should (numberp (nth 2 attr))) ;; Uid.
|
|
|
|
(should (numberp (nth 3 attr))) ;; Gid.
|
|
|
|
;; Last access time.
|
|
|
|
(should (stringp (current-time-string (nth 4 attr))))
|
|
|
|
;; Last modification time.
|
|
|
|
(should (stringp (current-time-string (nth 5 attr))))
|
|
|
|
;; Last status change time.
|
|
|
|
(should (stringp (current-time-string (nth 6 attr))))
|
|
|
|
(should (numberp (nth 7 attr))) ;; Size.
|
|
|
|
(should (stringp (nth 8 attr))) ;; Modes.
|
|
|
|
|
|
|
|
(setq attr (file-attributes tmp-name1 'string))
|
|
|
|
(should (stringp (nth 2 attr))) ;; Uid.
|
|
|
|
(should (stringp (nth 3 attr))) ;; Gid.
|
|
|
|
|
|
|
|
;; Symlink.
|
|
|
|
(should (file-exists-p tmp-name2))
|
|
|
|
(should (file-symlink-p tmp-name2))
|
2023-01-21 12:04:50 +01:00
|
|
|
(should (file-regular-p tmp-name2))
|
2017-12-09 14:34:30 +01:00
|
|
|
(setq attr (file-attributes tmp-name2))
|
|
|
|
(should (string-equal (car attr) (file-name-nondirectory tmp-name1)))
|
|
|
|
|
|
|
|
;; Directory.
|
|
|
|
(should (file-exists-p tmp-name3))
|
|
|
|
(should (file-readable-p tmp-name3))
|
|
|
|
(should-not (file-regular-p tmp-name3))
|
|
|
|
(setq attr (file-attributes tmp-name3))
|
2019-02-19 14:00:17 +01:00
|
|
|
(should (eq (car attr) t))
|
|
|
|
(should-not (access-file tmp-name3 "error"))
|
|
|
|
|
|
|
|
;; Check error case.
|
|
|
|
(should-error
|
|
|
|
(access-file tmp-name4 "error")
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
:type 'file-missing))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test19-directory-files-and-attributes ()
|
|
|
|
"Check `directory-files-and-attributes'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let ((tmp-name (expand-file-name "bar" tramp-archive-test-archive))
|
|
|
|
attr)
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(should (file-directory-p tmp-name))
|
|
|
|
(setq attr (directory-files-and-attributes tmp-name))
|
|
|
|
(should (consp attr))
|
|
|
|
(dolist (elt attr)
|
|
|
|
(should
|
|
|
|
(equal (file-attributes (expand-file-name (car elt) tmp-name))
|
|
|
|
(cdr elt))))
|
|
|
|
(setq attr (directory-files-and-attributes tmp-name 'full))
|
|
|
|
(dolist (elt attr)
|
|
|
|
(should (equal (file-attributes (car elt)) (cdr elt))))
|
Use `rx' in Tramp where possible
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-cache.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-compat.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-ftp.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Use `rx' where possible.
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
Use `eval-when-compile'.
(tramp-adb-maybe-open-connection): Use file-property for "/". Use
`eval-when-compile'.
* lisp/net/tramp-cmds.el (mm-7bit-chars): Declare.
(tramp-reporter-dump-variable): Simplify point movement.
* lisp/net/tramp-gvfs.el (tramp-dbus-function): Fix typo.
(tramp-zeroconf-parse-device-names): Use `tramp-prefix-port-format'.
* lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell):
Use `eval-when-compile'. Improve sanity check.
* lisp/net/tramp.el (tramp-prefix-format, tramp-prefix-regexp)
(tramp-method-regexp, tramp-postfix-method-format)
(tramp-postfix-method-regexp, tramp-prefix-ipv6-format)
(tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format)
(tramp-postfix-ipv6-regexp, tramp-postfix-host-format)
(tramp-postfix-host-regexp, tramp-remote-file-name-spec-regexp)
(tramp-file-name-structure, tramp-file-name-regexp)
(tramp-completion-method-regexp)
(tramp-completion-file-name-regexp): Declare.
(tramp-set-syntax): Set also `tramp-completion-method-regexp'.
(tramp-volume-letter-regexp, tramp-completion-method-regexp-alist):
New defconsts.
(tramp-build-completion-method-regexp): New defun.
(tramp-completion-method-regexp): New defvar.
(tramp-completion-file-name-regexp-default)
(tramp-completion-file-name-regexp-simplified)
(tramp-completion-file-name-regexp-separate)
(tramp-completion-file-name-regexp-alist): Remove.
(tramp-build-completion-file-name-regexp): Rwrite.
(tramp-make-tramp-file-name): Use `tramp-archive-method'.
(tramp-handle-file-directory-p): Ignore errors.
(tramp-handle-find-backup-file-name, tramp-handle-lock-file)
(tramp-handle-make-auto-save-file-name): Use `eval-when-compile'.
* test/lisp/net/tramp-archive-tests.el:
* test/lisp/net/tramp-tests.el: Use `rx' where possible.
(tramp-test01-file-name-syntax): Adapt test.
2022-08-26 16:19:47 +02:00
|
|
|
(setq attr (directory-files-and-attributes tmp-name nil (rx bos "b")))
|
2019-02-28 10:33:05 +01:00
|
|
|
(should (equal (mapcar #'car attr) '("bar"))))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test20-file-modes ()
|
|
|
|
"Check `file-modes'.
|
|
|
|
This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive))
|
|
|
|
(tmp-name2 (expand-file-name "bar" tramp-archive-test-archive)))
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(should (file-exists-p tmp-name1))
|
|
|
|
;; `set-file-modes' is not implemented.
|
|
|
|
(should-error
|
|
|
|
(set-file-modes tmp-name1 #o777)
|
|
|
|
:type 'file-error)
|
|
|
|
(should (= (file-modes tmp-name1) #o400))
|
|
|
|
(should-not (file-executable-p tmp-name1))
|
|
|
|
(should-not (file-writable-p tmp-name1))
|
|
|
|
|
|
|
|
(should (file-exists-p tmp-name2))
|
|
|
|
;; `set-file-modes' is not implemented.
|
|
|
|
(should-error
|
|
|
|
(set-file-modes tmp-name2 #o777)
|
|
|
|
:type 'file-error)
|
|
|
|
(should (= (file-modes tmp-name2) #o500))
|
|
|
|
(should (file-executable-p tmp-name2))
|
|
|
|
(should-not (file-writable-p tmp-name2)))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test21-file-links ()
|
|
|
|
"Check `file-symlink-p' and `file-truename'"
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; We must use `file-truename' for the file archive, because it
|
|
|
|
;; could be located on a symlinked directory. This would let the
|
|
|
|
;; test fail.
|
|
|
|
(let* ((tramp-archive-test-archive (file-truename tramp-archive-test-archive))
|
|
|
|
(tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive))
|
|
|
|
(tmp-name2 (expand-file-name "foo.lnk" tramp-archive-test-archive)))
|
|
|
|
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(should (file-exists-p tmp-name1))
|
2023-01-21 12:04:50 +01:00
|
|
|
(should (file-regular-p tmp-name1))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should (string-equal tmp-name1 (file-truename tmp-name1)))
|
|
|
|
;; `make-symbolic-link' is not implemented.
|
|
|
|
(should-error
|
|
|
|
(make-symbolic-link tmp-name1 tmp-name2)
|
|
|
|
:type 'file-error)
|
|
|
|
(should (file-symlink-p tmp-name2))
|
2023-01-21 12:04:50 +01:00
|
|
|
(should (file-regular-p tmp-name2))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
|
|
|
(string-equal
|
|
|
|
;; This is "/foo.txt".
|
|
|
|
(with-parsed-tramp-archive-file-name tmp-name1 nil localname)
|
|
|
|
;; `file-symlink-p' returns "foo.txt". Wer must expand, therefore.
|
|
|
|
(with-parsed-tramp-archive-file-name
|
|
|
|
(expand-file-name
|
|
|
|
(file-symlink-p tmp-name2) tramp-archive-test-archive)
|
|
|
|
nil
|
|
|
|
localname)))
|
|
|
|
(should-not (string-equal tmp-name2 (file-truename tmp-name2)))
|
|
|
|
(should
|
|
|
|
(string-equal (file-truename tmp-name1) (file-truename tmp-name2)))
|
|
|
|
(should (file-equal-p tmp-name1 tmp-name2)))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test26-file-name-completion ()
|
|
|
|
"Check `file-name-completion' and `file-name-all-completions'."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let ((tmp-name tramp-archive-test-archive))
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
;; Local files.
|
|
|
|
(should (equal (file-name-completion "fo" tmp-name) "foo."))
|
|
|
|
(should (equal (file-name-completion "foo.txt" tmp-name) t))
|
2018-01-30 17:34:02 +01:00
|
|
|
(should (equal (file-name-completion "b" tmp-name) "ba"))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should-not (file-name-completion "a" tmp-name))
|
|
|
|
(should
|
|
|
|
(equal
|
2019-02-28 10:33:05 +01:00
|
|
|
(file-name-completion "b" tmp-name #'file-directory-p) "bar/"))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
|
|
|
(equal
|
2019-02-28 10:33:05 +01:00
|
|
|
(sort (file-name-all-completions "fo" tmp-name) #'string-lessp)
|
2017-12-09 14:34:30 +01:00
|
|
|
'("foo.hrd" "foo.lnk" "foo.txt")))
|
|
|
|
(should
|
|
|
|
(equal
|
2019-02-28 10:33:05 +01:00
|
|
|
(sort (file-name-all-completions "b" tmp-name) #'string-lessp)
|
2018-01-30 17:34:02 +01:00
|
|
|
'("bar/" "baz.tar")))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should-not (file-name-all-completions "a" tmp-name))
|
|
|
|
;; `completion-regexp-list' restricts the completion to
|
|
|
|
;; files which match all expressions in this list.
|
|
|
|
(let ((completion-regexp-list
|
|
|
|
`(,directory-files-no-dot-files-regexp "b")))
|
|
|
|
(should
|
2018-01-30 17:34:02 +01:00
|
|
|
(equal (file-name-completion "" tmp-name) "ba"))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should
|
|
|
|
(equal
|
2019-02-28 10:33:05 +01:00
|
|
|
(sort (file-name-all-completions "" tmp-name) #'string-lessp)
|
2018-01-30 17:34:02 +01:00
|
|
|
'("bar/" "baz.tar")))))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash))))
|
|
|
|
|
Implement file locks for remote files (Bug#49261)
* doc/lispref/files.texi (Magic File Names): Add file-locked-p,
lock-file and unlock-file.
* etc/NEWS: Tramp supports file locks now.
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-adb-handle-write-region): Handle LOCKNAME.
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-crypt-handle-file-locked-p, tramp-crypt-handle-lock-file)
(tramp-crypt-handle-unlock-file): New defun.
* lisp/net/tramp-fuse.el (tramp-fuse-mounted-p): Simplify.
(tramp-fuse-unmount): New defun.
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-gvfs-maybe-open-connection): Set "lock-pid" connection property.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-rclone-maybe-open-connection): Set "lock-pid" connection property.
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-sh-handle-write-region): Handle LOCKNAME.
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-smb-handle-copy-directory): Use `sleep-for'.
(tramp-smb-handle-write-region): Handle LOCKNAME.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-sshfs-handle-write-region): Handle LOCKNAME.
(tramp-sshfs-maybe-open-connection): Set "lock-pid" connection property.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-sudoedit-maybe-open-connection):
Set "lock-pid" connection property.
* lisp/net/tramp.el (tramp-file-name-for-operation):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-make-lock-name, tramp-get-lock-file, tramp-get-lock-pid)
(tramp-handle-file-locked-p, tramp-handle-lock-file)
(tramp-handle-unlock-file): New defuns.
(tramp-lock-file-contents-regexp): New regexp.
(tramp-handle-write-region): Handle LOCKNAME.
* src/filelock.c (lock_file, unlock_file_body, Ffile_locked_p):
Call handler if exists.
(Flock_file, Funlock_file): New defuns.
(Qlock_file, Qunlock_file, Qfile_locked_p): Declare symbols.
(Slock_file, Sunlock_file): Declare subroutines.
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test40-make-nearby-temp-file)
(tramp-archive-test43-file-system-info): Rename.
* test/lisp/net/tramp-tests.el (top): Set `create-lockfiles' to nil.
(tramp--test-fuse-p): New defun.
(tramp-test14-delete-directory): Use it.
(tramp-test39-lock-file): New test.
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters)
(tramp-test41-special-characters-with-stat)
(tramp-test41-special-characters-with-perl)
(tramp-test41-special-characters-with-ls, tramp-test42-utf8)
(tramp-test42-utf8-with-stat, tramp-test42-utf8-with-perl)
(tramp-test42-utf8-with-ls, tramp-test43-file-system-info)
(tramp-test44-asynchronous-requests, tramp-test45-auto-load)
(tramp-test45-delay-load, tramp-test45-recursive-load)
(tramp-test45-remote-load-path, tramp-test46-unload): Rename.
(tramp--test-special-characters, tramp--test-utf8)
(tramp--test-asynchronous-requests-timeout): Modify docstring.
2021-07-07 18:36:53 +02:00
|
|
|
(ert-deftest tramp-archive-test40-make-nearby-temp-file ()
|
2017-12-09 14:34:30 +01:00
|
|
|
"Check `make-nearby-temp-file' and `temporary-file-directory'."
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
(let ((default-directory tramp-archive-test-archive)
|
|
|
|
tmp-file)
|
|
|
|
;; The file archive shall know a temporary file directory. It is
|
|
|
|
;; not in the archive itself.
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
(should (stringp (temporary-file-directory)))
|
|
|
|
(should-not (tramp-archive-file-name-p (temporary-file-directory)))
|
2017-12-09 14:34:30 +01:00
|
|
|
|
|
|
|
;; A temporary file or directory shall not be located in the
|
|
|
|
;; archive itself.
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
(setq tmp-file (make-nearby-temp-file "tramp-archive-test"))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should (file-exists-p tmp-file))
|
|
|
|
(should (file-regular-p tmp-file))
|
|
|
|
(should-not (tramp-archive-file-name-p tmp-file))
|
|
|
|
(delete-file tmp-file)
|
|
|
|
(should-not (file-exists-p tmp-file))
|
|
|
|
|
Remove Emacs 25 compatibility from Tramp
* doc/misc/tramp.texi (Remote programs, Remote processes)
(Frequently Asked Questions): Adapt Emacs versions.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0-pre".
* lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for
connection-local functions.
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-handle-temporary-file-directory)
(tramp-compat-temporary-file-directory-function)
(tramp-compat-file-attribute-type)
(tramp-compat-file-attribute-link-number)
(tramp-compat-file-attribute-user-id)
(tramp-compat-file-attribute-group-id)
(tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-status-change-time)
(tramp-compat-file-attribute-size)
(tramp-compat-file-attribute-modes, tramp-file-missing)
(tramp-compat-file-missing, tramp-compat-file-local-name): Remove.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote)
(tramp-compat-progress-reporter-update)
(tramp-compat-file-modes, tramp-compat-set-file-modes)
(tramp-compat-set-file-times, tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes): Adapt implementation.
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Adapt callees.
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
Expand file name.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove.
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version.
(tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'.
* lisp/net/tramp-integration.el (rfn-eshadow-overlay):
Remove declaration.
(top): Don't use `tramp-compat-funcall' for connection-local functions.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Use `tramp-rclone-handle-file-readable-p'.
(tramp-rclone-handle-file-readable-p): New defun.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-readable-p'.
* lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax):
Adapt docstring.
(tramp-set-connection-local-variables)
(tramp-set-connection-local-variables-for-buffer): Don't use
`tramp-compat-funcall' for connection-local functions.
(tramp-file-name-for-operation): Reorder list.
(tramp-handle-make-symbolic-link): Don't handle TARGET and
OK-IF-ALREADY-EXISTS.
(tramp-read-passwd): Don't use `read-passwd' any longer.
(top): Don't check for `interrupt-process-functions'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p):
Remove.
(tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-archive-test46-auto-load)
(tramp-archive-test46-delay-load): Rename.
* test/lisp/net/tramp-tests.el (dired-aux, seq): Require them.
(dired-compress, connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width):
Don't declare.
(all): Replace Emacs 26 compatibility functions with their
original name.
(tramp-test04-substitute-in-file-name)
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test17-insert-directory)
(tramp-test17-dired-with-wildcards, tramp-test21-file-links)
(tramp-test31-interrupt-process)
(tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name)
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters, tramp-test42-utf8)
(tramp-test46-delay-load, tramp-test46-remote-load-path)
(tramp-test47-unload): Don't check for Emacs 26 special features.
(tramp--test-emacs26-p): Remove.
(tramp--test-emacs29-p): New defun.
(tramp-test45-dired-compress-file)
(tramp-test45-dired-compress-dir): Use it.
(tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 18:17:32 +01:00
|
|
|
(setq tmp-file (make-nearby-temp-file "tramp-archive-test" 'dir))
|
2017-12-09 14:34:30 +01:00
|
|
|
(should (file-exists-p tmp-file))
|
|
|
|
(should (file-directory-p tmp-file))
|
|
|
|
(should-not (tramp-archive-file-name-p tmp-file))
|
|
|
|
(delete-directory tmp-file)
|
|
|
|
(should-not (file-exists-p tmp-file))))
|
|
|
|
|
Implement file locks for remote files (Bug#49261)
* doc/lispref/files.texi (Magic File Names): Add file-locked-p,
lock-file and unlock-file.
* etc/NEWS: Tramp supports file locks now.
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-adb-handle-write-region): Handle LOCKNAME.
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-crypt-handle-file-locked-p, tramp-crypt-handle-lock-file)
(tramp-crypt-handle-unlock-file): New defun.
* lisp/net/tramp-fuse.el (tramp-fuse-mounted-p): Simplify.
(tramp-fuse-unmount): New defun.
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-gvfs-maybe-open-connection): Set "lock-pid" connection property.
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-rclone-maybe-open-connection): Set "lock-pid" connection property.
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-sh-handle-write-region): Handle LOCKNAME.
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-smb-handle-copy-directory): Use `sleep-for'.
(tramp-smb-handle-write-region): Handle LOCKNAME.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-sshfs-handle-write-region): Handle LOCKNAME.
(tramp-sshfs-maybe-open-connection): Set "lock-pid" connection property.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-sudoedit-maybe-open-connection):
Set "lock-pid" connection property.
* lisp/net/tramp.el (tramp-file-name-for-operation):
Add `file-locked-p', `lock-file' and `unlock-file'.
(tramp-make-lock-name, tramp-get-lock-file, tramp-get-lock-pid)
(tramp-handle-file-locked-p, tramp-handle-lock-file)
(tramp-handle-unlock-file): New defuns.
(tramp-lock-file-contents-regexp): New regexp.
(tramp-handle-write-region): Handle LOCKNAME.
* src/filelock.c (lock_file, unlock_file_body, Ffile_locked_p):
Call handler if exists.
(Flock_file, Funlock_file): New defuns.
(Qlock_file, Qunlock_file, Qfile_locked_p): Declare symbols.
(Slock_file, Sunlock_file): Declare subroutines.
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test40-make-nearby-temp-file)
(tramp-archive-test43-file-system-info): Rename.
* test/lisp/net/tramp-tests.el (top): Set `create-lockfiles' to nil.
(tramp--test-fuse-p): New defun.
(tramp-test14-delete-directory): Use it.
(tramp-test39-lock-file): New test.
(tramp-test40-make-nearby-temp-file)
(tramp-test41-special-characters)
(tramp-test41-special-characters-with-stat)
(tramp-test41-special-characters-with-perl)
(tramp-test41-special-characters-with-ls, tramp-test42-utf8)
(tramp-test42-utf8-with-stat, tramp-test42-utf8-with-perl)
(tramp-test42-utf8-with-ls, tramp-test43-file-system-info)
(tramp-test44-asynchronous-requests, tramp-test45-auto-load)
(tramp-test45-delay-load, tramp-test45-recursive-load)
(tramp-test45-remote-load-path, tramp-test46-unload): Rename.
(tramp--test-special-characters, tramp--test-utf8)
(tramp--test-asynchronous-requests-timeout): Modify docstring.
2021-07-07 18:36:53 +02:00
|
|
|
(ert-deftest tramp-archive-test43-file-system-info ()
|
2017-12-09 14:34:30 +01:00
|
|
|
"Check that `file-system-info' returns proper values."
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
|
2023-01-06 13:34:33 +01:00
|
|
|
(let ((fsi (file-system-info tramp-archive-test-archive)))
|
2017-12-09 14:34:30 +01:00
|
|
|
(skip-unless fsi)
|
|
|
|
(should (and (consp fsi)
|
Upgrade to length* functions in Tramp
* lisp/net/tramp-compat.el (tramp-compat-replace-regexp-in-region):
Move up.
(tramp-compat-length<, tramp-compat-length>)
(tramp-compat-length=): New defaliases.
(tramp-compat-file-name-unquote, tramp-compat-take)
(tramp-compat-ntake): Use them.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
(tramp-find-host, tramp-buffer-name, tramp-make-tramp-file-name)
(tramp-completion-make-tramp-file-name, tramp-debug-buffer-name)
(tramp-completion-handle-file-name-all-completions)
(tramp-handle-directory-file-name)
(tramp-handle-expand-file-name)
(tramp-handle-file-name-as-directory)
(tramp-handle-file-name-completion)
(tramp-direct-async-process-p, tramp-call-process)
(tramp-read-passwd):
* lisp/net/tramp-adb.el (tramp-adb-get-device)
(tramp-adb-execute-adb-command, tramp-adb-maybe-open-connection):
* lisp/net/tramp-archive.el (tramp-archive-handle-directory-file-name):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-handle-get-home-directory)
(tramp-gvfs-handler-askpassword)
(tramp-gvfs-maybe-open-connection, tramp-get-media-devices):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-directory-p)
(tramp-sh-handle-insert-directory)
(tramp-sh-handle-expand-file-name, tramp-sh-handle-make-process)
(tramp-sh-gio-monitor-process-filter, tramp-set-remote-path)
(tramp-open-connection-setup-interactive-shell)
(tramp-maybe-open-connection, tramp-make-copy-program-file-name):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-expand-file-name, tramp-smb-handle-file-acl)
(tramp-smb-handle-insert-directory)
(tramp-smb-handle-set-file-acl)
(tramp-smb-handle-get-home-directory)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-expand-file-name)
(tramp-sudoedit-handle-file-name-all-completions): Use the new
functions.
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test43-file-system-info):
* test/lisp/net/tramp-tests.el (tramp-test26-file-name-completion)
(tramp-test31-memory-info, tramp-test35-remote-path)
(tramp-test43-file-system-info): Use new compat functions.
2023-01-15 17:50:17 +01:00
|
|
|
(tramp-compat-length= fsi 3)
|
2017-12-09 14:34:30 +01:00
|
|
|
(numberp (nth 0 fsi))
|
|
|
|
;; FREE and AVAIL are always 0.
|
|
|
|
(zerop (nth 1 fsi))
|
|
|
|
(zerop (nth 2 fsi))))))
|
|
|
|
|
2023-05-01 09:49:00 -07:00
|
|
|
;; `file-user-uid' and `file-group-gid' were introduced in Emacs 30.1.
|
|
|
|
(ert-deftest tramp-archive-test44-user-group-ids ()
|
2023-05-03 13:26:35 +02:00
|
|
|
"Check results of user/group functions.
|
|
|
|
`file-user-uid' and `file-group-gid' should return proper values."
|
2023-01-17 16:00:08 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2023-05-01 09:49:00 -07:00
|
|
|
(skip-unless (and (fboundp 'file-user-uid)
|
|
|
|
(fboundp 'file-group-gid)))
|
2023-01-17 16:00:08 +01:00
|
|
|
|
2023-08-19 10:08:35 +02:00
|
|
|
;; `file-user-uid' and `file-group-gid' exist since Emacs 30.1.
|
|
|
|
;; We don't want to see compiler warnings for older Emacsen.
|
|
|
|
(let* ((default-directory tramp-archive-test-archive)
|
|
|
|
(uid (with-no-warnings (file-user-uid)))
|
|
|
|
(gid (with-no-warnings (file-group-gid))))
|
|
|
|
(should (integerp uid))
|
|
|
|
(should (integerp gid))
|
|
|
|
(let ((default-directory tramp-archive-test-file-archive))
|
|
|
|
(should (equal uid (with-no-warnings (file-user-uid))))
|
|
|
|
(should (equal gid (with-no-warnings (file-group-gid)))))))
|
2023-01-17 16:00:08 +01:00
|
|
|
|
|
|
|
(ert-deftest tramp-archive-test48-auto-load ()
|
2018-02-03 13:22:56 +01:00
|
|
|
"Check that `tramp-archive' autoloads properly."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2018-02-03 13:22:56 +01:00
|
|
|
|
2018-02-04 13:25:10 +01:00
|
|
|
;; tramp-archive is neither loaded at Emacs startup, nor when
|
2018-03-15 11:32:50 +01:00
|
|
|
;; loading a file like "/mock::foo" (which loads Tramp).
|
2021-05-22 17:51:07 +02:00
|
|
|
(let ((code
|
2018-02-04 13:25:10 +01:00
|
|
|
"(progn \
|
2021-05-22 17:51:07 +02:00
|
|
|
(message \"tramp-archive loaded: %%s\" \
|
|
|
|
(featurep 'tramp-archive)) \
|
2021-10-20 18:14:00 +02:00
|
|
|
(let ((inhibit-message t)) \
|
|
|
|
(file-attributes %S \"/\")) \
|
2021-05-22 17:51:07 +02:00
|
|
|
(message \"tramp-archive loaded: %%s\" \
|
2021-10-20 18:14:00 +02:00
|
|
|
(featurep 'tramp-archive))))"))
|
2022-04-08 13:12:26 +02:00
|
|
|
(dolist (enabled '(t nil))
|
|
|
|
(dolist (default-directory
|
2023-05-15 16:25:23 +02:00
|
|
|
(append
|
|
|
|
`(,temporary-file-directory)
|
2022-04-08 13:12:26 +02:00
|
|
|
;; Starting Emacs in a directory which has
|
|
|
|
;; `tramp-archive-file-name-regexp' syntax is
|
|
|
|
;; supported only with Emacs > 27.2 (sigh!).
|
|
|
|
;; (Bug#48476)
|
2023-05-15 16:25:23 +02:00
|
|
|
(and (tramp-archive--test-emacs28-p)
|
|
|
|
`(,(file-name-as-directory
|
|
|
|
tramp-archive-test-directory)))))
|
2022-04-08 13:12:26 +02:00
|
|
|
(dolist (file `("/mock::foo" ,(concat tramp-archive-test-archive "foo")))
|
|
|
|
(should
|
|
|
|
(string-match
|
2023-01-06 13:34:33 +01:00
|
|
|
(rx
|
2022-09-09 17:10:28 +02:00
|
|
|
"tramp-archive loaded: "
|
|
|
|
(literal (symbol-name
|
|
|
|
(tramp-archive-file-name-p default-directory)))
|
|
|
|
(+ ascii)
|
|
|
|
"tramp-archive loaded: "
|
|
|
|
(literal (symbol-name
|
|
|
|
(or (tramp-archive-file-name-p default-directory)
|
|
|
|
(and enabled (tramp-archive-file-name-p file))))))
|
2022-04-08 13:12:26 +02:00
|
|
|
(shell-command-to-string
|
|
|
|
(format
|
|
|
|
"%s -batch -Q -L %s --eval %s --eval %s"
|
|
|
|
(shell-quote-argument
|
|
|
|
(expand-file-name invocation-name invocation-directory))
|
|
|
|
(mapconcat #'shell-quote-argument load-path " -L ")
|
|
|
|
(shell-quote-argument
|
|
|
|
(format "(setq tramp-archive-enabled %s)" enabled))
|
|
|
|
(shell-quote-argument (format code file)))))))))))
|
2018-02-03 13:22:56 +01:00
|
|
|
|
2023-01-17 16:00:08 +01:00
|
|
|
(ert-deftest tramp-archive-test48-delay-load ()
|
2018-02-03 13:22:56 +01:00
|
|
|
"Check that `tramp-archive' is loaded lazily, only when needed."
|
2018-08-08 14:59:56 +02:00
|
|
|
:tags '(:expensive-test)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2018-02-03 13:22:56 +01:00
|
|
|
|
2018-02-03 18:49:56 +01:00
|
|
|
;; tramp-archive is neither loaded at Emacs startup, nor when
|
|
|
|
;; loading a file like "/foo.tar". It is loaded only when
|
|
|
|
;; `tramp-archive-enabled' is t.
|
2018-02-03 13:22:56 +01:00
|
|
|
(let ((default-directory (expand-file-name temporary-file-directory))
|
|
|
|
(code
|
2018-02-03 18:49:56 +01:00
|
|
|
"(progn \
|
2018-02-04 13:25:10 +01:00
|
|
|
(setq tramp-archive-enabled %s) \
|
|
|
|
(message \"tramp-archive loaded: %%s\" \
|
|
|
|
(featurep 'tramp-archive)) \
|
|
|
|
(file-attributes %S \"/\") \
|
|
|
|
(message \"tramp-archive loaded: %%s\" \
|
|
|
|
(featurep 'tramp-archive)) \
|
|
|
|
(file-attributes %S \"/\") \
|
|
|
|
(message \"tramp-archive loaded: %%s\" \
|
|
|
|
(featurep 'tramp-archive)))"))
|
2018-02-03 18:49:56 +01:00
|
|
|
;; tramp-archive doesn't load when `tramp-archive-enabled' is nil.
|
|
|
|
(dolist (tae '(t nil))
|
|
|
|
(should
|
|
|
|
(string-match
|
2023-01-06 13:34:33 +01:00
|
|
|
(rx
|
2022-09-09 17:10:28 +02:00
|
|
|
"tramp-archive loaded: nil" (+ ascii)
|
|
|
|
"tramp-archive loaded: nil" (+ ascii)
|
|
|
|
"tramp-archive loaded: " (literal (symbol-name tae)))
|
2018-02-03 18:49:56 +01:00
|
|
|
(shell-command-to-string
|
2018-02-03 13:22:56 +01:00
|
|
|
(format
|
2018-02-03 18:49:56 +01:00
|
|
|
"%s -batch -Q -L %s --eval %s"
|
|
|
|
(shell-quote-argument
|
|
|
|
(expand-file-name invocation-name invocation-directory))
|
2019-02-28 10:33:05 +01:00
|
|
|
(mapconcat #'shell-quote-argument load-path " -L ")
|
2018-02-03 18:49:56 +01:00
|
|
|
(shell-quote-argument
|
|
|
|
(format
|
|
|
|
code tae tramp-archive-test-file-archive
|
|
|
|
(concat tramp-archive-test-archive "foo"))))))))))
|
2018-02-03 13:22:56 +01:00
|
|
|
|
2023-07-22 10:16:04 +02:00
|
|
|
(ert-deftest tramp-archive-test49-without-remote-files ()
|
|
|
|
"Check that Tramp can be suppressed."
|
|
|
|
(skip-unless tramp-archive-enabled)
|
|
|
|
|
|
|
|
(should (file-exists-p tramp-archive-test-archive))
|
|
|
|
(should-not (without-remote-files (file-exists-p tramp-archive-test-archive)))
|
|
|
|
(should (file-exists-p tramp-archive-test-archive))
|
|
|
|
|
|
|
|
(inhibit-remote-files)
|
|
|
|
(should-not (file-exists-p tramp-archive-test-archive))
|
|
|
|
(tramp-register-file-name-handlers)
|
|
|
|
(setq tramp-mode t)
|
|
|
|
(should (file-exists-p tramp-archive-test-archive)))
|
|
|
|
|
2017-12-17 11:31:23 +01:00
|
|
|
(ert-deftest tramp-archive-test99-libarchive-tests ()
|
2017-12-09 14:34:30 +01:00
|
|
|
"Run tests of libarchive test files."
|
2018-03-16 16:19:10 +01:00
|
|
|
:tags '(:expensive-test :unstable)
|
2018-02-03 18:49:56 +01:00
|
|
|
(skip-unless tramp-archive-enabled)
|
2017-12-09 14:34:30 +01:00
|
|
|
;; We do not want to run unless chosen explicitly. This test makes
|
|
|
|
;; sense only in my local environment. Michael Albinus.
|
|
|
|
(skip-unless
|
|
|
|
(equal
|
|
|
|
(ert--stats-selector ert--current-run-stats)
|
|
|
|
(ert-test-name (ert-running-test))))
|
|
|
|
|
|
|
|
(url-handler-mode)
|
|
|
|
(unwind-protect
|
|
|
|
(dolist (dir
|
|
|
|
'("~/Downloads" "/sftp::~/Downloads" "/ssh::~/Downloads"
|
|
|
|
"http://ftp.debian.org/debian/pool/main/c/coreutils"))
|
|
|
|
(dolist
|
|
|
|
(file
|
|
|
|
'("coreutils_8.26-3_amd64.deb"
|
|
|
|
"coreutils_8.26-3ubuntu3_amd64.deb"))
|
|
|
|
(setq file (expand-file-name file dir))
|
|
|
|
(when (file-exists-p file)
|
|
|
|
(setq file (expand-file-name "control.tar.gz/control" file))
|
|
|
|
(message "%s" file)
|
|
|
|
(should (file-attributes (file-name-as-directory file))))))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash))
|
|
|
|
|
|
|
|
(unwind-protect
|
|
|
|
(dolist (dir '("" "/sftp::" "/ssh::"))
|
|
|
|
(dolist
|
|
|
|
(file
|
|
|
|
(apply
|
|
|
|
'append
|
|
|
|
(mapcar
|
Use `rx' in Tramp where possible
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-cache.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-compat.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-ftp.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Use `rx' where possible.
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
Use `eval-when-compile'.
(tramp-adb-maybe-open-connection): Use file-property for "/". Use
`eval-when-compile'.
* lisp/net/tramp-cmds.el (mm-7bit-chars): Declare.
(tramp-reporter-dump-variable): Simplify point movement.
* lisp/net/tramp-gvfs.el (tramp-dbus-function): Fix typo.
(tramp-zeroconf-parse-device-names): Use `tramp-prefix-port-format'.
* lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell):
Use `eval-when-compile'. Improve sanity check.
* lisp/net/tramp.el (tramp-prefix-format, tramp-prefix-regexp)
(tramp-method-regexp, tramp-postfix-method-format)
(tramp-postfix-method-regexp, tramp-prefix-ipv6-format)
(tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format)
(tramp-postfix-ipv6-regexp, tramp-postfix-host-format)
(tramp-postfix-host-regexp, tramp-remote-file-name-spec-regexp)
(tramp-file-name-structure, tramp-file-name-regexp)
(tramp-completion-method-regexp)
(tramp-completion-file-name-regexp): Declare.
(tramp-set-syntax): Set also `tramp-completion-method-regexp'.
(tramp-volume-letter-regexp, tramp-completion-method-regexp-alist):
New defconsts.
(tramp-build-completion-method-regexp): New defun.
(tramp-completion-method-regexp): New defvar.
(tramp-completion-file-name-regexp-default)
(tramp-completion-file-name-regexp-simplified)
(tramp-completion-file-name-regexp-separate)
(tramp-completion-file-name-regexp-alist): Remove.
(tramp-build-completion-file-name-regexp): Rwrite.
(tramp-make-tramp-file-name): Use `tramp-archive-method'.
(tramp-handle-file-directory-p): Ignore errors.
(tramp-handle-find-backup-file-name, tramp-handle-lock-file)
(tramp-handle-make-auto-save-file-name): Use `eval-when-compile'.
* test/lisp/net/tramp-archive-tests.el:
* test/lisp/net/tramp-tests.el: Use `rx' where possible.
(tramp-test01-file-name-syntax): Adapt test.
2022-08-26 16:19:47 +02:00
|
|
|
(lambda (x)
|
|
|
|
(directory-files (concat dir x) 'full (rx "uu" eos) 'sort))
|
2017-12-09 14:34:30 +01:00
|
|
|
'("~/src/libarchive-3.2.2/libarchive/test"
|
|
|
|
"~/src/libarchive-3.2.2/cpio/test"
|
|
|
|
"~/src/libarchive-3.2.2/tar/test"))))
|
|
|
|
(setq file (file-name-as-directory file))
|
|
|
|
(cond
|
|
|
|
((not (tramp-archive-file-name-p file))
|
|
|
|
(message "skipped: %s" file))
|
|
|
|
((file-attributes file)
|
|
|
|
(message "%s" file))
|
|
|
|
(t (message "failed: %s" file)))
|
|
|
|
(tramp-archive-cleanup-hash)))
|
|
|
|
|
|
|
|
;; Cleanup.
|
|
|
|
(tramp-archive-cleanup-hash)))
|
|
|
|
|
|
|
|
(defun tramp-archive-test-all (&optional interactive)
|
Adapt Tramp docstrings according to checkdoc
* lisp/net/tramp.el (tramp-backup-directory-alist)
(tramp-echoed-echo-mark-regexp, tramp-syntax-values)
(tramp-lookup-syntax, tramp-build-prefix-format)
(tramp-build-prefix-regexp, tramp-build-method-regexp)
(tramp-build-postfix-method-format)
(tramp-build-postfix-method-regexp)
(tramp-build-prefix-ipv6-format, tramp-build-prefix-ipv6-regexp)
(tramp-build-postfix-ipv6-format)
(tramp-build-postfix-ipv6-regexp)
(tramp-build-postfix-host-format)
(tramp-build-postfix-host-regexp, tramp-unknown-id-string)
(tramp-unknown-id-integer, tramp-build-file-name-regexp)
(tramp-build-completion-file-name-regexp, tramp-chunksize)
(tramp-find-method, tramp-find-user, tramp-find-host)
(tramp-dissect-file-name, tramp-get-buffer)
(tramp-get-connection-buffer, tramp-debug-message, tramp-error)
(with-tramp-connection-property, tramp-run-real-handler)
(tramp-file-name-for-operation, tramp-file-name-handler)
(tramp-completion-file-name-handler)
(tramp-completion-handle-file-name-completion)
(tramp-completion-dissect-file-name)
(tramp-completion-dissect-file-name1)
(tramp-handle-file-name-as-directory)
(tramp-handle-file-name-directory)
(tramp-handle-file-name-nondirectory, tramp-mode-string-to-int)
(tramp-file-mode-from-int):
* lisp/net/tramp-adb.el (tramp-adb-file-name-p):
* lisp/net/tramp-archive.el (tramp-archive-run-real-handler)
(tramp-archive-file-name-handler)
(tramp-archive-dissect-file-name)
(with-parsed-tramp-archive-file-name)
(tramp-archive-gvfs-file-name, tramp-archive-handle-access-file):
* lisp/net/tramp-cmds.el (tramp-list-remote-buffers):
* lisp/net/tramp-compat.el (tramp-unload-file-name-handlers)
(tramp-compat-funcall, tramp-compat-tramp-file-name-slots):
* lisp/net/tramp-ftp.el (tramp-ftp-file-name-handler)
(tramp-ftp-file-name-p):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-p)
(tramp-gvfs-file-name-handler)
(tramp-gvfs-stringify-dbus-message)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-handler-mounted-unmounted):
* lisp/net/tramp-integration.el
(tramp-rfn-eshadow-update-overlay-regexp):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-p)
(tramp-rclone-file-name-handler, tramp-rclone-send-command):
* lisp/net/tramp-sh.el (tramp-sh--quoting-style-options)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-gvfs-monitor-dir-process-filter)
(tramp-sh-inotifywait-process-filter, tramp-find-executable)
(tramp-set-remote-path, tramp-open-shell, tramp-find-shell)
(tramp-send-command-and-check, tramp-shell-case-fold)
(tramp-get-remote-path):
* lisp/net/tramp-smb.el (tramp-smb-file-name-p)
(tramp-smb-file-name-handler)
(tramp-smb-do-file-attributes-with-stat)
(tramp-smb-handle-substitute-in-file-name)
(tramp-smb-get-stat-capability, tramp-smb-shell-quote-argument):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-p)
(tramp-sudoedit-file-name-handler)
(tramp-sudoedit-send-command-string):
* test/lisp/net/tramp-archive-tests.el (tramp-archive-test-all):
* test/lisp/net/tramp-tests.el (tramp--test-gvfs-p)
(tramp--test-with-proper-process-name-and-buffer)
(tramp-test-all): Adapt docstrings according to `checkdoc'.
2019-11-13 13:10:58 +01:00
|
|
|
"Run all tests for \\[tramp-archive].
|
|
|
|
If INTERACTIVE is non-nil, the tests are run interactively."
|
2017-12-09 14:34:30 +01:00
|
|
|
(interactive "p")
|
|
|
|
(funcall
|
2019-02-28 10:33:05 +01:00
|
|
|
(if interactive #'ert-run-tests-interactively #'ert-run-tests-batch)
|
2017-12-09 14:34:30 +01:00
|
|
|
"^tramp-archive"))
|
|
|
|
|
|
|
|
(provide 'tramp-archive-tests)
|
Sync with Tramp 2.5.0-pre
* doc/misc/tramp.texi: Protext Tramp x.y and Emacs x.y by @w{}.
(GVFS-based methods): Move "GNOME Online Accounts" index.
(Customizing Methods, Android shell setup, File name completion)
(Frequently Asked Questions): Fix typos.
* doc/misc/trampver.texi: Change version to "2.5.0-pre".
* lisp/net/trampver.el: Change version to "2.5.0-pre".
(inhibit-message): Don't declare.
* lisp/net/tramp.el: Bump version to 2.5.0-pre. Require Emacs 25.1.
(tramp-debug-message): Simplify.
(tramp-message): Don't use `tramp-message-show-message'.
(tramp-with-demoted-errors, with-parsed-tramp-file-name)
(with-tramp-file-property, with-tramp-connection-property):
Adapt `declare' form.
(with-tramp-progress-reporter): Suppress progress reporter when
noninteractive.
(tramp-completion-mode, tramp-completion-mode-p): Remove.
* lisp/net/tramp-compat.el (tramp-compat-process-running-p)
(format-message): Remove compatibility code.
(tramp-compat-directory-name-p)
(tramp-compat-tramp-file-name-slots): Remove.
* lisp/net/tramp.el (tramp-debug-message, tramp-message)
(tramp-backtrace, tramp-error, tramp-error-with-buffer)
(tramp-user-error, tramp-with-demoted-errors)
(tramp-signal-hook-function):
* lisp/net/tramp-compat.el (tramp-compat-funcall)
* lisp/net/tramp-gvfs.el (tramp-dbus-function):
Add `tramp-suppress-trace' property.
* lisp/net/tramp.el (tramp-get-method-parameter)
(tramp-dissect-file-name, tramp-error, tramp-error-with-buffer)
(tramp-user-error, with-parsed-tramp-file-name)
(with-tramp-progress-reporter, tramp-file-name-handler)
(tramp-completion-file-name-handler, tramp-autoload-file-name-handler)
(tramp-register-file-name-handlers, tramp-connectable-p)
(tramp-handle-file-modes, tramp-handle-file-regular-p)
(tramp-handle-file-truename, tramp-handle-insert-directory)
(tramp-handle-load, tramp-set-file-uid-gid):
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler)
(tramp-adb-handle-file-truename, tramp-adb-handle-copy-file)
(tramp-adb-handle-rename-file):
* lisp/net/tramp-archive.el (with-parsed-tramp-archive-file-name):
* lisp/net/tramp-cache.el (tramp-get-file-property, tramp-cache-print):
* lisp/net/tramp-compat.el (tramp-compat-process-running-p)
(tramp-compat-exec-path):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler)
(tramp-gvfs-dbus-byte-array-to-string)
(tramp-gvfs-do-copy-or-rename-file):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler)
(tramp-rclone-do-copy-or-rename-file):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-truename)
(tramp-sh-handle-copy-directory, tramp-do-copy-or-rename-file)
(tramp-sh-handle-insert-directory, tramp-sh-file-name-handler)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler)
(tramp-smb-handle-copy-file, tramp-smb-handle-copy-directory)
(tramp-smb-handle-copy-file, tramp-smb-handle-insert-directory)
(tramp-smb-handle-rename-file, tramp-smb-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler)
(tramp-sudoedit-do-copy-or-rename-file)
(tramp-sudoedit-handle-file-truename):
Use `if-let', `when-let', `directory-name-p', `inhibit-message',
`non-essential and `cl-struct-slot-info'. Don't use `seconds-to-time'.
* test/lisp/net/tramp-archive-tests.el (tramp-message-show-message):
Don't set.
* test/lisp/net/tramp-tests.el (inhibit-message): Don't declare.
(tramp-message-show-message): Don't set.
(tramp-test06-directory-file-name): Use `non-essential'.
(tramp-test10-write-region): Use `inhibit-message'.
(tramp-test36-vc-registered): No special handling for old Emacsen.
(tramp--test-emacs25-p): Remove.
(tramp-test45-unload): Special case of `tramp-completion-mode'.
2020-01-19 14:11:07 +01:00
|
|
|
|
2017-12-09 14:34:30 +01:00
|
|
|
;;; tramp-archive-tests.el ends here
|