2020-06-07 14:57:32 +00:00
|
|
|
|
;;; tramp-crypt.el --- Tramp crypt utilities -*- lexical-binding:t -*-
|
|
|
|
|
|
2023-01-01 10:31:12 +00:00
|
|
|
|
;; Copyright (C) 2020-2023 Free Software Foundation, Inc.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Michael Albinus <michael.albinus@gmx.de>
|
|
|
|
|
;; Keywords: comm, processes
|
|
|
|
|
;; Package: tramp
|
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or 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.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but 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
|
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
2022-07-18 12:22:33 +00:00
|
|
|
|
;; Access functions for encrypted remote files. It uses encfs to
|
2020-06-12 18:17:02 +00:00
|
|
|
|
;; encrypt / decrypt the files on a remote directory. A remote
|
2022-07-18 12:37:15 +00:00
|
|
|
|
;; directory where you wish files to be encrypted must be declared in
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; `tramp-crypt-directories' via command `tramp-crypt-add-directory'.
|
|
|
|
|
;; All files in that directory, including all subdirectories, are
|
2022-07-18 12:37:15 +00:00
|
|
|
|
;; stored encrypted. This includes file names and directory
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; names.
|
|
|
|
|
|
|
|
|
|
;; This package is just responsible for the encryption part. Copying
|
2022-07-18 12:22:33 +00:00
|
|
|
|
;; of the encrypted files is still the responsibility of the remote
|
|
|
|
|
;; file name handlers.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
;; A password protected encfs configuration file is created the very
|
2022-07-18 12:37:15 +00:00
|
|
|
|
;; first time you access an encrypted remote directory. It is kept in
|
|
|
|
|
;; your user directory (usually "~/.emacs.d/") with the url-encoded
|
|
|
|
|
;; directory name as part of the basename, and ".encfs6.xml" as
|
|
|
|
|
;; suffix. Do not lose this file and the corresponding password;
|
|
|
|
|
;; otherwise there is no way to decrypt your encrypted files.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
;; If the user option `tramp-crypt-save-encfs-config-remote' is
|
|
|
|
|
;; non-nil (the default), the encfs configuration file ".encfs6.xml"
|
2022-07-18 12:37:15 +00:00
|
|
|
|
;; is also kept in the encrypted remote directory. It depends on you,
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; whether you regard the password protection of this file as
|
2022-07-18 12:37:15 +00:00
|
|
|
|
;; sufficient security.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
2020-06-10 17:36:53 +00:00
|
|
|
|
;; If you use a remote file name with a quoted localname part, this
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; localname and the corresponding file will not be encrypted/
|
2022-07-18 12:37:15 +00:00
|
|
|
|
;; decrypted. For example, if you have an encrypted remote directory
|
2022-07-18 12:22:33 +00:00
|
|
|
|
;; "/nextcloud:user@host:/encrypted_dir", the command
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;;
|
2022-07-18 12:22:33 +00:00
|
|
|
|
;; C-x d /nextcloud:user@host:/encrypted_dir
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;;
|
|
|
|
|
;; will show the directory listing with the plain file names, and the
|
|
|
|
|
;; command
|
|
|
|
|
;;
|
2022-07-18 12:22:33 +00:00
|
|
|
|
;; C-x d /nextcloud:user@host:/:/encrypted_dir
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;;
|
|
|
|
|
;; will show the directory with the encrypted file names, and visiting
|
2022-07-18 12:22:33 +00:00
|
|
|
|
;; a file will show its encrypted contents. However, it is highly
|
2022-07-18 12:37:15 +00:00
|
|
|
|
;; discouraged to mix encrypted and non-encrypted files in the same
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; directory.
|
|
|
|
|
|
2022-07-18 12:37:15 +00:00
|
|
|
|
;; To disable encryption for a particular remote directory, use the
|
|
|
|
|
;; command `tramp-crypt-remove-directory'.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(eval-when-compile (require 'cl-lib))
|
|
|
|
|
(require 'tramp)
|
|
|
|
|
|
|
|
|
|
(autoload 'prop-match-beginning "text-property-search")
|
|
|
|
|
(autoload 'prop-match-end "text-property-search")
|
|
|
|
|
(autoload 'text-property-search-forward "text-property-search")
|
|
|
|
|
|
|
|
|
|
(defconst tramp-crypt-method "crypt"
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Method name for encrypted remote directories.")
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(defcustom tramp-crypt-encfs-program "encfs"
|
|
|
|
|
"Name of the encfs program."
|
|
|
|
|
:group 'tramp
|
|
|
|
|
:version "28.1"
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
|
|
|
|
(defcustom tramp-crypt-encfsctl-program "encfsctl"
|
|
|
|
|
"Name of the encfsctl program."
|
|
|
|
|
:group 'tramp
|
|
|
|
|
:version "28.1"
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
|
|
|
|
(defcustom tramp-crypt-encfs-option "--standard"
|
|
|
|
|
"Configuration option for encfs.
|
|
|
|
|
This could be either \"--standard\" or \"--paranoia\". The file
|
|
|
|
|
name IV chaining mode mode will always be disabled when
|
2022-07-18 12:22:33 +00:00
|
|
|
|
initializing a new encrypted remote directory."
|
2020-06-07 14:57:32 +00:00
|
|
|
|
:group 'tramp
|
|
|
|
|
:version "28.1"
|
|
|
|
|
:type '(choice (const "--standard")
|
|
|
|
|
(const "--paranoia")))
|
|
|
|
|
|
|
|
|
|
;; We check only for encfs, assuming that encfsctl will be available
|
|
|
|
|
;; as well. The autoloaded value is nil, the check will run when
|
|
|
|
|
;; tramp-crypt.el is loaded by `tramp-crypt-add-directory'. It is a
|
|
|
|
|
;; common technique to let-bind this variable to nil in order to
|
|
|
|
|
;; suppress the file name operation of this package.
|
|
|
|
|
;;;###tramp-autoload
|
|
|
|
|
(defvar tramp-crypt-enabled nil
|
|
|
|
|
"Non-nil when encryption support is available.")
|
|
|
|
|
(setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program))
|
|
|
|
|
|
2021-03-13 13:35:39 +00:00
|
|
|
|
;; This function takes action since Emacs 28.1, when
|
|
|
|
|
;; `read-extended-command-predicate' is set to
|
|
|
|
|
;; `command-completion-default-include-p'.
|
2021-03-15 08:49:20 +00:00
|
|
|
|
(defun tramp-crypt-command-completion-p (symbol _buffer)
|
2021-03-13 13:35:39 +00:00
|
|
|
|
"A predicate for Tramp interactive commands.
|
|
|
|
|
They are completed by \"M-x TAB\" only when encryption support is enabled."
|
2021-03-15 08:49:20 +00:00
|
|
|
|
(and tramp-crypt-enabled
|
|
|
|
|
;; `tramp-crypt-remove-directory' needs to be completed only in
|
2022-07-18 12:22:33 +00:00
|
|
|
|
;; case we have already encrypted directories.
|
2021-03-15 08:49:20 +00:00
|
|
|
|
(or (not (eq symbol #'tramp-crypt-remove-directory))
|
|
|
|
|
tramp-crypt-directories)))
|
2021-03-13 13:35:39 +00:00
|
|
|
|
|
2020-06-08 08:18:35 +00:00
|
|
|
|
;;;###tramp-autoload
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(defconst tramp-crypt-encfs-config ".encfs6.xml"
|
|
|
|
|
"Encfs configuration file name.")
|
|
|
|
|
|
|
|
|
|
(defcustom tramp-crypt-save-encfs-config-remote t
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Whether to keep the encfs configuration file in the encrypted remote directory."
|
2020-06-07 14:57:32 +00:00
|
|
|
|
:group 'tramp
|
|
|
|
|
:version "28.1"
|
2020-09-25 13:15:21 +00:00
|
|
|
|
:type 'boolean)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
2020-06-08 08:18:35 +00:00
|
|
|
|
;;;###tramp-autoload
|
|
|
|
|
(defvar tramp-crypt-directories nil
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"List of encrypted remote directories.")
|
2020-06-08 08:18:35 +00:00
|
|
|
|
|
|
|
|
|
;; It must be a `defsubst' in order to push the whole code into
|
|
|
|
|
;; tramp-loaddefs.el. Otherwise, there would be recursive autoloading.
|
|
|
|
|
;;;###tramp-autoload
|
|
|
|
|
(defsubst tramp-crypt-file-name-p (name)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Return the encrypted remote directory NAME belongs to.
|
2022-07-18 14:54:16 +00:00
|
|
|
|
If NAME doesn't belong to an encrypted remote directory, return nil."
|
2020-06-08 08:18:35 +00:00
|
|
|
|
(catch 'crypt-file-name-p
|
|
|
|
|
(and tramp-crypt-enabled (stringp name)
|
|
|
|
|
(not (tramp-compat-file-name-quoted-p name))
|
|
|
|
|
(not (string-suffix-p tramp-crypt-encfs-config name))
|
|
|
|
|
(dolist (dir tramp-crypt-directories)
|
|
|
|
|
(and (string-prefix-p
|
|
|
|
|
dir (file-name-as-directory (expand-file-name name)))
|
2022-07-03 16:23:55 +00:00
|
|
|
|
(throw 'crypt-file-name-p dir))))))
|
2020-06-08 08:18:35 +00:00
|
|
|
|
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
;; New handlers should be added here.
|
|
|
|
|
;;;###tramp-autoload
|
|
|
|
|
(defconst tramp-crypt-file-name-handler-alist
|
2021-11-15 16:50:15 +00:00
|
|
|
|
'(;; `abbreviate-file-name' performed by default handler.
|
|
|
|
|
(access-file . tramp-crypt-handle-access-file)
|
2020-06-18 18:00:26 +00:00
|
|
|
|
(add-name-to-file . tramp-handle-add-name-to-file)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; `byte-compiler-base-file-name' performed by default handler.
|
|
|
|
|
(copy-directory . tramp-handle-copy-directory)
|
|
|
|
|
(copy-file . tramp-crypt-handle-copy-file)
|
|
|
|
|
(delete-directory . tramp-crypt-handle-delete-directory)
|
|
|
|
|
(delete-file . tramp-crypt-handle-delete-file)
|
|
|
|
|
;; `diff-latest-backup-file' performed by default handler.
|
|
|
|
|
;; `directory-file-name' performed by default handler.
|
|
|
|
|
(directory-files . tramp-crypt-handle-directory-files)
|
|
|
|
|
(directory-files-and-attributes
|
|
|
|
|
. tramp-handle-directory-files-and-attributes)
|
|
|
|
|
(dired-compress-file . ignore)
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(dired-uncache . tramp-handle-dired-uncache)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(exec-path . ignore)
|
|
|
|
|
;; `expand-file-name' performed by default handler.
|
|
|
|
|
(file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
|
|
|
|
|
(file-acl . ignore)
|
|
|
|
|
(file-attributes . tramp-crypt-handle-file-attributes)
|
|
|
|
|
(file-directory-p . tramp-handle-file-directory-p)
|
|
|
|
|
(file-equal-p . tramp-handle-file-equal-p)
|
|
|
|
|
(file-executable-p . tramp-crypt-handle-file-executable-p)
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
(file-exists-p . tramp-crypt-handle-file-exists-p)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(file-in-directory-p . tramp-handle-file-in-directory-p)
|
|
|
|
|
(file-local-copy . tramp-handle-file-local-copy)
|
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 16:36:53 +00:00
|
|
|
|
(file-locked-p . tramp-crypt-handle-file-locked-p)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(file-modes . tramp-handle-file-modes)
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(file-name-all-completions . tramp-crypt-handle-file-name-all-completions)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; `file-name-as-directory' performed by default handler.
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(file-name-case-insensitive-p . ignore)
|
|
|
|
|
(file-name-completion . tramp-handle-file-name-completion)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; `file-name-directory' performed by default handler.
|
|
|
|
|
;; `file-name-nondirectory' performed by default handler.
|
|
|
|
|
;; `file-name-sans-versions' performed by default handler.
|
|
|
|
|
(file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
|
2022-02-16 19:22:45 +00:00
|
|
|
|
(file-notify-add-watch . tramp-handle-file-notify-add-watch)
|
|
|
|
|
(file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
|
|
|
|
|
(file-notify-valid-p . tramp-handle-file-notify-valid-p)
|
2020-06-14 13:31:17 +00:00
|
|
|
|
(file-ownership-preserved-p . tramp-crypt-handle-file-ownership-preserved-p)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(file-readable-p . tramp-crypt-handle-file-readable-p)
|
|
|
|
|
(file-regular-p . tramp-handle-file-regular-p)
|
|
|
|
|
;; `file-remote-p' performed by default handler.
|
|
|
|
|
(file-selinux-context . ignore)
|
|
|
|
|
(file-symlink-p . tramp-handle-file-symlink-p)
|
|
|
|
|
(file-system-info . tramp-crypt-handle-file-system-info)
|
2020-06-12 18:17:02 +00:00
|
|
|
|
;; `file-truename' performed by default handler.
|
|
|
|
|
(file-writable-p . tramp-crypt-handle-file-writable-p)
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(find-backup-file-name . tramp-handle-find-backup-file-name)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; `get-file-buffer' performed by default handler.
|
|
|
|
|
(insert-directory . tramp-crypt-handle-insert-directory)
|
2022-01-26 13:05:11 +00:00
|
|
|
|
(insert-file-contents . tramp-handle-insert-file-contents)
|
2022-04-05 15:08:03 +00:00
|
|
|
|
(list-system-processes . ignore)
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(load . tramp-handle-load)
|
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 16:36:53 +00:00
|
|
|
|
(lock-file . tramp-crypt-handle-lock-file)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
|
|
|
|
|
(make-directory . tramp-crypt-handle-make-directory)
|
2020-06-18 18:00:26 +00:00
|
|
|
|
(make-directory-internal . ignore)
|
2021-07-13 17:50:05 +00:00
|
|
|
|
(make-lock-file-name . tramp-handle-make-lock-file-name)
|
2020-06-18 18:00:26 +00:00
|
|
|
|
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(make-process . ignore)
|
|
|
|
|
(make-symbolic-link . tramp-handle-make-symbolic-link)
|
2022-11-27 15:57:03 +00:00
|
|
|
|
(memory-info . ignore)
|
2022-04-05 15:08:03 +00:00
|
|
|
|
(process-attributes . ignore)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(process-file . ignore)
|
|
|
|
|
(rename-file . tramp-crypt-handle-rename-file)
|
|
|
|
|
(set-file-acl . ignore)
|
|
|
|
|
(set-file-modes . tramp-crypt-handle-set-file-modes)
|
|
|
|
|
(set-file-selinux-context . ignore)
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(set-file-times . tramp-crypt-handle-set-file-times)
|
|
|
|
|
(set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(shell-command . ignore)
|
|
|
|
|
(start-file-process . ignore)
|
|
|
|
|
;; `substitute-in-file-name' performed by default handler.
|
2020-06-18 18:00:26 +00:00
|
|
|
|
(temporary-file-directory . tramp-handle-temporary-file-directory)
|
2022-03-07 12:42:30 +00:00
|
|
|
|
;; `tramp-get-home-directory' performed by default-handler.
|
2020-06-14 13:31:17 +00:00
|
|
|
|
;; `tramp-get-remote-gid' performed by default handler.
|
2022-09-06 10:33:19 +00:00
|
|
|
|
;; `tramp-get-remote-groups' performed by default handler.
|
2020-06-14 13:31:17 +00:00
|
|
|
|
;; `tramp-get-remote-uid' performed by default handler.
|
2020-06-10 17:36:53 +00:00
|
|
|
|
(tramp-set-file-uid-gid . tramp-crypt-handle-set-file-uid-gid)
|
2020-06-18 18:00:26 +00:00
|
|
|
|
(unhandled-file-name-directory . ignore)
|
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 16:36:53 +00:00
|
|
|
|
(unlock-file . tramp-crypt-handle-unlock-file)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(vc-registered . ignore)
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(write-region . tramp-handle-write-region))
|
|
|
|
|
"Alist of handler functions for crypt method.
|
|
|
|
|
Operations not mentioned here will be handled by the default Emacs primitives.")
|
|
|
|
|
|
|
|
|
|
(defsubst tramp-crypt-file-name-for-operation (operation &rest args)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Like `tramp-file-name-for-operation', but for encrypted remote files."
|
2020-06-15 14:24:22 +00:00
|
|
|
|
(let ((tfnfo (apply #'tramp-file-name-for-operation operation args)))
|
|
|
|
|
;; `tramp-file-name-for-operation' returns already the first argument
|
|
|
|
|
;; if it is remote. So we check a possible second argument.
|
|
|
|
|
(unless (tramp-crypt-file-name-p tfnfo)
|
|
|
|
|
(setq tfnfo (apply
|
2020-06-18 18:00:26 +00:00
|
|
|
|
#'tramp-file-name-for-operation operation
|
Fix tramp-compat-temporary-file-directory implementation
* lisp/net/tramp-archive.el
(tramp-archive-handle-temporary-file-directory):
Use `tramp-compat-temporary-file-directory-function'.
* lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory):
Make it a defconst.
* lisp/net/tramp.el (tramp-get-debug-buffer, tramp-get-debug-file-name)
(tramp-debug-message, tramp-file-name-handler, tramp-parse-file)
(tramp-parse-shostkeys-sknownhosts)
(tramp-handle-expand-file-name, tramp-handle-make-process)
(tramp-local-host-p, tramp-call-process)
(tramp-call-process-region, tramp-process-lines)
(tramp-read-passwd):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-compat.el (tramp-compat-make-temp-name)
(tramp-compat-make-temp-file);
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-for-operation)
(tramp-crypt-maybe-open-connection, tramp-crypt-send-command)
(tramp-crypt-do-encrypt-or-decrypt-file-name):
* lisp/net/tramp-fuse.el (tramp-fuse-mount-point, tramp-fuse-mounted-p)
(tramp-fuse-unmount):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-expand-file-name)
(tramp-sh-handle-file-local-copy, )
(tramp-sh-handle-write-region, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Use it.
2021-09-21 18:26:59 +00:00
|
|
|
|
(cons tramp-compat-temporary-file-directory (cdr args)))))
|
2020-06-15 14:24:22 +00:00
|
|
|
|
tfnfo))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-run-real-handler (operation args)
|
|
|
|
|
"Invoke normal file name handler for OPERATION.
|
|
|
|
|
First arg specifies the OPERATION, second arg ARGS is a list of
|
|
|
|
|
arguments to pass to the OPERATION."
|
|
|
|
|
(let* ((inhibit-file-name-handlers
|
|
|
|
|
`(tramp-crypt-file-name-handler
|
|
|
|
|
.
|
|
|
|
|
,(and (eq inhibit-file-name-operation operation)
|
|
|
|
|
inhibit-file-name-handlers)))
|
|
|
|
|
(inhibit-file-name-operation operation))
|
|
|
|
|
(apply operation args)))
|
|
|
|
|
|
|
|
|
|
;;;###tramp-autoload
|
|
|
|
|
(defun tramp-crypt-file-name-handler (operation &rest args)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Invoke the encrypted remote file related OPERATION.
|
2021-02-03 17:48:09 +00:00
|
|
|
|
First arg specifies the OPERATION, second arg is a list of
|
2020-06-07 14:57:32 +00:00
|
|
|
|
arguments to pass to the OPERATION."
|
2020-06-15 14:24:22 +00:00
|
|
|
|
(if-let ((filename
|
|
|
|
|
(apply #'tramp-crypt-file-name-for-operation operation args))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(fn (and (tramp-crypt-file-name-p filename)
|
|
|
|
|
(assoc operation tramp-crypt-file-name-handler-alist))))
|
|
|
|
|
(save-match-data (apply (cdr fn) args))
|
|
|
|
|
(tramp-crypt-run-real-handler operation args)))
|
|
|
|
|
|
|
|
|
|
;;;###tramp-autoload
|
|
|
|
|
(progn (defun tramp-register-crypt-file-name-handler ()
|
|
|
|
|
"Add crypt file name handler to `file-name-handler-alist'."
|
|
|
|
|
(when (and tramp-crypt-enabled tramp-crypt-directories)
|
|
|
|
|
(add-to-list 'file-name-handler-alist
|
|
|
|
|
(cons tramp-file-name-regexp #'tramp-crypt-file-name-handler))
|
|
|
|
|
(put #'tramp-crypt-file-name-handler 'safe-magic t))))
|
|
|
|
|
|
|
|
|
|
(tramp-register-file-name-handlers)
|
|
|
|
|
|
|
|
|
|
;; Mark `operations' the handler is responsible for.
|
|
|
|
|
(put #'tramp-crypt-file-name-handler 'operations
|
|
|
|
|
(mapcar #'car tramp-crypt-file-name-handler-alist))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; File name conversions.
|
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-config-file-name (vec)
|
|
|
|
|
"Return the encfs config file name for VEC."
|
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 17:17:32 +00:00
|
|
|
|
(expand-file-name
|
|
|
|
|
(locate-user-emacs-file
|
|
|
|
|
(concat "tramp-" (tramp-file-name-host vec) tramp-crypt-encfs-config))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-maybe-open-connection (vec)
|
|
|
|
|
"Maybe open a connection VEC.
|
|
|
|
|
Does not do anything if a connection is already open, but re-opens the
|
|
|
|
|
connection if a previous connection has died for some reason."
|
|
|
|
|
;; For password handling, we need a process bound to the connection
|
|
|
|
|
;; buffer. Therefore, we create a dummy process. Maybe there is a
|
|
|
|
|
;; better solution?
|
|
|
|
|
(unless (get-buffer-process (tramp-get-connection-buffer vec))
|
|
|
|
|
(let ((p (make-network-process
|
|
|
|
|
:name (tramp-get-connection-name vec)
|
|
|
|
|
:buffer (tramp-get-connection-buffer vec)
|
|
|
|
|
:server t :host 'local :service t :noquery t)))
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
(process-put p 'tramp-vector vec)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(set-process-query-on-exit-flag p nil)))
|
|
|
|
|
|
2022-12-15 15:36:38 +00:00
|
|
|
|
;; The following operations must be performed without
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; `tramp-crypt-file-name-handler'.
|
|
|
|
|
(let* (tramp-crypt-enabled
|
|
|
|
|
;; Don't check for a proper method.
|
|
|
|
|
(non-essential t)
|
|
|
|
|
(remote-config
|
|
|
|
|
(expand-file-name
|
|
|
|
|
tramp-crypt-encfs-config (tramp-crypt-get-remote-dir vec)))
|
|
|
|
|
(local-config (tramp-crypt-config-file-name vec)))
|
|
|
|
|
;; There is no local encfs6 config file.
|
2021-12-27 18:51:58 +00:00
|
|
|
|
(unless (file-exists-p local-config)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(if (and tramp-crypt-save-encfs-config-remote
|
|
|
|
|
(file-exists-p remote-config))
|
|
|
|
|
;; Copy remote encfs6 config file if possible.
|
|
|
|
|
(copy-file remote-config local-config 'ok 'keep)
|
|
|
|
|
|
|
|
|
|
;; Create local encfs6 config file otherwise.
|
Fix tramp-compat-temporary-file-directory implementation
* lisp/net/tramp-archive.el
(tramp-archive-handle-temporary-file-directory):
Use `tramp-compat-temporary-file-directory-function'.
* lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory):
Make it a defconst.
* lisp/net/tramp.el (tramp-get-debug-buffer, tramp-get-debug-file-name)
(tramp-debug-message, tramp-file-name-handler, tramp-parse-file)
(tramp-parse-shostkeys-sknownhosts)
(tramp-handle-expand-file-name, tramp-handle-make-process)
(tramp-local-host-p, tramp-call-process)
(tramp-call-process-region, tramp-process-lines)
(tramp-read-passwd):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-compat.el (tramp-compat-make-temp-name)
(tramp-compat-make-temp-file);
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-for-operation)
(tramp-crypt-maybe-open-connection, tramp-crypt-send-command)
(tramp-crypt-do-encrypt-or-decrypt-file-name):
* lisp/net/tramp-fuse.el (tramp-fuse-mount-point, tramp-fuse-mounted-p)
(tramp-fuse-unmount):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-expand-file-name)
(tramp-sh-handle-file-local-copy, )
(tramp-sh-handle-write-region, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Use it.
2021-09-21 18:26:59 +00:00
|
|
|
|
(let* ((default-directory tramp-compat-temporary-file-directory)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(tmpdir1 (file-name-as-directory
|
|
|
|
|
(tramp-compat-make-temp-file " .crypt" 'dir-flag)))
|
|
|
|
|
(tmpdir2 (file-name-as-directory
|
|
|
|
|
(tramp-compat-make-temp-file " .nocrypt" 'dir-flag))))
|
|
|
|
|
;; Enable `auth-source', unless "emacs -Q" has been called.
|
|
|
|
|
(tramp-set-connection-property
|
|
|
|
|
vec "first-password-request" tramp-cache-read-persistent-data)
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert
|
|
|
|
|
(tramp-read-passwd
|
|
|
|
|
(tramp-get-connection-process vec)
|
|
|
|
|
(format
|
|
|
|
|
"New EncFS Password for %s " (tramp-crypt-get-remote-dir vec))))
|
|
|
|
|
(when
|
|
|
|
|
(zerop
|
|
|
|
|
(tramp-call-process-region
|
|
|
|
|
vec (point-min) (point-max)
|
|
|
|
|
tramp-crypt-encfs-program nil (tramp-get-connection-buffer vec)
|
|
|
|
|
nil tramp-crypt-encfs-option "--extpass=cat" tmpdir1 tmpdir2))
|
|
|
|
|
;; Save the password.
|
|
|
|
|
(ignore-errors
|
|
|
|
|
(and (functionp tramp-password-save-function)
|
|
|
|
|
(funcall tramp-password-save-function)))))
|
|
|
|
|
|
|
|
|
|
;; Write local config file. Suppress file name IV chaining mode.
|
|
|
|
|
(with-temp-file local-config
|
|
|
|
|
(insert-file-contents
|
|
|
|
|
(expand-file-name tramp-crypt-encfs-config tmpdir1))
|
|
|
|
|
(when (search-forward
|
|
|
|
|
"<chainedNameIV>1</chainedNameIV>" nil 'noerror)
|
|
|
|
|
(replace-match "<chainedNameIV>0</chainedNameIV>")))
|
|
|
|
|
|
|
|
|
|
;; Unmount encfs. Delete temporary directories.
|
|
|
|
|
(tramp-call-process
|
|
|
|
|
vec tramp-crypt-encfs-program nil nil nil
|
|
|
|
|
"--unmount" tmpdir1 tmpdir2)
|
|
|
|
|
(delete-directory tmpdir1 'recursive)
|
|
|
|
|
(delete-directory tmpdir2)
|
|
|
|
|
|
|
|
|
|
;; Copy local encfs6 config file to remote.
|
|
|
|
|
(when tramp-crypt-save-encfs-config-remote
|
|
|
|
|
(copy-file local-config remote-config 'ok 'keep)))))))
|
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-send-command (vec &rest args)
|
|
|
|
|
"Send encfsctl command to connection VEC.
|
2020-06-12 18:17:02 +00:00
|
|
|
|
ARGS are the arguments. It returns t if ran successful, and nil otherwise."
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(tramp-crypt-maybe-open-connection vec)
|
|
|
|
|
(with-current-buffer (tramp-get-connection-buffer vec)
|
2020-06-15 14:24:22 +00:00
|
|
|
|
(erase-buffer)
|
|
|
|
|
(set-buffer-multibyte nil))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(let* (;; Don't check for a proper method.
|
|
|
|
|
(non-essential t)
|
Fix tramp-compat-temporary-file-directory implementation
* lisp/net/tramp-archive.el
(tramp-archive-handle-temporary-file-directory):
Use `tramp-compat-temporary-file-directory-function'.
* lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory):
Make it a defconst.
* lisp/net/tramp.el (tramp-get-debug-buffer, tramp-get-debug-file-name)
(tramp-debug-message, tramp-file-name-handler, tramp-parse-file)
(tramp-parse-shostkeys-sknownhosts)
(tramp-handle-expand-file-name, tramp-handle-make-process)
(tramp-local-host-p, tramp-call-process)
(tramp-call-process-region, tramp-process-lines)
(tramp-read-passwd):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-compat.el (tramp-compat-make-temp-name)
(tramp-compat-make-temp-file);
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-for-operation)
(tramp-crypt-maybe-open-connection, tramp-crypt-send-command)
(tramp-crypt-do-encrypt-or-decrypt-file-name):
* lisp/net/tramp-fuse.el (tramp-fuse-mount-point, tramp-fuse-mounted-p)
(tramp-fuse-unmount):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-expand-file-name)
(tramp-sh-handle-file-local-copy, )
(tramp-sh-handle-write-region, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Use it.
2021-09-21 18:26:59 +00:00
|
|
|
|
(default-directory tramp-compat-temporary-file-directory)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; We cannot add it to `process-environment', because
|
|
|
|
|
;; `tramp-call-process-region' doesn't use it.
|
|
|
|
|
(encfs-config
|
|
|
|
|
(format "ENCFS6_CONFIG=%s" (tramp-crypt-config-file-name vec)))
|
|
|
|
|
(args (delq nil args)))
|
|
|
|
|
;; Enable `auth-source', unless "emacs -Q" has been called.
|
|
|
|
|
(tramp-set-connection-property
|
|
|
|
|
vec "first-password-request" tramp-cache-read-persistent-data)
|
|
|
|
|
(insert
|
|
|
|
|
(tramp-read-passwd
|
|
|
|
|
(tramp-get-connection-process vec)
|
|
|
|
|
(format "EncFS Password for %s " (tramp-crypt-get-remote-dir vec))))
|
|
|
|
|
(when (zerop
|
|
|
|
|
(apply
|
|
|
|
|
#'tramp-call-process-region vec (point-min) (point-max)
|
|
|
|
|
"env" nil (tramp-get-connection-buffer vec)
|
|
|
|
|
nil encfs-config tramp-crypt-encfsctl-program
|
|
|
|
|
(car args) "--extpass=cat" (cdr args)))
|
|
|
|
|
;; Save the password.
|
|
|
|
|
(ignore-errors
|
|
|
|
|
(and (functionp tramp-password-save-function)
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(funcall tramp-password-save-function)))
|
|
|
|
|
t))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-do-encrypt-or-decrypt-file-name (op name)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Return encrypted / decrypted NAME if NAME belongs to an encrypted directory.
|
2020-06-12 18:17:02 +00:00
|
|
|
|
OP must be `encrypt' or `decrypt'. Raise an error if this fails.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
Otherwise, return NAME."
|
|
|
|
|
(if-let ((tramp-crypt-enabled t)
|
|
|
|
|
(dir (tramp-crypt-file-name-p name))
|
|
|
|
|
;; It must be absolute for the cache.
|
|
|
|
|
(localname (substring name (1- (length dir))))
|
|
|
|
|
(crypt-vec (tramp-crypt-dissect-file-name dir)))
|
|
|
|
|
;; Preserve trailing "/".
|
|
|
|
|
(funcall
|
|
|
|
|
(if (directory-name-p name) #'file-name-as-directory #'identity)
|
|
|
|
|
(concat
|
|
|
|
|
dir
|
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 14:19:47 +00:00
|
|
|
|
(unless (string-match-p (rx bos (? "/") eos) localname)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(with-tramp-file-property
|
|
|
|
|
crypt-vec localname (concat (symbol-name op) "-file-name")
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(unless (tramp-crypt-send-command
|
|
|
|
|
crypt-vec (if (eq op 'encrypt) "encode" "decode")
|
Fix tramp-compat-temporary-file-directory implementation
* lisp/net/tramp-archive.el
(tramp-archive-handle-temporary-file-directory):
Use `tramp-compat-temporary-file-directory-function'.
* lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory):
Make it a defconst.
* lisp/net/tramp.el (tramp-get-debug-buffer, tramp-get-debug-file-name)
(tramp-debug-message, tramp-file-name-handler, tramp-parse-file)
(tramp-parse-shostkeys-sknownhosts)
(tramp-handle-expand-file-name, tramp-handle-make-process)
(tramp-local-host-p, tramp-call-process)
(tramp-call-process-region, tramp-process-lines)
(tramp-read-passwd):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-compat.el (tramp-compat-make-temp-name)
(tramp-compat-make-temp-file);
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-for-operation)
(tramp-crypt-maybe-open-connection, tramp-crypt-send-command)
(tramp-crypt-do-encrypt-or-decrypt-file-name):
* lisp/net/tramp-fuse.el (tramp-fuse-mount-point, tramp-fuse-mounted-p)
(tramp-fuse-unmount):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-expand-file-name)
(tramp-sh-handle-file-local-copy, )
(tramp-sh-handle-write-region, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Use it.
2021-09-21 18:26:59 +00:00
|
|
|
|
tramp-compat-temporary-file-directory localname)
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(tramp-error
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
crypt-vec 'file-error "%s of file name %s failed"
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(if (eq op 'encrypt) "Encoding" "Decoding") name))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(with-current-buffer (tramp-get-connection-buffer crypt-vec)
|
|
|
|
|
(goto-char (point-min))
|
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 14:19:47 +00:00
|
|
|
|
(buffer-substring (point-min) (line-end-position)))))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; Nothing to do.
|
|
|
|
|
name))
|
|
|
|
|
|
|
|
|
|
(defsubst tramp-crypt-encrypt-file-name (name)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Return encrypted NAME if NAME belongs to an encrypted directory.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
Otherwise, return NAME."
|
|
|
|
|
(tramp-crypt-do-encrypt-or-decrypt-file-name 'encrypt name))
|
|
|
|
|
|
|
|
|
|
(defsubst tramp-crypt-decrypt-file-name (name)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Return decrypted NAME if NAME belongs to an encrypted directory.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
Otherwise, return NAME."
|
|
|
|
|
(tramp-crypt-do-encrypt-or-decrypt-file-name 'decrypt name))
|
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-do-encrypt-or-decrypt-file (op root infile outfile)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Encrypt / decrypt file INFILE to OUTFILE according to encrypted directory ROOT.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
Both files must be local files. OP must be `encrypt' or `decrypt'.
|
2022-11-18 14:48:22 +00:00
|
|
|
|
If OP is `decrypt', the basename of INFILE must be an encrypted file name.
|
2020-06-12 18:17:02 +00:00
|
|
|
|
Raise an error if this fails."
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(when-let ((tramp-crypt-enabled t)
|
|
|
|
|
(dir (tramp-crypt-file-name-p root))
|
|
|
|
|
(crypt-vec (tramp-crypt-dissect-file-name dir)))
|
|
|
|
|
(let ((coding-system-for-read
|
2020-06-10 17:36:53 +00:00
|
|
|
|
(if (eq op 'decrypt) 'binary coding-system-for-read))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(coding-system-for-write
|
2020-06-10 17:36:53 +00:00
|
|
|
|
(if (eq op 'encrypt) 'binary coding-system-for-write)))
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(unless (tramp-crypt-send-command
|
|
|
|
|
crypt-vec "cat" (and (eq op 'encrypt) "--reverse")
|
|
|
|
|
(file-name-directory infile)
|
|
|
|
|
(concat "/" (file-name-nondirectory infile)))
|
|
|
|
|
(tramp-error
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
crypt-vec 'file-error "%s of file %s failed"
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(if (eq op 'encrypt) "Encrypting" "Decrypting") infile))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(with-current-buffer (tramp-get-connection-buffer crypt-vec)
|
|
|
|
|
(write-region nil nil outfile)))))
|
|
|
|
|
|
|
|
|
|
(defsubst tramp-crypt-encrypt-file (root infile outfile)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Encrypt file INFILE to OUTFILE according to encrypted directory ROOT.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
See `tramp-crypt-do-encrypt-or-decrypt-file'."
|
|
|
|
|
(tramp-crypt-do-encrypt-or-decrypt-file 'encrypt root infile outfile))
|
|
|
|
|
|
|
|
|
|
(defsubst tramp-crypt-decrypt-file (root infile outfile)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Decrypt file INFILE to OUTFILE according to encrypted directory ROOT.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
See `tramp-crypt-do-encrypt-or-decrypt-file'."
|
|
|
|
|
(tramp-crypt-do-encrypt-or-decrypt-file 'decrypt root infile outfile))
|
|
|
|
|
|
|
|
|
|
;;;###tramp-autoload
|
|
|
|
|
(defun tramp-crypt-add-directory (name)
|
|
|
|
|
"Mark remote directory NAME for encryption.
|
|
|
|
|
Files in that directory and all subdirectories will be encrypted
|
2020-06-09 11:43:30 +00:00
|
|
|
|
before copying to, and decrypted after copying from that
|
2020-06-07 14:57:32 +00:00
|
|
|
|
directory. File names will be also encrypted."
|
2021-11-16 14:04:27 +00:00
|
|
|
|
;; (declare (completion tramp-crypt-command-completion-p))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(interactive "DRemote directory name: ")
|
|
|
|
|
(unless tramp-crypt-enabled
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
(tramp-user-error nil "Feature is not enabled"))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(unless (and (tramp-tramp-file-p name) (file-directory-p name))
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
(tramp-user-error nil "%s must be an existing remote directory" name))
|
2020-06-14 13:31:17 +00:00
|
|
|
|
(when (tramp-compat-file-name-quoted-p name)
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
(tramp-user-error nil "%s must not be quoted" name))
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(setq name (file-name-as-directory (expand-file-name name)))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(unless (member name tramp-crypt-directories)
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(setq tramp-crypt-directories (cons name tramp-crypt-directories)))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(tramp-register-file-name-handlers))
|
|
|
|
|
|
2021-03-15 08:49:20 +00:00
|
|
|
|
;; `tramp-crypt-command-completion-p' is not autoloaded, and this
|
|
|
|
|
;; setting isn't either.
|
2021-03-13 13:35:39 +00:00
|
|
|
|
(function-put
|
2021-03-15 08:49:20 +00:00
|
|
|
|
#'tramp-crypt-add-directory 'completion-predicate
|
|
|
|
|
#'tramp-crypt-command-completion-p)
|
2021-03-13 13:35:39 +00:00
|
|
|
|
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(defun tramp-crypt-remove-directory (name)
|
|
|
|
|
"Unmark remote directory NAME for encryption.
|
|
|
|
|
Existing files in that directory and its subdirectories will be
|
|
|
|
|
kept in their encrypted form."
|
2021-03-15 08:49:20 +00:00
|
|
|
|
;; (declare (completion tramp-crypt-command-completion-p))
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(interactive "DRemote directory name: ")
|
|
|
|
|
(unless tramp-crypt-enabled
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
(tramp-user-error nil "Feature is not enabled"))
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(setq name (file-name-as-directory (expand-file-name name)))
|
|
|
|
|
(when (and (member name tramp-crypt-directories)
|
|
|
|
|
(delete
|
|
|
|
|
tramp-crypt-encfs-config
|
|
|
|
|
(directory-files name nil directory-files-no-dot-files-regexp))
|
|
|
|
|
(yes-or-no-p
|
2021-09-16 14:50:24 +00:00
|
|
|
|
"There exist encrypted files, do you want to continue?"))
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(setq tramp-crypt-directories (delete name tramp-crypt-directories))
|
|
|
|
|
(tramp-register-file-name-handlers)))
|
|
|
|
|
|
2021-03-13 13:35:39 +00:00
|
|
|
|
;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form.
|
|
|
|
|
(function-put
|
2021-03-15 08:49:20 +00:00
|
|
|
|
#'tramp-crypt-remove-directory 'completion-predicate
|
|
|
|
|
#'tramp-crypt-command-completion-p)
|
2021-03-13 13:35:39 +00:00
|
|
|
|
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; `auth-source' requires a user.
|
|
|
|
|
(defun tramp-crypt-dissect-file-name (name)
|
|
|
|
|
"Return a `tramp-file-name' structure for NAME.
|
|
|
|
|
The structure consists of the `tramp-crypt-method' method, the
|
|
|
|
|
local user name, the hexlified directory NAME as host, and the
|
|
|
|
|
localname."
|
|
|
|
|
(save-match-data
|
|
|
|
|
(if-let ((dir (tramp-crypt-file-name-p name)))
|
|
|
|
|
(make-tramp-file-name
|
|
|
|
|
:method tramp-crypt-method :user (user-login-name)
|
|
|
|
|
:host (url-hexify-string dir))
|
2022-07-18 12:22:33 +00:00
|
|
|
|
(tramp-user-error nil "Not an encrypted remote directory: \"%s\"" name))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-get-remote-dir (vec)
|
2022-07-18 12:22:33 +00:00
|
|
|
|
"Return the name of the encrypted remote directory to be used for encfs."
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(url-unhex-string (tramp-file-name-host vec)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; File name primitives.
|
|
|
|
|
|
2020-06-15 14:24:22 +00:00
|
|
|
|
(defun tramp-crypt-handle-access-file (filename string)
|
|
|
|
|
"Like `access-file' for Tramp files."
|
|
|
|
|
(let* ((encrypt-filename (tramp-crypt-encrypt-file-name filename))
|
2022-09-09 15:10:28 +00:00
|
|
|
|
(encrypt-regexp (tramp-compat-rx (literal encrypt-filename) eos))
|
2020-06-15 14:24:22 +00:00
|
|
|
|
tramp-crypt-enabled)
|
|
|
|
|
(condition-case err
|
|
|
|
|
(access-file encrypt-filename string)
|
|
|
|
|
(error
|
|
|
|
|
(when (and (eq (car err) 'file-missing) (stringp (cadr err))
|
|
|
|
|
(string-match-p encrypt-regexp (cadr err)))
|
|
|
|
|
(setcar
|
|
|
|
|
(cdr err)
|
|
|
|
|
(replace-regexp-in-string encrypt-regexp filename (cadr err))))
|
|
|
|
|
(signal (car err) (cdr err))))))
|
|
|
|
|
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(defun tramp-crypt-do-copy-or-rename-file
|
|
|
|
|
(op filename newname &optional ok-if-already-exists keep-date
|
|
|
|
|
preserve-uid-gid preserve-extended-attributes)
|
|
|
|
|
"Copy or rename a remote file.
|
|
|
|
|
OP must be `copy' or `rename' and indicates the operation to perform.
|
|
|
|
|
FILENAME specifies the file to copy or rename, NEWNAME is the name of
|
|
|
|
|
the new file (for copy) or the new name of the file (for rename).
|
|
|
|
|
OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
|
|
|
|
|
KEEP-DATE means to make sure that NEWNAME has the same timestamp
|
|
|
|
|
as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
|
|
|
|
|
the uid and gid if both files are on the same host.
|
|
|
|
|
PRESERVE-EXTENDED-ATTRIBUTES is ignored.
|
|
|
|
|
|
|
|
|
|
This function is invoked by `tramp-crypt-handle-copy-file' and
|
|
|
|
|
`tramp-crypt-handle-rename-file'. It is an error if OP is
|
|
|
|
|
neither of `copy' and `rename'. FILENAME and NEWNAME must be
|
|
|
|
|
absolute file names."
|
2022-09-10 11:10:47 +00:00
|
|
|
|
;; FILENAME and NEWNAME are already expanded.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(unless (memq op '(copy rename))
|
|
|
|
|
(error "Unknown operation `%s', must be `copy' or `rename'" op))
|
|
|
|
|
|
|
|
|
|
(setq filename (file-truename filename))
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(let ((t1 (tramp-crypt-file-name-p filename))
|
|
|
|
|
(t2 (tramp-crypt-file-name-p newname))
|
|
|
|
|
(encrypt-filename (tramp-crypt-encrypt-file-name filename))
|
|
|
|
|
(encrypt-newname (tramp-crypt-encrypt-file-name newname))
|
|
|
|
|
(msg-operation (if (eq op 'copy) "Copying" "Renaming")))
|
|
|
|
|
|
|
|
|
|
(if (file-directory-p filename)
|
|
|
|
|
(progn
|
|
|
|
|
(copy-directory filename newname keep-date t)
|
|
|
|
|
(when (eq op 'rename)
|
|
|
|
|
(delete-directory filename 'recursive)))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(with-parsed-tramp-file-name (if t1 filename newname) nil
|
2022-07-24 14:02:10 +00:00
|
|
|
|
(tramp-barf-if-file-missing v filename
|
|
|
|
|
(when (and (not ok-if-already-exists) (file-exists-p newname))
|
|
|
|
|
(tramp-error v 'file-already-exists newname))
|
|
|
|
|
(when (and (file-directory-p newname)
|
|
|
|
|
(not (directory-name-p newname)))
|
|
|
|
|
(tramp-error v 'file-error "File is a directory %s" newname))
|
|
|
|
|
|
|
|
|
|
(with-tramp-progress-reporter
|
|
|
|
|
v 0 (format "%s %s to %s" msg-operation filename newname)
|
|
|
|
|
(if (and t1 t2 (string-equal t1 t2))
|
|
|
|
|
;; Both files are on the same encrypted remote directory.
|
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(if (eq op 'copy)
|
|
|
|
|
(copy-file
|
|
|
|
|
encrypt-filename encrypt-newname ok-if-already-exists
|
|
|
|
|
keep-date preserve-uid-gid preserve-extended-attributes)
|
|
|
|
|
(rename-file
|
|
|
|
|
encrypt-filename encrypt-newname ok-if-already-exists)))
|
|
|
|
|
|
|
|
|
|
(let* ((tmpdir (tramp-compat-make-temp-file filename 'dir))
|
|
|
|
|
(tmpfile1
|
|
|
|
|
(expand-file-name
|
|
|
|
|
(file-name-nondirectory encrypt-filename) tmpdir))
|
|
|
|
|
(tmpfile2
|
|
|
|
|
(expand-file-name
|
|
|
|
|
(file-name-nondirectory encrypt-newname) tmpdir))
|
|
|
|
|
tramp-crypt-enabled)
|
|
|
|
|
(cond
|
|
|
|
|
;; Source and target file are on an encrypted remote directory.
|
|
|
|
|
((and t1 t2)
|
|
|
|
|
(if (eq op 'copy)
|
|
|
|
|
(copy-file
|
|
|
|
|
encrypt-filename encrypt-newname ok-if-already-exists
|
|
|
|
|
keep-date preserve-uid-gid preserve-extended-attributes)
|
|
|
|
|
(rename-file
|
|
|
|
|
encrypt-filename encrypt-newname ok-if-already-exists)))
|
|
|
|
|
;; Source file is on an encrypted remote directory.
|
|
|
|
|
(t1
|
|
|
|
|
(if (eq op 'copy)
|
|
|
|
|
(copy-file
|
|
|
|
|
encrypt-filename tmpfile1 t keep-date preserve-uid-gid
|
|
|
|
|
preserve-extended-attributes)
|
|
|
|
|
(rename-file encrypt-filename tmpfile1 t))
|
|
|
|
|
(tramp-crypt-decrypt-file t1 tmpfile1 tmpfile2)
|
|
|
|
|
(rename-file tmpfile2 newname ok-if-already-exists))
|
|
|
|
|
;; Target file is on an encrypted remote directory.
|
|
|
|
|
(t2
|
|
|
|
|
(if (eq op 'copy)
|
|
|
|
|
(copy-file
|
|
|
|
|
filename tmpfile1 t keep-date preserve-uid-gid
|
|
|
|
|
preserve-extended-attributes)
|
|
|
|
|
(rename-file filename tmpfile1 t))
|
|
|
|
|
(tramp-crypt-encrypt-file t2 tmpfile1 tmpfile2)
|
|
|
|
|
(rename-file tmpfile2 encrypt-newname ok-if-already-exists)))
|
|
|
|
|
(delete-directory tmpdir 'recursive)))))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(when (and t1 (eq op 'rename))
|
|
|
|
|
(with-parsed-tramp-file-name filename v1
|
|
|
|
|
(tramp-flush-file-properties v1 v1-localname)))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(when t2
|
|
|
|
|
(with-parsed-tramp-file-name newname v2
|
|
|
|
|
(tramp-flush-file-properties v2 v2-localname)))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-handle-copy-file
|
|
|
|
|
(filename newname &optional ok-if-already-exists keep-date
|
|
|
|
|
preserve-uid-gid preserve-extended-attributes)
|
|
|
|
|
"Like `copy-file' for Tramp files."
|
|
|
|
|
(setq filename (expand-file-name filename)
|
|
|
|
|
newname (expand-file-name newname))
|
|
|
|
|
;; At least one file a Tramp file?
|
|
|
|
|
(if (or (tramp-tramp-file-p filename)
|
|
|
|
|
(tramp-tramp-file-p newname))
|
|
|
|
|
(tramp-crypt-do-copy-or-rename-file
|
|
|
|
|
'copy filename newname ok-if-already-exists keep-date
|
|
|
|
|
preserve-uid-gid preserve-extended-attributes)
|
|
|
|
|
(tramp-run-real-handler
|
|
|
|
|
#'copy-file
|
|
|
|
|
(list filename newname ok-if-already-exists keep-date
|
|
|
|
|
preserve-uid-gid preserve-extended-attributes))))
|
|
|
|
|
|
2022-07-18 12:22:33 +00:00
|
|
|
|
;; Encrypted files won't be trashed.
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(defun tramp-crypt-handle-delete-directory
|
2020-11-01 11:42:29 +00:00
|
|
|
|
(directory &optional recursive _trash)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
"Like `delete-directory' for Tramp files."
|
|
|
|
|
(with-parsed-tramp-file-name (expand-file-name directory) nil
|
|
|
|
|
(tramp-flush-directory-properties v localname)
|
|
|
|
|
(let (tramp-crypt-enabled)
|
2020-11-01 11:42:29 +00:00
|
|
|
|
(delete-directory (tramp-crypt-encrypt-file-name directory) recursive))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
2022-07-18 12:22:33 +00:00
|
|
|
|
;; Encrypted files won't be trashed.
|
2020-11-01 11:42:29 +00:00
|
|
|
|
(defun tramp-crypt-handle-delete-file (filename &optional _trash)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
"Like `delete-file' for Tramp files."
|
|
|
|
|
(with-parsed-tramp-file-name (expand-file-name filename) nil
|
|
|
|
|
(tramp-flush-file-properties v localname)
|
2020-06-21 13:19:51 +00:00
|
|
|
|
(let (tramp-crypt-enabled)
|
2020-11-01 11:42:29 +00:00
|
|
|
|
(delete-file (tramp-crypt-encrypt-file-name filename)))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
2020-11-05 16:36:04 +00:00
|
|
|
|
(defun tramp-crypt-handle-directory-files
|
|
|
|
|
(directory &optional full match nosort count)
|
2020-06-07 14:57:32 +00:00
|
|
|
|
"Like `directory-files' for Tramp files."
|
2022-07-24 14:02:10 +00:00
|
|
|
|
(tramp-skeleton-directory-files directory full match nosort count
|
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(replace-regexp-in-string
|
2022-09-09 15:10:28 +00:00
|
|
|
|
(tramp-compat-rx bos (literal directory)) ""
|
2022-07-24 14:02:10 +00:00
|
|
|
|
(tramp-crypt-decrypt-file-name x)))
|
|
|
|
|
(directory-files (tramp-crypt-encrypt-file-name directory) 'full)))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-handle-file-attributes (filename &optional id-format)
|
|
|
|
|
"Like `file-attributes' for Tramp files."
|
2020-06-21 13:19:51 +00:00
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(file-attributes (tramp-crypt-encrypt-file-name filename) id-format)))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-handle-file-executable-p (filename)
|
|
|
|
|
"Like `file-executable-p' for Tramp files."
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(file-executable-p (tramp-crypt-encrypt-file-name filename))))
|
|
|
|
|
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
(defun tramp-crypt-handle-file-exists-p (filename)
|
|
|
|
|
"Like `file-exists-p' for Tramp files."
|
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(file-exists-p (tramp-crypt-encrypt-file-name filename))))
|
|
|
|
|
|
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 16:36:53 +00:00
|
|
|
|
(defun tramp-crypt-handle-file-locked-p (filename)
|
|
|
|
|
"Like `file-locked-p' for Tramp files."
|
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(file-locked-p (tramp-crypt-encrypt-file-name filename))))
|
|
|
|
|
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(defun tramp-crypt-handle-file-name-all-completions (filename directory)
|
|
|
|
|
"Like `file-name-all-completions' for Tramp files."
|
Sync with Tramp 2.6.2-pre
* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh. Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing. (Bug#61890)
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.
* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.
* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.
* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.
* 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):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.
* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require. (Bug#64124)
(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-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'. Add argument
PROGRAM. Use it for "docker" and "podman" host name completion.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash. (Bug#64278)
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.
* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails. (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired. Remove -N
when we remove --dired. (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'. (Bug#61341)
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'. (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer. (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping. (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.
* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.
* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.
2023-08-05 16:07:58 +00:00
|
|
|
|
(tramp-compat-ignore-error file-missing
|
|
|
|
|
(all-completions
|
|
|
|
|
filename
|
|
|
|
|
(let* (completion-regexp-list
|
|
|
|
|
tramp-crypt-enabled
|
|
|
|
|
(directory (file-name-as-directory directory))
|
|
|
|
|
(enc-dir (tramp-crypt-encrypt-file-name directory)))
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(substring
|
|
|
|
|
(tramp-crypt-decrypt-file-name (concat enc-dir x))
|
|
|
|
|
(length directory)))
|
|
|
|
|
(file-name-all-completions "" enc-dir))))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-handle-file-readable-p (filename)
|
|
|
|
|
"Like `file-readable-p' for Tramp files."
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(file-readable-p (tramp-crypt-encrypt-file-name filename))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
2020-06-14 13:31:17 +00:00
|
|
|
|
(defun tramp-crypt-handle-file-ownership-preserved-p (filename &optional group)
|
|
|
|
|
"Like `file-ownership-preserved-p' for Tramp files."
|
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(file-ownership-preserved-p (tramp-crypt-encrypt-file-name filename) group)))
|
|
|
|
|
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(defun tramp-crypt-handle-file-system-info (filename)
|
|
|
|
|
"Like `file-system-info' for Tramp files."
|
2020-06-21 13:19:51 +00:00
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
;; `file-system-info' exists since Emacs 27.1.
|
|
|
|
|
(tramp-compat-funcall
|
|
|
|
|
'file-system-info (tramp-crypt-encrypt-file-name filename))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
2020-06-12 18:17:02 +00:00
|
|
|
|
(defun tramp-crypt-handle-file-writable-p (filename)
|
|
|
|
|
"Like `file-writable-p' for Tramp files."
|
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(file-writable-p (tramp-crypt-encrypt-file-name filename))))
|
|
|
|
|
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(defun tramp-crypt-handle-insert-directory
|
|
|
|
|
(filename switches &optional wildcard full-directory-p)
|
2020-06-14 13:31:17 +00:00
|
|
|
|
"Like `insert-directory' for Tramp files.
|
|
|
|
|
WILDCARD is not supported."
|
2020-06-12 18:17:02 +00:00
|
|
|
|
;; This package has been added to Emacs 27.1.
|
|
|
|
|
(when (load "text-property-search" 'noerror 'nomessage)
|
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(tramp-handle-insert-directory
|
|
|
|
|
(tramp-crypt-encrypt-file-name filename)
|
|
|
|
|
switches wildcard full-directory-p)
|
|
|
|
|
(let* ((filename (file-name-as-directory filename))
|
|
|
|
|
(enc (tramp-crypt-encrypt-file-name filename))
|
|
|
|
|
match string)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (setq match (text-property-search-forward 'dired-filename t t))
|
|
|
|
|
(setq string
|
|
|
|
|
(buffer-substring
|
|
|
|
|
(prop-match-beginning match) (prop-match-end match))
|
|
|
|
|
string (if (file-name-absolute-p string)
|
|
|
|
|
(tramp-crypt-decrypt-file-name string)
|
|
|
|
|
(substring
|
|
|
|
|
(tramp-crypt-decrypt-file-name (concat enc string))
|
|
|
|
|
(length filename))))
|
|
|
|
|
(delete-region (prop-match-beginning match) (prop-match-end match))
|
|
|
|
|
(insert (propertize string 'dired-filename t)))))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
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 16:36:53 +00:00
|
|
|
|
(defun tramp-crypt-handle-lock-file (filename)
|
|
|
|
|
"Like `lock-file' for Tramp files."
|
|
|
|
|
(let (tramp-crypt-enabled)
|
2021-07-14 16:36:14 +00:00
|
|
|
|
;; `lock-file' exists since Emacs 28.1.
|
|
|
|
|
(tramp-compat-funcall
|
|
|
|
|
'lock-file (tramp-crypt-encrypt-file-name filename))))
|
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 16:36:53 +00:00
|
|
|
|
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(defun tramp-crypt-handle-make-directory (dir &optional parents)
|
|
|
|
|
"Like `make-directory' for Tramp files."
|
|
|
|
|
(with-parsed-tramp-file-name (expand-file-name dir) nil
|
|
|
|
|
(when (and (null parents) (file-exists-p dir))
|
2021-02-03 17:48:09 +00:00
|
|
|
|
(tramp-error v 'file-already-exists dir))
|
2020-06-21 13:19:51 +00:00
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(make-directory (tramp-crypt-encrypt-file-name dir) parents))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
;; When PARENTS is non-nil, DIR could be a chain of non-existent
|
|
|
|
|
;; directories a/b/c/... Instead of checking, we simply flush the
|
|
|
|
|
;; whole cache.
|
|
|
|
|
(tramp-flush-directory-properties
|
|
|
|
|
v (if parents "/" (file-name-directory localname)))))
|
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-handle-rename-file
|
|
|
|
|
(filename newname &optional ok-if-already-exists)
|
|
|
|
|
"Like `rename-file' for Tramp files."
|
|
|
|
|
(setq filename (expand-file-name filename)
|
|
|
|
|
newname (expand-file-name newname))
|
|
|
|
|
;; At least one file a Tramp file?
|
|
|
|
|
(if (or (tramp-tramp-file-p filename)
|
|
|
|
|
(tramp-tramp-file-p newname))
|
|
|
|
|
(tramp-crypt-do-copy-or-rename-file
|
|
|
|
|
'rename filename newname ok-if-already-exists
|
|
|
|
|
'keep-date 'preserve-uid-gid)
|
|
|
|
|
(tramp-run-real-handler
|
|
|
|
|
#'rename-file (list filename newname ok-if-already-exists))))
|
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-handle-set-file-modes (filename mode &optional flag)
|
|
|
|
|
"Like `set-file-modes' for Tramp files."
|
Reorganize Tramp
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region): Handle special
case that START is "".
(tramp-adb-handle-set-file-modes)
(tramp-adb-handle-set-file-times):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-adb-handle-make-process):
Use `with-tramp-saved-connection-properties'.
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
Use `tramp-archive-handle-file-exists-p'.
(tramp-archive-handle-file-exists-p): New defun.
(tramp-archive-file-name-handler): Add ;;;###tramp-autoload cookie.
* lisp/net/tramp-cache.el (tramp-compat, tramp-loaddefs)
(time-stamp): Require.
(tramp-get-file-property, tramp-set-file-property)
(tramp-flush-file-property, tramp-flush-file-upper-properties)
(tramp-flush-file-properties): Use `tramp-file-name-unify'. Adapt
message.
(tramp-flush-directory-properties): Simplify.
(tramp-flush-file-function): Add ;;;###tramp-autoload cookie.
Don't use `with-parsed-tramp-file-name', it isn't exposed.
(with-tramp-file-property, with-tramp-connection-property)
(with-tramp-saved-connection-property): Macros moved from tramp.el.
(with-tramp-saved-file-property)
(with-tramp-saved-file-properties)
(with-tramp-saved-connection-properties): New defmacros.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection): Flush "/".
* lisp/net/tramp-crypt.el (tramp-crypt-handle-set-file-modes)
(tramp-crypt-handle-set-file-times)
(tramp-crypt-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-ftp.el (tramp-archive-file-name-handler):
Don't declare.
* lisp/net/tramp-gvfs.el (tramp-gvfs-info): New defun.
(tramp-gvfs-do-copy-or-rename-file)
(tramp-gvfs-handle-delete-directory)
(tramp-gvfs-handle-delete-file, tramp-gvfs-get-root-attributes)
(tramp-gvfs-handle-make-directory): Use it.
(tramp-gvfs-handle-set-file-modes)
(tramp-gvfs-handle-set-file-times)
(tramp-gvfs-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link):
Expand TARGET when flushing file properties.
(tramp-sh-handle-set-file-modes, tramp-sh-handle-set-file-times)
(tramp-sh-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-sh-handle-file-name-all-completions): Protect, when
connection is not established yet.
(tramp-do-copy-or-rename-file-directly): Flush file properties of
NEWNAME when constructing a new remote file name.
(tramp-do-copy-or-rename-file-out-of-band, tramp-sh-handle-make-process):
Use `with-tramp-saved-connection-properties'.
(tramp-sh-handle-delete-file): Flush file properties only after
deleting, otherwise we get a false alarm.
(tramp-sh-handle-process-file): Flush "/".
(tramp-sh-handle-write-region): Handle special case that START is "".
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-process-file)
(tramp-smb-handle-set-file-acl)
(tramp-smb-handle-start-file-process):
Use `with-tramp-saved-connection-properties'.
(tramp-smb-remote-acl-p): New defun.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl): Use it.
(tramp-smb-handle-set-file-modes):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-smb-handle-process-file, tramp-smb-maybe-open-connection):
Flush "/".
* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-process-file): Flush "/".
(tramp-sshfs-handle-set-file-modes)
(tramp-sshfs-handle-set-file-times):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes)
(tramp-sudoedit-handle-set-file-times)
(tramp-sudoedit-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp.el (tramp-archive-file-name-handler): Don't declare.
(tramp-verbose, tramp-file-name-unify, tramp-tramp-file-p)
(tramp-file-local-name, tramp-dissect-file-name)
(tramp-make-tramp-file-name, tramp-get-connection-buffer)
(tramp-get-buffer-string, tramp-debug-message)
(tramp-inhibit-progress-reporter, tramp-message):
Add ;;;###tramp-autoload cookie.
(tramp-file-name): Expose defstruct to tramp-loaddefs.el
(tramp-file-name-unify): New optional arg FILE.
(tramp-get-default-directory, tramp-get-buffer-string)
(tramp-message, tramp-backtrace, tramp-error-with-buffer)
(tramp-with-demoted-errors, tramp-barf-if-file-missing)
(tramp-skeleton-copy-directory, tramp-skeleton-delete-directory)
(tramp-skeleton-directory-files)
(tramp-skeleton-directory-files-and-attributes)
(tramp-skeleton-file-local-copy, tramp-skeleton-write-region):
Remove `tramp-suppress-trace' property, it isn't needed for
defmacros and defsubsts.
(with-tramp-file-property, with-tramp-connection-property)
(with-tramp-saved-connection-property): Move macros to tramp-cache.el.
(tramp-skeleton-directory-files-and-attributes): Fix implementation.
(tramp-skeleton-file-local-copy): Fix docstring.
(tramp-skeleton-set-file-modes-times-uid-gid): New defmacro.
(tramp-skeleton-write-region): Set "file-exists-p" cache property.
(tramp-handle-file-exists-p): Use cached value.
(tramp-process-sentinel): Flush "/".
(tramp-make-tramp-temp-file): Suppress also `tramp-smb-remote-acl-p'.
(tramp-get-connection-buffer):
* test/lisp/net/tramp-tests.el (tramp-test10-write-region)
(tramp-test20-file-modes, tramp-test22-file-times): Extend tests.
2022-08-03 15:30:09 +00:00
|
|
|
|
(tramp-skeleton-set-file-modes-times-uid-gid filename
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(tramp-compat-set-file-modes
|
|
|
|
|
(tramp-crypt-encrypt-file-name filename) mode flag))))
|
|
|
|
|
|
|
|
|
|
(defun tramp-crypt-handle-set-file-times (filename &optional time flag)
|
|
|
|
|
"Like `set-file-times' for Tramp files."
|
Reorganize Tramp
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region): Handle special
case that START is "".
(tramp-adb-handle-set-file-modes)
(tramp-adb-handle-set-file-times):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-adb-handle-make-process):
Use `with-tramp-saved-connection-properties'.
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
Use `tramp-archive-handle-file-exists-p'.
(tramp-archive-handle-file-exists-p): New defun.
(tramp-archive-file-name-handler): Add ;;;###tramp-autoload cookie.
* lisp/net/tramp-cache.el (tramp-compat, tramp-loaddefs)
(time-stamp): Require.
(tramp-get-file-property, tramp-set-file-property)
(tramp-flush-file-property, tramp-flush-file-upper-properties)
(tramp-flush-file-properties): Use `tramp-file-name-unify'. Adapt
message.
(tramp-flush-directory-properties): Simplify.
(tramp-flush-file-function): Add ;;;###tramp-autoload cookie.
Don't use `with-parsed-tramp-file-name', it isn't exposed.
(with-tramp-file-property, with-tramp-connection-property)
(with-tramp-saved-connection-property): Macros moved from tramp.el.
(with-tramp-saved-file-property)
(with-tramp-saved-file-properties)
(with-tramp-saved-connection-properties): New defmacros.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection): Flush "/".
* lisp/net/tramp-crypt.el (tramp-crypt-handle-set-file-modes)
(tramp-crypt-handle-set-file-times)
(tramp-crypt-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-ftp.el (tramp-archive-file-name-handler):
Don't declare.
* lisp/net/tramp-gvfs.el (tramp-gvfs-info): New defun.
(tramp-gvfs-do-copy-or-rename-file)
(tramp-gvfs-handle-delete-directory)
(tramp-gvfs-handle-delete-file, tramp-gvfs-get-root-attributes)
(tramp-gvfs-handle-make-directory): Use it.
(tramp-gvfs-handle-set-file-modes)
(tramp-gvfs-handle-set-file-times)
(tramp-gvfs-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link):
Expand TARGET when flushing file properties.
(tramp-sh-handle-set-file-modes, tramp-sh-handle-set-file-times)
(tramp-sh-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-sh-handle-file-name-all-completions): Protect, when
connection is not established yet.
(tramp-do-copy-or-rename-file-directly): Flush file properties of
NEWNAME when constructing a new remote file name.
(tramp-do-copy-or-rename-file-out-of-band, tramp-sh-handle-make-process):
Use `with-tramp-saved-connection-properties'.
(tramp-sh-handle-delete-file): Flush file properties only after
deleting, otherwise we get a false alarm.
(tramp-sh-handle-process-file): Flush "/".
(tramp-sh-handle-write-region): Handle special case that START is "".
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-process-file)
(tramp-smb-handle-set-file-acl)
(tramp-smb-handle-start-file-process):
Use `with-tramp-saved-connection-properties'.
(tramp-smb-remote-acl-p): New defun.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl): Use it.
(tramp-smb-handle-set-file-modes):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-smb-handle-process-file, tramp-smb-maybe-open-connection):
Flush "/".
* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-process-file): Flush "/".
(tramp-sshfs-handle-set-file-modes)
(tramp-sshfs-handle-set-file-times):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes)
(tramp-sudoedit-handle-set-file-times)
(tramp-sudoedit-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp.el (tramp-archive-file-name-handler): Don't declare.
(tramp-verbose, tramp-file-name-unify, tramp-tramp-file-p)
(tramp-file-local-name, tramp-dissect-file-name)
(tramp-make-tramp-file-name, tramp-get-connection-buffer)
(tramp-get-buffer-string, tramp-debug-message)
(tramp-inhibit-progress-reporter, tramp-message):
Add ;;;###tramp-autoload cookie.
(tramp-file-name): Expose defstruct to tramp-loaddefs.el
(tramp-file-name-unify): New optional arg FILE.
(tramp-get-default-directory, tramp-get-buffer-string)
(tramp-message, tramp-backtrace, tramp-error-with-buffer)
(tramp-with-demoted-errors, tramp-barf-if-file-missing)
(tramp-skeleton-copy-directory, tramp-skeleton-delete-directory)
(tramp-skeleton-directory-files)
(tramp-skeleton-directory-files-and-attributes)
(tramp-skeleton-file-local-copy, tramp-skeleton-write-region):
Remove `tramp-suppress-trace' property, it isn't needed for
defmacros and defsubsts.
(with-tramp-file-property, with-tramp-connection-property)
(with-tramp-saved-connection-property): Move macros to tramp-cache.el.
(tramp-skeleton-directory-files-and-attributes): Fix implementation.
(tramp-skeleton-file-local-copy): Fix docstring.
(tramp-skeleton-set-file-modes-times-uid-gid): New defmacro.
(tramp-skeleton-write-region): Set "file-exists-p" cache property.
(tramp-handle-file-exists-p): Use cached value.
(tramp-process-sentinel): Flush "/".
(tramp-make-tramp-temp-file): Suppress also `tramp-smb-remote-acl-p'.
(tramp-get-connection-buffer):
* test/lisp/net/tramp-tests.el (tramp-test10-write-region)
(tramp-test20-file-modes, tramp-test22-file-times): Extend tests.
2022-08-03 15:30:09 +00:00
|
|
|
|
(tramp-skeleton-set-file-modes-times-uid-gid filename
|
2020-06-09 11:43:30 +00:00
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(tramp-compat-set-file-times
|
|
|
|
|
(tramp-crypt-encrypt-file-name filename) time flag))))
|
2020-06-07 14:57:32 +00:00
|
|
|
|
|
2020-06-10 17:36:53 +00:00
|
|
|
|
(defun tramp-crypt-handle-set-file-uid-gid (filename &optional uid gid)
|
|
|
|
|
"Like `tramp-set-file-uid-gid' for Tramp files."
|
Reorganize Tramp
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region): Handle special
case that START is "".
(tramp-adb-handle-set-file-modes)
(tramp-adb-handle-set-file-times):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-adb-handle-make-process):
Use `with-tramp-saved-connection-properties'.
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
Use `tramp-archive-handle-file-exists-p'.
(tramp-archive-handle-file-exists-p): New defun.
(tramp-archive-file-name-handler): Add ;;;###tramp-autoload cookie.
* lisp/net/tramp-cache.el (tramp-compat, tramp-loaddefs)
(time-stamp): Require.
(tramp-get-file-property, tramp-set-file-property)
(tramp-flush-file-property, tramp-flush-file-upper-properties)
(tramp-flush-file-properties): Use `tramp-file-name-unify'. Adapt
message.
(tramp-flush-directory-properties): Simplify.
(tramp-flush-file-function): Add ;;;###tramp-autoload cookie.
Don't use `with-parsed-tramp-file-name', it isn't exposed.
(with-tramp-file-property, with-tramp-connection-property)
(with-tramp-saved-connection-property): Macros moved from tramp.el.
(with-tramp-saved-file-property)
(with-tramp-saved-file-properties)
(with-tramp-saved-connection-properties): New defmacros.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection): Flush "/".
* lisp/net/tramp-crypt.el (tramp-crypt-handle-set-file-modes)
(tramp-crypt-handle-set-file-times)
(tramp-crypt-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-ftp.el (tramp-archive-file-name-handler):
Don't declare.
* lisp/net/tramp-gvfs.el (tramp-gvfs-info): New defun.
(tramp-gvfs-do-copy-or-rename-file)
(tramp-gvfs-handle-delete-directory)
(tramp-gvfs-handle-delete-file, tramp-gvfs-get-root-attributes)
(tramp-gvfs-handle-make-directory): Use it.
(tramp-gvfs-handle-set-file-modes)
(tramp-gvfs-handle-set-file-times)
(tramp-gvfs-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link):
Expand TARGET when flushing file properties.
(tramp-sh-handle-set-file-modes, tramp-sh-handle-set-file-times)
(tramp-sh-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-sh-handle-file-name-all-completions): Protect, when
connection is not established yet.
(tramp-do-copy-or-rename-file-directly): Flush file properties of
NEWNAME when constructing a new remote file name.
(tramp-do-copy-or-rename-file-out-of-band, tramp-sh-handle-make-process):
Use `with-tramp-saved-connection-properties'.
(tramp-sh-handle-delete-file): Flush file properties only after
deleting, otherwise we get a false alarm.
(tramp-sh-handle-process-file): Flush "/".
(tramp-sh-handle-write-region): Handle special case that START is "".
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-process-file)
(tramp-smb-handle-set-file-acl)
(tramp-smb-handle-start-file-process):
Use `with-tramp-saved-connection-properties'.
(tramp-smb-remote-acl-p): New defun.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl): Use it.
(tramp-smb-handle-set-file-modes):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-smb-handle-process-file, tramp-smb-maybe-open-connection):
Flush "/".
* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-process-file): Flush "/".
(tramp-sshfs-handle-set-file-modes)
(tramp-sshfs-handle-set-file-times):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes)
(tramp-sudoedit-handle-set-file-times)
(tramp-sudoedit-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp.el (tramp-archive-file-name-handler): Don't declare.
(tramp-verbose, tramp-file-name-unify, tramp-tramp-file-p)
(tramp-file-local-name, tramp-dissect-file-name)
(tramp-make-tramp-file-name, tramp-get-connection-buffer)
(tramp-get-buffer-string, tramp-debug-message)
(tramp-inhibit-progress-reporter, tramp-message):
Add ;;;###tramp-autoload cookie.
(tramp-file-name): Expose defstruct to tramp-loaddefs.el
(tramp-file-name-unify): New optional arg FILE.
(tramp-get-default-directory, tramp-get-buffer-string)
(tramp-message, tramp-backtrace, tramp-error-with-buffer)
(tramp-with-demoted-errors, tramp-barf-if-file-missing)
(tramp-skeleton-copy-directory, tramp-skeleton-delete-directory)
(tramp-skeleton-directory-files)
(tramp-skeleton-directory-files-and-attributes)
(tramp-skeleton-file-local-copy, tramp-skeleton-write-region):
Remove `tramp-suppress-trace' property, it isn't needed for
defmacros and defsubsts.
(with-tramp-file-property, with-tramp-connection-property)
(with-tramp-saved-connection-property): Move macros to tramp-cache.el.
(tramp-skeleton-directory-files-and-attributes): Fix implementation.
(tramp-skeleton-file-local-copy): Fix docstring.
(tramp-skeleton-set-file-modes-times-uid-gid): New defmacro.
(tramp-skeleton-write-region): Set "file-exists-p" cache property.
(tramp-handle-file-exists-p): Use cached value.
(tramp-process-sentinel): Flush "/".
(tramp-make-tramp-temp-file): Suppress also `tramp-smb-remote-acl-p'.
(tramp-get-connection-buffer):
* test/lisp/net/tramp-tests.el (tramp-test10-write-region)
(tramp-test20-file-modes, tramp-test22-file-times): Extend tests.
2022-08-03 15:30:09 +00:00
|
|
|
|
(tramp-skeleton-set-file-modes-times-uid-gid filename
|
2020-06-10 17:36:53 +00:00
|
|
|
|
(let (tramp-crypt-enabled)
|
|
|
|
|
(tramp-set-file-uid-gid
|
|
|
|
|
(tramp-crypt-encrypt-file-name filename) uid gid))))
|
|
|
|
|
|
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 16:36:53 +00:00
|
|
|
|
(defun tramp-crypt-handle-unlock-file (filename)
|
|
|
|
|
"Like `unlock-file' for Tramp files."
|
|
|
|
|
(let (tramp-crypt-enabled)
|
2021-07-14 16:36:14 +00:00
|
|
|
|
;; `unlock-file' exists since Emacs 28.1.
|
|
|
|
|
(tramp-compat-funcall
|
|
|
|
|
'unlock-file (tramp-crypt-encrypt-file-name filename))))
|
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 16:36:53 +00:00
|
|
|
|
|
2022-09-22 11:14:46 +00:00
|
|
|
|
(with-eval-after-load 'bookmark
|
|
|
|
|
(add-hook 'bookmark-inhibit-context-functions
|
|
|
|
|
#'tramp-crypt-file-name-p)
|
|
|
|
|
(add-hook 'tramp-crypt-unload-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(remove-hook 'bookmark-inhibit-context-functions
|
|
|
|
|
#'tramp-crypt-file-name-p))))
|
|
|
|
|
|
2020-06-07 14:57:32 +00:00
|
|
|
|
(add-hook 'tramp-unload-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(unload-feature 'tramp-crypt 'force)))
|
|
|
|
|
|
|
|
|
|
(provide 'tramp-crypt)
|
|
|
|
|
|
|
|
|
|
;;; TODO:
|
|
|
|
|
|
|
|
|
|
;; * I suggest having a feature where the user can specify to always
|
|
|
|
|
;; use encryption for certain host names. So if you specify a host
|
|
|
|
|
;; name which is on that list (of names, or perhaps regexps?), tramp
|
|
|
|
|
;; would modify the request so as to do the encryption. (Richard Stallman)
|
|
|
|
|
|
|
|
|
|
;;; tramp-crypt.el ends here
|