1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00
Commit Graph

25 Commits

Author SHA1 Message Date
Michael Albinus
22900b5990 Tramp: Rework handling of temporary connection properties
* doc/misc/tramp.texi (Ad-hoc multi-hops): Precise use of parallel
multi-hops.

* lisp/net/tramp-cache.el:
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-androidsu.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: Rename connection properties "process-name",
"process-buffer" and "first-password-request" to " process-name",
" process-buffer" and " first-password-request, repectively".

* lisp/net/tramp-cache.el (tramp-dump-connection-properties):
Don't dump properties starting with a space.
2024-11-13 16:23:27 +01:00
Michael Albinus
1bf1753d79 Tramp: Use when-let*', if-let*' and `and-let*' consequently
* lisp/net/tramp-adb.el:
* lisp/net/tramp-androidsu.el:
* lisp/net/tramp-cache.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-compat.el:
* lisp/net/tramp-container.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-message.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sshfs.el:
* lisp/net/tramp-sudoedit.el:
* lisp/net/tramp.el:
* test/lisp/net/tramp-tests.el:
Use `when-let*', `if-let*' and `and-let*' consequently.  (Bug#73441)
2024-10-30 10:39:02 +01:00
Michael Albinus
c4e8112f98 Remove Emacs 27 compatibility from Tramp
* doc/misc/tramp.texi (Frequently Asked Questions):
Adapt supported Emacs versions.

* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.8.0-pre".

* lisp/net/tramp-compat.el (tramp-compat-file-modes)
(tramp-compat-set-file-modes, tramp-compat-set-file-times)
(tramp-compat-directory-files)
(tramp-compat-directory-files-and-attributes)
(tramp-compat-directory-empty-p, tramp-compat-null-device)
(tramp-compat-string-replace, tramp-compat-string-search)
(tramp-compat-make-lock-file-name)
(tramp-compat-file-name-concat)
(tramp-compat-replace-regexp-in-region, tramp-compat-length<)
(tramp-compat-length>, tramp-compat-length=)
(tramp-compat-always): Remove.

* lisp/net/tramp-adb.el:
* lisp/net/tramp-androidsu.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-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-message.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sshfs.el:
* lisp/net/tramp-sudoedit.el:
* lisp/net/tramp.el: Use original objects instead of their
`tramp-compat-' counterparts when possible.
2024-07-24 15:25:55 +02:00
Michael Albinus
9b12854743 Refactor tramp-*-make-process functions
* lisp/net/tramp.el (tramp-handle-make-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-androidsu.el (tramp-androidsu-handle-make-process):
* lisp/net/tramp-sh.el (tramp-sh-handle-make-process):
Use `tramp-skeleton-make-process'.

* lisp/net/tramp-container.el (tramp-actions-before-shell):
Don't declare.

* lisp/net/tramp-sh.el (tramp-actions-before-shell):
Add ;;;###tramp-autoload cookie.

* lisp/net/tramp.el (tramp-file-local-name): Adapt docstring.
(tramp-skeleton-make-process): New defmacro.
2024-06-10 14:37:48 +02:00
Michael Albinus
91509d5d2a Make Tramp's async processes more robust
* lisp/simple.el (shell-command-sentinel): Check process property
`remote-command' first.

* lisp/net/tramp.el (tramp-handle-make-process):
* lisp/net/tramp-androidsu.el (tramp-androidsu-handle-make-process):
Set sentinel `ignore'.  (Bug#71049)

* test/lisp/net/tramp-tests.el
(tramp--test-deftest-direct-async-process): Don't suppress
internal sentinel.
(tramp-test32-shell-commanddirect-async): Don't tag it :unstable.
2024-05-25 17:23:30 +02:00
Michael Albinus
1a48b53040 Adapt Tramp's progress-reporter messages
* lisp/net/tramp-androidsu.el (tramp-androidsu-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
Adapt progress-reporter message.

* lisp/net/tramp-sh.el (tramp-maybe-open-connection):
Divide progress-reporter into two parts.  (Bug#70901)
2024-05-25 11:34:04 +02:00
Michael Albinus
041aa3ffc6 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs 2024-05-14 10:50:17 +02:00
Michael Albinus
dd13ab0756 Trace Tramp user error
* lisp/net/tramp-androidsu.el (tramp-androidsu-maybe-open-connection):
Use `tramp-user-error' for the traces.
2024-05-14 10:49:52 +02:00
Po Lu
becdee7482 ; * lisp/net/tramp-androidsu.el (tramp-androidsu-handle-make-process): Typo. 2024-05-14 16:20:17 +08:00
Po Lu
65b0446633 Port tramp-androidsu to a wider variety of systems
* lisp/net/tramp-androidsu.el
(tramp-androidsu-maybe-open-connection): Search for `su' when
the connection is initiated; replace PATH of inferior shell with
trap-androidsu-remote-path.
(tramp-androidsu-handle-make-process): Do not provide username
if root.
2024-05-14 16:15:14 +08:00
Michael Albinus
339b8349f4 More Tramp optional methods
* doc/misc/tramp.texi (Inline methods) <krlogin, ksu>:
(External methods) <fcp, nc>: These are optional methods.

* etc/NEWS: Mention more optional Tramp methods.

* lisp/net/tramp-androidsu.el (tramp-enable-androidsu-method):
Use proper regexp for `tramp-default-user-alist'.

* lisp/net/tramp-sh.el (tramp-enable-nc-method)
(tramp-enable-ksu-method, tramp-enable-krlogin-method)
(tramp-enable-fcp-method): New defuns.  Move respective
configurations there.

* lisp/net/tramp.el (tramp-enable-method): Implement completion
for interactive use.

* test/lisp/net/tramp-tests.el (tramp-test03-file-name-defaults)
(tramp-test03-file-name-host-rules): Extend tests.
2024-05-08 13:44:15 +02:00
Michael Albinus
d0b36be59a Fix last change in tramp-androidsu.el 2024-05-07 19:44:19 +02:00
Michael Albinus
4808c63d43 Add Tramp method "apptainer"
* doc/misc/tramp.texi (Top, Configuration): Add "Optional methods".
(Optional methods): New section.
(Inline methods) <androidsu, toolbox, flatpak>: These are optional
methods.
(Inline methods) <apptainer>: Add.

* etc/NEWS: New Tramp method "apptainer".
Some Tramp methods are optional.
Fix typos.

* lisp/net/tramp-androidsu.el (tramp-enable-androidsu-method):
New defun.  Call it when `system-type' is `android'.

* lisp/net/tramp-container.el (tramp-apptainer-program): New defcustom.
(tramp-apptainer-method): New defconst.
(tramp-apptainer--completion-function)
(tramp-enable-toolbox-method, tramp-enable-flatpak-method)
(tramp-enable-apptainer-method): New defuns.

* lisp/net/tramp.el (tramp-enable-method): New defun.

* test/lisp/net/tramp-tests.el (tramp--test-container-p):
Add "apptainer".
(tramp--test-supports-processes-p): Extend function.
2024-05-07 09:56:05 +02:00
Po Lu
123bfc2779 Correct custom type in tramp-androidsu.el
* lisp/net/tramp-androidsu.el (tramp-androidsu-remote-path): Set
type to '(repeat string).
2024-04-01 21:13:17 +08:00
Po Lu
9caf5cb55a Fix androidsu's `make-process' file name handler
* lisp/net/tramp-androidsu.el
(tramp-androidsu-handle-make-process): Disable exec loader
around call to setuid su binary.
2024-04-01 14:05:24 +08:00
Michael Albinus
b12059e4c3 Tramp fixes after running regression tests on Android
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
Unset environment variable PS2.

* lisp/net/tramp-androidsu.el (tramp-default-host-alist):
Don't add an entry; `tramp-default-host' is set properly.
(tramp-androidsu-maybe-open-connection): Don't set connection
property "remote-namespace" to nil, this is the default anyway.
Don't set connection property "remote-path", we use
connection-local values instead.  Unset environment variable PS2.
Dump shell options after setting all of them.
(tramp-androidsu-handle-make-process): Don't use hard-coded user "root".
(tramp-androidsu-connection-local-default-variables): New defvar.
Add it to connection-local profiles.
2024-03-06 17:51:42 +01:00
Po Lu
845d334c10 ; Fix last change
* lisp/net/tramp-androidsu.el
(tramp-androidsu-generate-wrapper): Arguments to fset must be
symbols rather than functions.
2024-03-06 10:20:36 +08:00
Michael Albinus
5b49a38d1b tramp-androidsu.el code cleanup
* lisp/net/tramp-androidsu.el (tramp-androidsu-generate-wrapper):
Prefer #' notation for function names.
(tramp-androidsu-handle-copy-file)
(tramp-androidsu-handle-file-local-copy)
(tramp-androidsu-handle-make-symbolic-link)
(tramp-androidsu-handle-rename-file)
(tramp-androidsu-handle-write-region): Don't use a wrapper.
(tramp-adb-connection-local-default-ps-profile): Don't initialize,
this happens in tramp-db.el.
2024-03-04 15:44:24 +01:00
Po Lu
f5c65dae09 Update tramp-androidsu
* doc/misc/tramp.texi (Quick Start Guide): Remove documentation
pertaining to tramp-androidsu.el.
(Inline methods): Document it here instead.

* lisp/net/tramp-androidsu.el
(tramp-androidsu-mount-global-namespace)
(tramp-androidsu-remote-path, tramp-androidsu-local-shell-name)
(tramp-androidsu-local-tmp-directory, add-to-list)
(tramp-androidsu-maybe-open-connection)
(tramp-androidsu-handle-access-file)
(tramp-androidsu-handle-add-name-to-file)
(tramp-androidsu-handle-copy-directory)
(tramp-androidsu-sh-handle-copy-file)
(tramp-androidsu-handle-copy-file)
(tramp-androidsu-adb-handle-delete-directory)
(tramp-androidsu-handle-delete-directory)
(tramp-androidsu-adb-handle-delete-file)
(tramp-androidsu-handle-delete-file)
(tramp-androidsu-handle-directory-file-name)
(tramp-androidsu-handle-directory-files)
(tramp-androidsu-adb-handle-directory-files-and-attributes)
(tramp-androidsu-handle-directory-files-and-attributes)
(tramp-androidsu-handle-dired-uncache)
(tramp-androidsu-adb-handle-exec-path)
(tramp-androidsu-handle-exec-path)
(tramp-androidsu-handle-expand-file-name)
(tramp-androidsu-handle-file-accessible-directory-p)
(tramp-androidsu-adb-handle-file-attributes)
(tramp-androidsu-handle-file-attributes)
(tramp-androidsu-handle-file-directory-p)
(tramp-androidsu-handle-file-equal-p)
(tramp-androidsu-adb-handle-file-executable-p)
(tramp-androidsu-handle-file-executable-p)
(tramp-androidsu-adb-handle-file-exists-p)
(tramp-androidsu-handle-file-exists-p)
(tramp-androidsu-handle-file-group-gid)
(tramp-androidsu-handle-file-in-directory-p)
(tramp-androidsu-sh-handle-file-local-copy)
(tramp-androidsu-handle-file-local-copy)
(tramp-androidsu-handle-file-locked-p)
(tramp-androidsu-handle-file-modes)
(tramp-androidsu-adb-handle-file-name-all-completions)
(tramp-androidsu-handle-file-name-all-completions)
(tramp-androidsu-handle-file-name-as-directory)
(tramp-androidsu-handle-file-name-case-insensitive-p)
(tramp-androidsu-handle-file-name-completion)
(tramp-androidsu-handle-file-name-directory)
(tramp-androidsu-handle-file-name-nondirectory)
(tramp-androidsu-handle-file-newer-than-file-p)
(tramp-androidsu-handle-file-notify-add-watch)
(tramp-androidsu-handle-file-notify-rm-watch)
(tramp-androidsu-handle-file-notify-valid-p)
(tramp-androidsu-adb-handle-file-readable-p)
(tramp-androidsu-handle-file-readable-p)
(tramp-androidsu-handle-file-regular-p)
(tramp-androidsu-handle-file-remote-p)
(tramp-androidsu-handle-file-selinux-context)
(tramp-androidsu-handle-file-symlink-p)
(tramp-androidsu-adb-handle-file-system-info)
(tramp-androidsu-handle-file-system-info)
(tramp-androidsu-handle-file-truename)
(tramp-androidsu-handle-file-user-uid)
(tramp-androidsu-adb-handle-file-writable-p)
(tramp-androidsu-handle-file-writable-p)
(tramp-androidsu-handle-find-backup-file-name)
(tramp-androidsu-handle-insert-directory)
(tramp-androidsu-handle-insert-file-contents)
(tramp-androidsu-handle-list-system-processes)
(tramp-androidsu-handle-load, tramp-androidsu-handle-lock-file)
(tramp-androidsu-handle-make-auto-save-file-name)
(tramp-androidsu-adb-handle-make-directory)
(tramp-androidsu-handle-make-directory)
(tramp-androidsu-handle-make-lock-file-name)
(tramp-androidsu-handle-make-nearby-temp-file)
(tramp-androidsu-make-process)
(tramp-androidsu-sh-handle-make-symbolic-link)
(tramp-androidsu-handle-make-symbolic-link)
(tramp-androidsu-handle-memory-info)
(tramp-androidsu-handle-process-attributes)
(tramp-androidsu-adb-handle-process-file)
(tramp-androidsu-handle-process-file)
(tramp-androidsu-sh-handle-rename-file)
(tramp-androidsu-handle-rename-file)
(tramp-androidsu-adb-handle-set-file-modes)
(tramp-androidsu-handle-set-file-modes)
(tramp-androidsu-adb-handle-set-file-times)
(tramp-androidsu-handle-set-file-times)
(tramp-androidsu-handle-set-visited-file-modtime)
(tramp-androidsu-handle-shell-command)
(tramp-androidsu-handle-start-file-process)
(tramp-androidsu-handle-substitute-in-file-name)
(tramp-androidsu-handle-temporary-file-directory)
(tramp-androidsu-adb-handle-get-remote-gid)
(tramp-androidsu-handle-get-remote-gid)
(tramp-androidsu-adb-handle-get-remote-groups)
(tramp-androidsu-handle-get-remote-groups)
(tramp-androidsu-adb-handle-get-remote-uid)
(tramp-androidsu-handle-get-remote-uid)
(tramp-androidsu-handle-unlock-file)
(tramp-androidsu-handle-verify-visited-file-modtime)
(tramp-androidsu-sh-handle-write-region)
(tramp-androidsu-handle-write-region)
(tramp-androidsu-file-name-handler-alist): Make hard-coded
executable and file names defconsts, remove redundant wrapper
functions and remove names of wrapped functions from their
wrappers.
2024-03-04 11:24:31 +08:00
Po Lu
15ed441fd5 Fix subprocess creation in directories managed by tramp-androidsu
* lisp/net/tramp-androidsu.el
(tramp-androidsu-maybe-open-connection): Set connection property
remote-namespace to t or nil subject to whether su runs in the
global mount namespace.
(tramp-androidsu-adb-handle-make-process): Delete function.
(tramp-androidsu-make-process): New function.
(tramp-androidsu-file-name-handler-alist): Switch to
tramp-androidsu-make-process.
2024-02-29 10:59:09 +08:00
Po Lu
977a56d5c7 ; Fix last change
* lisp/net/tramp-androidsu.el
(tramp-androidsu-handle-write-region): Delete function.
(tramp-androidsu-sh-handle-write-region): New function.
(tramp-androidsu-file-name-handler-alist): Avoid infinite
recursion by replacing handle-write-region with the tramp-sh
implementation.
2024-02-28 12:23:32 +08:00
Po Lu
f1db8cf9a0 Lift restrictions on `tramp-androidsu's app data access
* lisp/net/tramp-adb.el (tramp-adb-handle-copy-file): Remove
code now unnecessary.

* lisp/net/tramp-androidsu.el
(tramp-androidsu-mount-global-namespace): New user option.
(tramp-androidsu-su-mm-supported): New variable.
(tramp-androidsu-maybe-open-connection): Detect whether su
supports the -mm option, and provide it if so.
(tramp-androidsu-adb-handle-copy-file)
(tramp-androidsu-adb-handle-rename-file): Delete functions.
(tramp-androidsu-sh-handle-copy-file)
(tramp-androidsu-sh-handle-rename-file): New functions.
(tramp-androidsu-file-name-handler-alist): Switch to tramp-sh's
copy and rename handlers.
2024-02-28 12:05:59 +08:00
Po Lu
32b4f9d21b Disable process tracing before launching /system/bin/su
* lisp/net/tramp-androidsu.el
(tramp-androidsu-maybe-open-connection): Disable process tracing
around start-process, that the setuid su binary may be started
regardless of its status.
2024-02-27 10:05:56 +08:00
Po Lu
1687adcb5c ; Delete trailing whitespace
* lisp/net/tramp-androidsu.el
(tramp-androidsu-maybe-open-connection): Delete trailing
whitespace.
2024-02-26 14:13:49 +08:00
Po Lu
babe6a5e94 Introduce a new TRAMP method `androidsu'
* doc/misc/tramp.texi (Quick Start Guide): Document the new
method.

* etc/NEWS (Tramp): Announce new method.

* lisp/net/tramp-adb.el (tramp-adb-handle-file-attributes)
(tramp-adb-handle-directory-files-and-attributes)
(tramp-adb-handle-file-name-all-completions): Properly print
ls's exit status in the presence of a pipe.
(tramp-adb-handle-copy-file): If the androidsu backend is in
use, call cp rather than adb push.
(tramp-adb-send-command): Disable ADB-specific code under
androidsu.
(tramp-adb-send-command-and-check): New argument
COMMAND-AUGMENTED-P.

* lisp/net/tramp-androidsu.el (tramp, tramp-adb, tramp-sh)
(tramp-androidsu-method, add-to-list)
(tramp-androidsu-maybe-open-connection)
(tramp-androidsu-generate-wrapper)
(tramp-androidsu-handle-access-file)
(tramp-androidsu-handle-add-name-to-file)
(tramp-androidsu-handle-copy-directory)
(tramp-androidsu-adb-handle-copy-file)
(tramp-androidsu-adb-handle-delete-directory)
(tramp-androidsu-adb-handle-delete-file)
(tramp-androidsu-handle-directory-file-name)
(tramp-androidsu-handle-directory-files)
(tramp-androidsu-adb-handle-directory-files-and-attributes)
(tramp-androidsu-handle-dired-uncache)
(tramp-androidsu-adb-handle-exec-path)
(tramp-androidsu-handle-expand-file-name)
(tramp-androidsu-handle-file-accessible-directory-p)
(tramp-androidsu-adb-handle-file-attributes)
(tramp-androidsu-handle-file-directory-p)
(tramp-androidsu-handle-file-equal-p)
(tramp-androidsu-adb-handle-file-executable-p)
(tramp-androidsu-adb-handle-file-exists-p)
(tramp-androidsu-handle-file-group-gid)
(tramp-androidsu-handle-file-in-directory-p)
(tramp-androidsu-sh-handle-file-local-copy)
(tramp-androidsu-handle-file-locked-p)
(tramp-androidsu-handle-file-modes)
(tramp-androidsu-adb-handle-file-name-all-completions)
(tramp-androidsu-handle-file-name-as-directory)
(tramp-androidsu-handle-file-name-case-insensitive-p)
(tramp-androidsu-handle-file-name-completion)
(tramp-androidsu-handle-file-name-directory)
(tramp-androidsu-handle-file-name-nondirectory)
(tramp-androidsu-handle-file-newer-than-file-p)
(tramp-androidsu-handle-file-notify-add-watch)
(tramp-androidsu-handle-file-notify-rm-watch)
(tramp-androidsu-handle-file-notify-valid-p)
(tramp-androidsu-adb-handle-file-readable-p)
(tramp-androidsu-handle-file-regular-p)
(tramp-androidsu-handle-file-remote-p)
(tramp-androidsu-handle-file-selinux-context)
(tramp-androidsu-handle-file-symlink-p)
(tramp-androidsu-adb-handle-file-system-info)
(tramp-androidsu-handle-file-truename)
(tramp-androidsu-handle-file-user-uid)
(tramp-androidsu-adb-handle-file-writable-p)
(tramp-androidsu-handle-find-backup-file-name)
(tramp-androidsu-handle-insert-directory)
(tramp-androidsu-handle-insert-file-contents)
(tramp-androidsu-handle-list-system-processes)
(tramp-androidsu-handle-load, tramp-androidsu-handle-lock-file)
(tramp-androidsu-handle-make-auto-save-file-name)
(tramp-androidsu-adb-handle-make-directory)
(tramp-androidsu-handle-make-lock-file-name)
(tramp-androidsu-handle-make-nearby-temp-file)
(tramp-androidsu-adb-handle-make-process)
(tramp-androidsu-sh-handle-make-symbolic-link)
(tramp-androidsu-handle-memory-info)
(tramp-androidsu-handle-process-attributes)
(tramp-androidsu-adb-handle-process-file)
(tramp-androidsu-adb-handle-rename-file)
(tramp-androidsu-adb-handle-set-file-modes)
(tramp-androidsu-adb-handle-set-file-times)
(tramp-androidsu-handle-set-visited-file-modtime)
(tramp-androidsu-handle-shell-command)
(tramp-androidsu-handle-start-file-process)
(tramp-androidsu-handle-substitute-in-file-name)
(tramp-androidsu-handle-temporary-file-directory)
(tramp-androidsu-adb-handle-get-remote-gid)
(tramp-androidsu-adb-handle-get-remote-groups)
(tramp-androidsu-adb-handle-get-remote-uid)
(tramp-androidsu-handle-unlock-file)
(tramp-androidsu-handle-verify-visited-file-modtime)
(tramp-androidsu-handle-write-region)
(tramp-androidsu-file-name-handler-alist)
(tramp-androidsu-file-name-p, tramp-androidsu-file-name-handler)
(tramp-register-foreign-file-name-handler)
(tramp-adb-connection-local-default-ps-profile, shell)
(tramp-unload-hook, tramp-androidsu): New file.
2024-02-26 14:13:14 +08:00