aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2024-03-04 11:21:53 +0800
committerPo Lu2024-03-04 11:24:31 +0800
commitf5c65dae099485f4df128b61d36ae9e5af8518a8 (patch)
tree1145956ba9b7fca5fb53fbd0e8f06649a015d984
parent445f376e4e613ebee94d2844926269bfa8793858 (diff)
downloademacs-f5c65dae099485f4df128b61d36ae9e5af8518a8.tar.gz
emacs-f5c65dae099485f4df128b61d36ae9e5af8518a8.zip
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.
-rw-r--r--doc/misc/tramp.texi19
-rw-r--r--lisp/net/tramp-androidsu.el405
2 files changed, 152 insertions, 272 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 09b875ad3fa..d67e2fcb64c 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -510,7 +510,6 @@ default host name. Therefore, it is convenient to open a file as
510The method @option{sg} stands for ``switch group''; here the user name 510The method @option{sg} stands for ``switch group''; here the user name
511is used as the group to change to. The default host name is the same. 511is used as the group to change to. The default host name is the same.
512 512
513
514@anchor{Quick Start Guide Combining ssh, plink, su, sudo and doas methods} 513@anchor{Quick Start Guide Combining ssh, plink, su, sudo and doas methods}
515@section Combining @option{ssh} or @option{plink} with @option{su}, @option{sudo} or @option{doas} 514@section Combining @option{ssh} or @option{plink} with @option{su}, @option{sudo} or @option{doas}
516@cindex method @option{ssh} 515@cindex method @option{ssh}
@@ -523,8 +522,6 @@ is used as the group to change to. The default host name is the same.
523@cindex @option{sudo} method 522@cindex @option{sudo} method
524@cindex method @option{doas} 523@cindex method @option{doas}
525@cindex @option{doas} method 524@cindex @option{doas} method
526@cindex method @option{androidsu}
527@cindex @option{androidsu} method
528 525
529If the @option{su}, @option{sudo} or @option{doas} option should be 526If the @option{su}, @option{sudo} or @option{doas} option should be
530performed on another host, it can be combined with a leading 527performed on another host, it can be combined with a leading
@@ -535,12 +532,6 @@ a simple case, the syntax looks like
535@file{@trampfn{ssh@value{postfixhop}user@@host|sudo,,/path/to/file}}. 532@file{@trampfn{ssh@value{postfixhop}user@@host|sudo,,/path/to/file}}.
536@xref{Ad-hoc multi-hops}. 533@xref{Ad-hoc multi-hops}.
537 534
538The @option{su} method and other shell-based methods conflict with
539non-standard @command{su} implementations popular among Android users
540and the restricted command-line utilities distributed with that system.
541The @option{androidsu} method enables accessing files through
542@command{su} on such systems, but multi-hops are not supported.
543
544@anchor{Quick Start Guide sudoedit method} 535@anchor{Quick Start Guide sudoedit method}
545@section Using @command{sudoedit} 536@section Using @command{sudoedit}
546@cindex method @option{sudoedit} 537@cindex method @option{sudoedit}
@@ -826,6 +817,16 @@ editing as another user. The host can be either @samp{localhost} or
826the host returned by the function @command{(system-name)}. See 817the host returned by the function @command{(system-name)}. See
827@ref{Multi-hops} for an exception to this behavior. 818@ref{Multi-hops} for an exception to this behavior.
828 819
820@cindex method @option{androidsu}
821@cindex @option{androidsu} method
822Because the default implementation of the @option{su} method and other
823shell-based methods conflict with non-standard @command{su}
824implementations popular among Android users and the restricted
825command-line utilities distributed with that system, a largely
826equivalent @option{androidsu} method is provided for that system with
827workarounds for its many idiosyncrasies, with the exception that
828multi-hops are unsupported.
829
829@item @option{sudo} 830@item @option{sudo}
830@cindex method @option{sudo} 831@cindex method @option{sudo}
831@cindex @option{sudo} method 832@cindex @option{sudo} method
diff --git a/lisp/net/tramp-androidsu.el b/lisp/net/tramp-androidsu.el
index 1623a0341b2..12453d40acd 100644
--- a/lisp/net/tramp-androidsu.el
+++ b/lisp/net/tramp-androidsu.el
@@ -1,7 +1,8 @@
1;;; tramp-androidsu.el --- TRAMP method for Android superuser shells -*- lexical-binding:t -*- 1;;; tramp-androidsu.el --- Tramp method for Android superuser shells -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2024 Free Software Foundation, Inc. 3;; Copyright (C) 2024 Free Software Foundation, Inc.
4 4
5;; Author: Po Lu
5;; Keywords: comm, processes 6;; Keywords: comm, processes
6;; Package: tramp 7;; Package: tramp
7 8
@@ -22,12 +23,15 @@
22 23
23;;; Commentary: 24;;; Commentary:
24 25
26;; `su' method implementation for Android.
27;;
25;; The `su' method struggles (as do other shell-based methods) with the 28;; The `su' method struggles (as do other shell-based methods) with the
26;; crippled versions of many Unix utilities installed on Android, 29;; crippled versions of many Unix utilities installed on Android,
27;; workarounds for which are implemented in the `adb' method. This 30;; workarounds for which are implemented in the `adb' method. This
28;; method defines a shell-based method that is identical in function to 31;; method defines a shell-based method that is identical in function to
29;; `su', but reuses such code from the `adb' method where applicable and 32;; and replaces if connecting to a local Android machine `su', but
30;; also provides for certain mannerisms of popular Android `su' 33;; reuses such code from the `adb' method where applicable and also
34;; provides for certain mannerisms of popular Android `su'
31;; implementations. 35;; implementations.
32 36
33;;; Code: 37;;; Code:
@@ -43,33 +47,51 @@
43;;;###tramp-autoload 47;;;###tramp-autoload
44(defcustom tramp-androidsu-mount-global-namespace t 48(defcustom tramp-androidsu-mount-global-namespace t
45 "When non-nil, browse files from within the global mount namespace. 49 "When non-nil, browse files from within the global mount namespace.
46On systems that assign each application a unique view of the filesystem 50On systems that assign each application a unique view of the
47by executing them within individual mount namespaces and thus conceal 51filesystem by executing them within individual mount namespaces
48each application's data directories from others, invoke `su' with the 52and thus conceal each application's data directories from
49option `-mm' in order for the shell launched to run within the global 53others, invoke `su' with the option `-mm' in order for the shell
50mount namespace, so that TRAMP may edit files belonging to any and all 54launched to run within the global mount namespace, so that Tramp
51applications." 55may edit files belonging to any and all applications."
52 :group 'tramp 56 :group 'tramp
53 :version "30.1" 57 :version "30.1"
54 :type 'boolean) 58 :type 'boolean)
55 59
60;;;###tramp-autoload
61(defcustom tramp-androidsu-remote-path '("/system/bin"
62 "/system/xbin")
63 "Directories in which to search for transfer programs and the like."
64 :group 'tramp
65 :version "30.1"
66 :type '(list string))
67
56(defvar tramp-androidsu-su-mm-supported 'unknown 68(defvar tramp-androidsu-su-mm-supported 'unknown
57 "Whether `su -mm' is supported on this system.") 69 "Whether `su -mm' is supported on this system.")
58 70
59;;;###tramp-autoload 71;;;###tramp-autoload
72(defconst tramp-androidsu-local-shell-name "/system/bin/sh"
73 "Name of the local shell on Android.")
74
75;;;###tramp-autoload
76(defconst tramp-androidsu-local-tmp-directory "/data/local/tmp"
77 "Name of the local temporary directory on Android.")
78
79;;;###tramp-autoload
60(tramp--with-startup 80(tramp--with-startup
61 (add-to-list 'tramp-methods 81 (add-to-list 'tramp-methods
62 `(,tramp-androidsu-method 82 `(,tramp-androidsu-method
63 (tramp-login-program "su") 83 (tramp-login-program "su")
64 (tramp-login-args (("-") ("%u"))) 84 (tramp-login-args (("-") ("%u")))
65 (tramp-remote-shell "/system/bin/sh") 85 (tramp-remote-shell ,tramp-androidsu-local-shell-name)
66 (tramp-remote-shell-login ("-l")) 86 (tramp-remote-shell-login ("-l"))
67 (tramp-remote-shell-args ("-c")) 87 (tramp-remote-shell-args ("-c"))
68 (tramp-tmpdir "/data/local/tmp") 88 (tramp-tmpdir ,tramp-androidsu-local-tmp-directory)
69 (tramp-connection-timeout 10))) 89 (tramp-connection-timeout 10)
70 90 (tramp-shell-name ,tramp-androidsu-local-shell-name)))
71 (add-to-list 'tramp-default-host-alist 91 (add-to-list 'tramp-default-host-alist
72 `(,tramp-androidsu-method nil "localhost"))) 92 `(,tramp-androidsu-method nil "localhost"))
93 (add-to-list 'tramp-default-user-alist
94 `(,tramp-androidsu-method nil ,tramp-root-id-string)))
73 95
74(defvar android-use-exec-loader) ; androidfns.c. 96(defvar android-use-exec-loader) ; androidfns.c.
75 97
@@ -112,15 +134,14 @@ multibyte mode and waits for the shell prompt to appear."
112 ;; there's no guarantee that it's 134 ;; there's no guarantee that it's
113 ;; possible to execute it with 135 ;; possible to execute it with
114 ;; `android-use-exec-loader' off. 136 ;; `android-use-exec-loader' off.
115 "/system/bin/sh" "-i")) 137 tramp-androidsu-local-shell-name "-i"))
116 (user (tramp-file-name-user vec)) 138 (user (tramp-file-name-user vec))
117 command) 139 command)
118 ;; Set sentinel. Initialize variables. 140 ;; Set sentinel. Initialize variables.
119 (set-process-sentinel p #'tramp-process-sentinel) 141 (set-process-sentinel p #'tramp-process-sentinel)
120 (tramp-post-process-creation p vec) 142 (tramp-post-process-creation p vec)
121 ;; Replace `login-args' place holders. 143 ;; Replace `login-args' place holders.
122 (setq command (format "exec su - %s || exit" 144 (setq command (format "exec su - %s || exit" user))
123 (or user "root")))
124 (tramp-set-connection-property vec "remote-namespace" nil) 145 (tramp-set-connection-property vec "remote-namespace" nil)
125 ;; Attempt to execute the shell inside the global mount 146 ;; Attempt to execute the shell inside the global mount
126 ;; namespace if requested. 147 ;; namespace if requested.
@@ -142,7 +163,7 @@ multibyte mode and waits for the shell prompt to appear."
142 (tramp-set-connection-property 163 (tramp-set-connection-property
143 vec "remote-namespace" t) 164 vec "remote-namespace" t)
144 (setq command (format "exec su -mm - %s || exit" 165 (setq command (format "exec su -mm - %s || exit"
145 (or user "root")))))) 166 user)))))
146 ;; Send the command. 167 ;; Send the command.
147 (tramp-message vec 3 "Sending command `%s'" command) 168 (tramp-message vec 3 "Sending command `%s'" command)
148 (tramp-adb-send-command vec command t t) 169 (tramp-adb-send-command vec command t t)
@@ -154,7 +175,6 @@ multibyte mode and waits for the shell prompt to appear."
154 (with-current-buffer (process-buffer p) 175 (with-current-buffer (process-buffer p)
155 (tramp-wait-for-regexp p tramp-connection-timeout 176 (tramp-wait-for-regexp p tramp-connection-timeout
156 "#[[:space:]]*$")) 177 "#[[:space:]]*$"))
157
158 ;; Set connection-local variables. 178 ;; Set connection-local variables.
159 (tramp-set-connection-local-variables vec) 179 (tramp-set-connection-local-variables vec)
160 ;; Change prompt. 180 ;; Change prompt.
@@ -167,7 +187,8 @@ multibyte mode and waits for the shell prompt to appear."
167 ;; Dump option settings in the traces. 187 ;; Dump option settings in the traces.
168 (when (>= tramp-verbose 9) 188 (when (>= tramp-verbose 9)
169 (tramp-adb-send-command vec "set -o")) 189 (tramp-adb-send-command vec "set -o"))
170 ;; Disable Unicode. 190 ;; Disable Unicode, for otherwise Unicode filenames will
191 ;; not be decoded correctly.
171 (tramp-adb-send-command vec "set +U") 192 (tramp-adb-send-command vec "set +U")
172 ;; Disable echo expansion. 193 ;; Disable echo expansion.
173 (tramp-adb-send-command 194 (tramp-adb-send-command
@@ -188,8 +209,7 @@ multibyte mode and waits for the shell prompt to appear."
188 t))) 209 t)))
189 ;; Set the remote PATH to a suitable value. 210 ;; Set the remote PATH to a suitable value.
190 (tramp-set-connection-property vec "remote-path" 211 (tramp-set-connection-property vec "remote-path"
191 '("/system/bin" 212 tramp-androidsu-remote-path)
192 "/system/xbin"))
193 ;; Mark it as connected. 213 ;; Mark it as connected.
194 (tramp-set-connection-property p "connected" t)))) 214 (tramp-set-connection-property p "connected" t))))
195 ;; Cleanup, and propagate the signal. 215 ;; Cleanup, and propagate the signal.
@@ -223,163 +243,49 @@ FUNCTION."
223 (fset 'tramp-adb-wait-for-output tramp-adb-wait-for-output) 243 (fset 'tramp-adb-wait-for-output tramp-adb-wait-for-output)
224 (fset 'tramp-adb-maybe-open-connection tramp-adb-maybe-open-connection))))) 244 (fset 'tramp-adb-maybe-open-connection tramp-adb-maybe-open-connection)))))
225 245
226(defalias 'tramp-androidsu-handle-access-file 246(defalias 'tramp-androidsu-handle-copy-file
227 (tramp-androidsu-generate-wrapper #'tramp-handle-access-file))
228
229(defalias 'tramp-androidsu-handle-add-name-to-file
230 (tramp-androidsu-generate-wrapper #'tramp-handle-add-name-to-file))
231
232(defalias 'tramp-androidsu-handle-copy-directory
233 (tramp-androidsu-generate-wrapper #'tramp-handle-copy-directory))
234
235(defalias 'tramp-androidsu-sh-handle-copy-file
236 (tramp-androidsu-generate-wrapper #'tramp-sh-handle-copy-file)) 247 (tramp-androidsu-generate-wrapper #'tramp-sh-handle-copy-file))
237 248
238(defalias 'tramp-androidsu-adb-handle-delete-directory 249(defalias 'tramp-androidsu-handle-delete-directory
239 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-delete-directory)) 250 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-delete-directory))
240 251
241(defalias 'tramp-androidsu-adb-handle-delete-file 252(defalias 'tramp-androidsu-handle-delete-file
242 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-delete-file)) 253 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-delete-file))
243 254
244(defalias 'tramp-androidsu-handle-directory-file-name 255(defalias 'tramp-androidsu-handle-directory-files-and-attributes
245 (tramp-androidsu-generate-wrapper #'tramp-handle-directory-file-name))
246
247(defalias 'tramp-androidsu-handle-directory-files
248 (tramp-androidsu-generate-wrapper #'tramp-handle-directory-files))
249
250(defalias 'tramp-androidsu-adb-handle-directory-files-and-attributes
251 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-directory-files-and-attributes)) 256 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-directory-files-and-attributes))
252 257
253(defalias 'tramp-androidsu-handle-dired-uncache 258(defalias 'tramp-androidsu-handle-exec-path
254 (tramp-androidsu-generate-wrapper #'tramp-handle-dired-uncache))
255
256(defalias 'tramp-androidsu-adb-handle-exec-path
257 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-exec-path)) 259 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-exec-path))
258 260
259(defalias 'tramp-androidsu-handle-expand-file-name 261(defalias 'tramp-androidsu-handle-file-attributes
260 (tramp-androidsu-generate-wrapper #'tramp-handle-expand-file-name))
261
262(defalias 'tramp-androidsu-handle-file-accessible-directory-p
263 (tramp-androidsu-generate-wrapper #'tramp-handle-file-accessible-directory-p))
264
265(defalias 'tramp-androidsu-adb-handle-file-attributes
266 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-attributes)) 262 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-attributes))
267 263
268(defalias 'tramp-androidsu-handle-file-directory-p 264(defalias 'tramp-androidsu-handle-file-executable-p
269 (tramp-androidsu-generate-wrapper #'tramp-handle-file-directory-p))
270
271(defalias 'tramp-androidsu-handle-file-equal-p
272 (tramp-androidsu-generate-wrapper #'tramp-handle-file-equal-p))
273
274(defalias 'tramp-androidsu-adb-handle-file-executable-p
275 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-executable-p)) 265 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-executable-p))
276 266
277(defalias 'tramp-androidsu-adb-handle-file-exists-p 267(defalias 'tramp-androidsu-handle-file-exists-p
278 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-exists-p)) 268 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-exists-p))
279 269
280(defalias 'tramp-androidsu-handle-file-group-gid 270(defalias 'tramp-androidsu-handle-file-local-copy
281 (tramp-androidsu-generate-wrapper #'tramp-handle-file-group-gid))
282
283(defalias 'tramp-androidsu-handle-file-in-directory-p
284 (tramp-androidsu-generate-wrapper #'tramp-handle-file-in-directory-p))
285
286(defalias 'tramp-androidsu-sh-handle-file-local-copy
287 (tramp-androidsu-generate-wrapper #'tramp-sh-handle-file-local-copy)) 271 (tramp-androidsu-generate-wrapper #'tramp-sh-handle-file-local-copy))
288 272
289(defalias 'tramp-androidsu-handle-file-locked-p 273(defalias 'tramp-androidsu-handle-file-name-all-completions
290 (tramp-androidsu-generate-wrapper #'tramp-handle-file-locked-p))
291
292(defalias 'tramp-androidsu-handle-file-modes
293 (tramp-androidsu-generate-wrapper #'tramp-handle-file-modes))
294
295(defalias 'tramp-androidsu-adb-handle-file-name-all-completions
296 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-name-all-completions)) 274 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-name-all-completions))
297 275
298(defalias 'tramp-androidsu-handle-file-name-as-directory 276(defalias 'tramp-androidsu-handle-file-readable-p
299 (tramp-androidsu-generate-wrapper #'tramp-handle-file-name-as-directory))
300
301(defalias 'tramp-androidsu-handle-file-name-case-insensitive-p
302 (tramp-androidsu-generate-wrapper #'tramp-handle-file-name-case-insensitive-p))
303
304(defalias 'tramp-androidsu-handle-file-name-completion
305 (tramp-androidsu-generate-wrapper #'tramp-handle-file-name-completion))
306
307(defalias 'tramp-androidsu-handle-file-name-directory
308 (tramp-androidsu-generate-wrapper #'tramp-handle-file-name-directory))
309
310(defalias 'tramp-androidsu-handle-file-name-nondirectory
311 (tramp-androidsu-generate-wrapper #'tramp-handle-file-name-nondirectory))
312
313(defalias 'tramp-androidsu-handle-file-newer-than-file-p
314 (tramp-androidsu-generate-wrapper #'tramp-handle-file-newer-than-file-p))
315
316(defalias 'tramp-androidsu-handle-file-notify-add-watch
317 (tramp-androidsu-generate-wrapper #'tramp-handle-file-notify-add-watch))
318
319(defalias 'tramp-androidsu-handle-file-notify-rm-watch
320 (tramp-androidsu-generate-wrapper #'tramp-handle-file-notify-rm-watch))
321
322(defalias 'tramp-androidsu-handle-file-notify-valid-p
323 (tramp-androidsu-generate-wrapper #'tramp-handle-file-notify-valid-p))
324
325(defalias 'tramp-androidsu-adb-handle-file-readable-p
326 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-readable-p)) 277 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-readable-p))
327 278
328(defalias 'tramp-androidsu-handle-file-regular-p 279(defalias 'tramp-androidsu-handle-file-system-info
329 (tramp-androidsu-generate-wrapper #'tramp-handle-file-regular-p))
330
331(defalias 'tramp-androidsu-handle-file-remote-p
332 (tramp-androidsu-generate-wrapper #'tramp-handle-file-remote-p))
333
334(defalias 'tramp-androidsu-handle-file-selinux-context
335 (tramp-androidsu-generate-wrapper #'tramp-handle-file-selinux-context))
336
337(defalias 'tramp-androidsu-handle-file-symlink-p
338 (tramp-androidsu-generate-wrapper #'tramp-handle-file-symlink-p))
339
340(defalias 'tramp-androidsu-adb-handle-file-system-info
341 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-system-info)) 280 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-system-info))
342 281
343(defalias 'tramp-androidsu-handle-file-truename 282(defalias 'tramp-androidsu-handle-file-writable-p
344 (tramp-androidsu-generate-wrapper #'tramp-handle-file-truename))
345
346(defalias 'tramp-androidsu-handle-file-user-uid
347 (tramp-androidsu-generate-wrapper #'tramp-handle-file-user-uid))
348
349(defalias 'tramp-androidsu-adb-handle-file-writable-p
350 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-writable-p)) 283 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-file-writable-p))
351 284
352(defalias 'tramp-androidsu-handle-find-backup-file-name 285(defalias 'tramp-androidsu-handle-make-directory
353 (tramp-androidsu-generate-wrapper #'tramp-handle-find-backup-file-name))
354
355(defalias 'tramp-androidsu-handle-insert-directory
356 (tramp-androidsu-generate-wrapper #'tramp-handle-insert-directory))
357
358(defalias 'tramp-androidsu-handle-insert-file-contents
359 (tramp-androidsu-generate-wrapper #'tramp-handle-insert-file-contents))
360
361(defalias 'tramp-androidsu-handle-list-system-processes
362 (tramp-androidsu-generate-wrapper #'tramp-handle-list-system-processes))
363
364(defalias 'tramp-androidsu-handle-load
365 (tramp-androidsu-generate-wrapper #'tramp-handle-load))
366
367(defalias 'tramp-androidsu-handle-lock-file
368 (tramp-androidsu-generate-wrapper #'tramp-handle-lock-file))
369
370(defalias 'tramp-androidsu-handle-make-auto-save-file-name
371 (tramp-androidsu-generate-wrapper #'tramp-handle-make-auto-save-file-name))
372
373(defalias 'tramp-androidsu-adb-handle-make-directory
374 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-make-directory)) 286 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-make-directory))
375 287
376(defalias 'tramp-androidsu-handle-make-lock-file-name 288(defun tramp-androidsu-handle-make-process (&rest args)
377 (tramp-androidsu-generate-wrapper #'tramp-handle-make-lock-file-name))
378
379(defalias 'tramp-androidsu-handle-make-nearby-temp-file
380 (tramp-androidsu-generate-wrapper #'tramp-handle-make-nearby-temp-file))
381
382(defun tramp-androidsu-make-process (&rest args)
383 "Like `tramp-handle-make-process', but modified for Android." 289 "Like `tramp-handle-make-process', but modified for Android."
384 (when args 290 (when args
385 (with-parsed-tramp-file-name (expand-file-name default-directory) nil 291 (with-parsed-tramp-file-name (expand-file-name default-directory) nil
@@ -493,150 +399,123 @@ FUNCTION."
493 (tramp-taint-remote-process-buffer stderr)) 399 (tramp-taint-remote-process-buffer stderr))
494 p))))) 400 p)))))
495 401
496(defalias 'tramp-androidsu-sh-handle-make-symbolic-link 402(defalias 'tramp-androidsu-handle-make-symbolic-link
497 (tramp-androidsu-generate-wrapper 403 (tramp-androidsu-generate-wrapper
498 #'tramp-sh-handle-make-symbolic-link)) 404 #'tramp-sh-handle-make-symbolic-link))
499 405
500(defalias 'tramp-androidsu-handle-memory-info 406(defalias 'tramp-androidsu-handle-process-file
501 (tramp-androidsu-generate-wrapper #'tramp-handle-memory-info))
502
503(defalias 'tramp-androidsu-handle-process-attributes
504 (tramp-androidsu-generate-wrapper #'tramp-handle-process-attributes))
505
506(defalias 'tramp-androidsu-adb-handle-process-file
507 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-process-file)) 407 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-process-file))
508 408
509(defalias 'tramp-androidsu-sh-handle-rename-file 409(defalias 'tramp-androidsu-handle-rename-file
510 (tramp-androidsu-generate-wrapper #'tramp-sh-handle-rename-file)) 410 (tramp-androidsu-generate-wrapper #'tramp-sh-handle-rename-file))
511 411
512(defalias 'tramp-androidsu-adb-handle-set-file-modes 412(defalias 'tramp-androidsu-handle-set-file-modes
513 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-set-file-modes)) 413 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-set-file-modes))
514 414
515(defalias 'tramp-androidsu-adb-handle-set-file-times 415(defalias 'tramp-androidsu-handle-set-file-times
516 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-set-file-times)) 416 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-set-file-times))
517 417
518(defalias 'tramp-androidsu-handle-set-visited-file-modtime 418(defalias 'tramp-androidsu-handle-get-remote-gid
519 (tramp-androidsu-generate-wrapper #'tramp-handle-set-visited-file-modtime))
520
521(defalias 'tramp-androidsu-handle-shell-command
522 (tramp-androidsu-generate-wrapper #'tramp-handle-shell-command))
523
524(defalias 'tramp-androidsu-handle-start-file-process
525 (tramp-androidsu-generate-wrapper #'tramp-handle-start-file-process))
526
527(defalias 'tramp-androidsu-handle-substitute-in-file-name
528 (tramp-androidsu-generate-wrapper #'tramp-handle-substitute-in-file-name))
529
530(defalias 'tramp-androidsu-handle-temporary-file-directory
531 (tramp-androidsu-generate-wrapper #'tramp-handle-temporary-file-directory))
532
533(defalias 'tramp-androidsu-adb-handle-get-remote-gid
534 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-get-remote-gid)) 419 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-get-remote-gid))
535 420
536(defalias 'tramp-androidsu-adb-handle-get-remote-groups 421(defalias 'tramp-androidsu-handle-get-remote-groups
537 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-get-remote-groups)) 422 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-get-remote-groups))
538 423
539(defalias 'tramp-androidsu-adb-handle-get-remote-uid 424(defalias 'tramp-androidsu-handle-get-remote-uid
540 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-get-remote-uid)) 425 (tramp-androidsu-generate-wrapper #'tramp-adb-handle-get-remote-uid))
541 426
542(defalias 'tramp-androidsu-handle-unlock-file 427(defalias 'tramp-androidsu-handle-write-region
543 (tramp-androidsu-generate-wrapper #'tramp-handle-unlock-file))
544
545(defalias 'tramp-androidsu-handle-verify-visited-file-modtime
546 (tramp-androidsu-generate-wrapper #'tramp-handle-verify-visited-file-modtime))
547
548(defalias 'tramp-androidsu-sh-handle-write-region
549 (tramp-androidsu-generate-wrapper #'tramp-sh-handle-write-region)) 428 (tramp-androidsu-generate-wrapper #'tramp-sh-handle-write-region))
550 429
551;;;###tramp-autoload 430;;;###tramp-autoload
552(defconst tramp-androidsu-file-name-handler-alist 431(defconst tramp-androidsu-file-name-handler-alist
553 '(;; `abbreviate-file-name' performed by default handler. 432 '(;; `abbreviate-file-name' performed by default handler.
554 (access-file . tramp-androidsu-handle-access-file) 433 (access-file . tramp-handle-access-file)
555 (add-name-to-file . tramp-androidsu-handle-add-name-to-file) 434 (add-name-to-file . tramp-handle-add-name-to-file)
556 ;; `byte-compiler-base-file-name' performed by default handler. 435 ;; `byte-compiler-base-file-name' performed by default handler.
557 (copy-directory . tramp-androidsu-handle-copy-directory) 436 (copy-directory . tramp-handle-copy-directory)
558 (copy-file . tramp-androidsu-sh-handle-copy-file) 437 (copy-file . tramp-androidsu-handle-copy-file)
559 (delete-directory . tramp-androidsu-adb-handle-delete-directory) 438 (delete-directory . tramp-androidsu-handle-delete-directory)
560 (delete-file . tramp-androidsu-adb-handle-delete-file) 439 (delete-file . tramp-androidsu-handle-delete-file)
561 ;; `diff-latest-backup-file' performed by default handler. 440 ;; `diff-latest-backup-file' performed by default handler.
562 (directory-file-name . tramp-androidsu-handle-directory-file-name) 441 (directory-file-name . tramp-handle-directory-file-name)
563 (directory-files . tramp-androidsu-handle-directory-files) 442 (directory-files . tramp-handle-directory-files)
564 (directory-files-and-attributes 443 (directory-files-and-attributes
565 . tramp-androidsu-adb-handle-directory-files-and-attributes) 444 . tramp-androidsu-handle-directory-files-and-attributes)
566 (dired-compress-file . ignore) 445 (dired-compress-file . ignore)
567 (dired-uncache . tramp-androidsu-handle-dired-uncache) 446 (dired-uncache . tramp-handle-dired-uncache)
568 (exec-path . tramp-androidsu-adb-handle-exec-path) 447 (exec-path . tramp-androidsu-handle-exec-path)
569 (expand-file-name . tramp-androidsu-handle-expand-file-name) 448 (expand-file-name . tramp-handle-expand-file-name)
570 (file-accessible-directory-p . tramp-androidsu-handle-file-accessible-directory-p) 449 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
571 (file-acl . ignore) 450 (file-acl . ignore)
572 (file-attributes . tramp-androidsu-adb-handle-file-attributes) 451 (file-attributes . tramp-androidsu-handle-file-attributes)
573 (file-directory-p . tramp-androidsu-handle-file-directory-p) 452 (file-directory-p . tramp-handle-file-directory-p)
574 (file-equal-p . tramp-androidsu-handle-file-equal-p) 453 (file-equal-p . tramp-handle-file-equal-p)
575 (file-executable-p . tramp-androidsu-adb-handle-file-executable-p) 454 (file-executable-p . tramp-androidsu-handle-file-executable-p)
576 (file-exists-p . tramp-androidsu-adb-handle-file-exists-p) 455 (file-exists-p . tramp-androidsu-handle-file-exists-p)
577 (file-group-gid . tramp-androidsu-handle-file-group-gid) 456 (file-group-gid . tramp-handle-file-group-gid)
578 (file-in-directory-p . tramp-androidsu-handle-file-in-directory-p) 457 (file-in-directory-p . tramp-handle-file-in-directory-p)
579 (file-local-copy . tramp-androidsu-sh-handle-file-local-copy) 458 (file-local-copy . tramp-androidsu-handle-file-local-copy)
580 (file-locked-p . tramp-androidsu-handle-file-locked-p) 459 (file-locked-p . tramp-handle-file-locked-p)
581 (file-modes . tramp-androidsu-handle-file-modes) 460 (file-modes . tramp-handle-file-modes)
582 (file-name-all-completions . tramp-androidsu-adb-handle-file-name-all-completions) 461 (file-name-all-completions . tramp-androidsu-handle-file-name-all-completions)
583 (file-name-as-directory . tramp-androidsu-handle-file-name-as-directory) 462 (file-name-as-directory . tramp-handle-file-name-as-directory)
584 (file-name-case-insensitive-p . tramp-androidsu-handle-file-name-case-insensitive-p) 463 (file-name-case-insensitive-p . tramp-handle-file-name-case-insensitive-p)
585 (file-name-completion . tramp-androidsu-handle-file-name-completion) 464 (file-name-completion . tramp-handle-file-name-completion)
586 (file-name-directory . tramp-androidsu-handle-file-name-directory) 465 (file-name-directory . tramp-handle-file-name-directory)
587 (file-name-nondirectory . tramp-androidsu-handle-file-name-nondirectory) 466 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
588 ;; `file-name-sans-versions' performed by default handler. 467 ;; `file-name-sans-versions' performed by default handler.
589 (file-newer-than-file-p . tramp-androidsu-handle-file-newer-than-file-p) 468 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
590 (file-notify-add-watch . tramp-androidsu-handle-file-notify-add-watch) 469 (file-notify-add-watch . tramp-handle-file-notify-add-watch)
591 (file-notify-rm-watch . tramp-androidsu-handle-file-notify-rm-watch) 470 (file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
592 (file-notify-valid-p . tramp-androidsu-handle-file-notify-valid-p) 471 (file-notify-valid-p . tramp-handle-file-notify-valid-p)
593 (file-ownership-preserved-p . ignore) 472 (file-ownership-preserved-p . ignore)
594 (file-readable-p . tramp-androidsu-adb-handle-file-readable-p) 473 (file-readable-p . tramp-androidsu-handle-file-readable-p)
595 (file-regular-p . tramp-androidsu-handle-file-regular-p) 474 (file-regular-p . tramp-handle-file-regular-p)
596 (file-remote-p . tramp-androidsu-handle-file-remote-p) 475 (file-remote-p . tramp-handle-file-remote-p)
597 (file-selinux-context . tramp-androidsu-handle-file-selinux-context) 476 (file-selinux-context . tramp-handle-file-selinux-context)
598 (file-symlink-p . tramp-androidsu-handle-file-symlink-p) 477 (file-symlink-p . tramp-handle-file-symlink-p)
599 (file-system-info . tramp-androidsu-adb-handle-file-system-info) 478 (file-system-info . tramp-androidsu-handle-file-system-info)
600 (file-truename . tramp-androidsu-handle-file-truename) 479 (file-truename . tramp-handle-file-truename)
601 (file-user-uid . tramp-androidsu-handle-file-user-uid) 480 (file-user-uid . tramp-handle-file-user-uid)
602 (file-writable-p . tramp-androidsu-adb-handle-file-writable-p) 481 (file-writable-p . tramp-androidsu-handle-file-writable-p)
603 (find-backup-file-name . tramp-androidsu-handle-find-backup-file-name) 482 (find-backup-file-name . tramp-handle-find-backup-file-name)
604 ;; `get-file-buffer' performed by default handler. 483 ;; `get-file-buffer' performed by default handler.
605 (insert-directory . tramp-androidsu-handle-insert-directory) 484 (insert-directory . tramp-handle-insert-directory)
606 (insert-file-contents . tramp-androidsu-handle-insert-file-contents) 485 (insert-file-contents . tramp-handle-insert-file-contents)
607 (list-system-processes . tramp-androidsu-handle-list-system-processes) 486 (list-system-processes . tramp-handle-list-system-processes)
608 (load . tramp-androidsu-handle-load) 487 (load . tramp-handle-load)
609 (lock-file . tramp-androidsu-handle-lock-file) 488 (lock-file . tramp-handle-lock-file)
610 (make-auto-save-file-name . tramp-androidsu-handle-make-auto-save-file-name) 489 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
611 (make-directory . tramp-androidsu-adb-handle-make-directory) 490 (make-directory . tramp-androidsu-handle-make-directory)
612 (make-directory-internal . ignore) 491 (make-directory-internal . ignore)
613 (make-lock-file-name . tramp-androidsu-handle-make-lock-file-name) 492 (make-lock-file-name . tramp-handle-make-lock-file-name)
614 (make-nearby-temp-file . tramp-androidsu-handle-make-nearby-temp-file) 493 (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
615 (make-process . tramp-androidsu-make-process) 494 (make-process . tramp-androidsu-handle-make-process)
616 (make-symbolic-link . tramp-androidsu-sh-handle-make-symbolic-link) 495 (make-symbolic-link . tramp-androidsu-handle-make-symbolic-link)
617 (memory-info . tramp-androidsu-handle-memory-info) 496 (memory-info . tramp-handle-memory-info)
618 (process-attributes . tramp-androidsu-handle-process-attributes) 497 (process-attributes . tramp-handle-process-attributes)
619 (process-file . tramp-androidsu-adb-handle-process-file) 498 (process-file . tramp-androidsu-handle-process-file)
620 (rename-file . tramp-androidsu-sh-handle-rename-file) 499 (rename-file . tramp-androidsu-handle-rename-file)
621 (set-file-acl . ignore) 500 (set-file-acl . ignore)
622 (set-file-modes . tramp-androidsu-adb-handle-set-file-modes) 501 (set-file-modes . tramp-androidsu-handle-set-file-modes)
623 (set-file-selinux-context . ignore) 502 (set-file-selinux-context . ignore)
624 (set-file-times . tramp-androidsu-adb-handle-set-file-times) 503 (set-file-times . tramp-androidsu-handle-set-file-times)
625 (set-visited-file-modtime . tramp-androidsu-handle-set-visited-file-modtime) 504 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
626 (shell-command . tramp-androidsu-handle-shell-command) 505 (shell-command . tramp-handle-shell-command)
627 (start-file-process . tramp-androidsu-handle-start-file-process) 506 (start-file-process . tramp-handle-start-file-process)
628 (substitute-in-file-name . tramp-androidsu-handle-substitute-in-file-name) 507 (substitute-in-file-name . tramp-handle-substitute-in-file-name)
629 (temporary-file-directory . tramp-androidsu-handle-temporary-file-directory) 508 (temporary-file-directory . tramp-handle-temporary-file-directory)
630 (tramp-get-home-directory . ignore) 509 (tramp-get-home-directory . ignore)
631 (tramp-get-remote-gid . tramp-androidsu-adb-handle-get-remote-gid) 510 (tramp-get-remote-gid . tramp-androidsu-handle-get-remote-gid)
632 (tramp-get-remote-groups . tramp-androidsu-adb-handle-get-remote-groups) 511 (tramp-get-remote-groups . tramp-androidsu-handle-get-remote-groups)
633 (tramp-get-remote-uid . tramp-androidsu-adb-handle-get-remote-uid) 512 (tramp-get-remote-uid . tramp-androidsu-handle-get-remote-uid)
634 (tramp-set-file-uid-gid . ignore) 513 (tramp-set-file-uid-gid . ignore)
635 (unhandled-file-name-directory . ignore) 514 (unhandled-file-name-directory . ignore)
636 (unlock-file . tramp-androidsu-handle-unlock-file) 515 (unlock-file . tramp-handle-unlock-file)
637 (vc-registered . ignore) 516 (vc-registered . ignore)
638 (verify-visited-file-modtime . tramp-androidsu-handle-verify-visited-file-modtime) 517 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
639 (write-region . tramp-androidsu-sh-handle-write-region)) 518 (write-region . tramp-androidsu-handle-write-region))
640 "Alist of TRAMP handler functions for superuser sessions on Android.") 519 "Alist of TRAMP handler functions for superuser sessions on Android.")
641 520
642;; It must be a `defsubst' in order to push the whole code into 521;; It must be a `defsubst' in order to push the whole code into
@@ -669,7 +548,7 @@ arguments to pass to the OPERATION."
669 548
670(with-eval-after-load 'shell 549(with-eval-after-load 'shell
671 (connection-local-set-profiles 550 (connection-local-set-profiles
672 `(:application tramp :protocol ,tramp-adb-method) 551 `(:application tramp :protocol ,tramp-androidsu-method)
673 'tramp-adb-connection-local-default-shell-profile 552 'tramp-adb-connection-local-default-shell-profile
674 'tramp-adb-connection-local-default-ps-profile)) 553 'tramp-adb-connection-local-default-ps-profile))
675 554