diff options
| author | Michael Albinus | 2022-08-15 19:35:43 +0200 |
|---|---|---|
| committer | Michael Albinus | 2022-08-15 19:35:43 +0200 |
| commit | 9ea40b3ddfba1104d02ff61e3d20482287d3caca (patch) | |
| tree | 5c8ff2fb137096c1e4668a3be9ae92651e3aa5de | |
| parent | d5e74d9cd7fd657f13ef7ac72cf84c3bc3a03ba9 (diff) | |
| download | emacs-9ea40b3ddfba1104d02ff61e3d20482287d3caca.tar.gz emacs-9ea40b3ddfba1104d02ff61e3d20482287d3caca.zip | |
Fix tmpdir handling in Tramp for Android sshd
* doc/misc/tramp.texi (Android shell setup): Rework.
* lisp/net/tramp.el (tramp-get-remote-tmpdir): Cache result in
temporary connection property.
| -rw-r--r-- | doc/misc/tramp.texi | 39 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 2 |
2 files changed, 33 insertions, 8 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 924aa66d444..96ffb5c8809 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -2975,14 +2975,31 @@ where @samp{192.168.0.26} is the Android device's IP address. | |||
| 2975 | (@pxref{Predefined connection information}). | 2975 | (@pxref{Predefined connection information}). |
| 2976 | 2976 | ||
| 2977 | @item | 2977 | @item |
| 2978 | @value{tramp} requires preserving @env{PATH} environment variable from | 2978 | On the Android device the directory names are prefixed with an |
| 2979 | user settings. Android devices prefer @file{/system/xbin} path over | 2979 | application specific prefix, which is |
| 2980 | @file{/system/bin}. Both of these are set as follows: | 2980 | @file{/data/data/com.termux/files/usr/bin} instead of @file{/usr/bin} |
| 2981 | in the @code{Termux} case. You must adapt the file names in | ||
| 2982 | @code{tramp-remote-path}, for example via connection-local | ||
| 2983 | @ifinfo | ||
| 2984 | settings (@pxref{Connection Variables, , , emacs}): | ||
| 2985 | @end ifinfo | ||
| 2986 | @ifnotinfo | ||
| 2987 | settings: | ||
| 2988 | @end ifnotinfo | ||
| 2981 | 2989 | ||
| 2982 | @lisp | 2990 | @lisp |
| 2983 | @group | 2991 | @group |
| 2984 | (add-to-list 'tramp-remote-path 'tramp-own-remote-path) | 2992 | (connection-local-set-profile-variables |
| 2985 | (add-to-list 'tramp-remote-path "/system/xbin") | 2993 | 'tramp-connection-local-termux-profile |
| 2994 | `((tramp-remote-path | ||
| 2995 | . ,(mapcar | ||
| 2996 | (lambda (x) | ||
| 2997 | (if (stringp x) (concat "/data/data/com.termux/files" x) x)) | ||
| 2998 | (copy-tree tramp-remote-path))))) | ||
| 2999 | |||
| 3000 | (connection-local-set-profiles | ||
| 3001 | '(:application tramp :machine "192.168.0.26") | ||
| 3002 | 'tramp-connection-local-termux-profile) | ||
| 2986 | @end group | 3003 | @end group |
| 2987 | @end lisp | 3004 | @end lisp |
| 2988 | 3005 | ||
| @@ -2991,7 +3008,9 @@ When the Android device is not @samp{rooted}, specify a writable | |||
| 2991 | directory for temporary files: | 3008 | directory for temporary files: |
| 2992 | 3009 | ||
| 2993 | @lisp | 3010 | @lisp |
| 2994 | (add-to-list 'tramp-remote-process-environment "TMPDIR=$HOME") | 3011 | (add-to-list 'tramp-connection-properties |
| 3012 | (list (regexp-quote "192.168.0.26") | ||
| 3013 | "tmpdir" "/data/data/com.termux/files/home/tmp")) | ||
| 2995 | @end lisp | 3014 | @end lisp |
| 2996 | 3015 | ||
| 2997 | @item | 3016 | @item |
| @@ -3019,11 +3038,17 @@ the previous example, fix the connection properties as follows: | |||
| 3019 | @group | 3038 | @group |
| 3020 | (add-to-list 'tramp-connection-properties | 3039 | (add-to-list 'tramp-connection-properties |
| 3021 | (list (regexp-quote "android") "remote-shell" "sh")) | 3040 | (list (regexp-quote "android") "remote-shell" "sh")) |
| 3041 | (add-to-list 'tramp-connection-properties | ||
| 3042 | (list (regexp-quote "android") | ||
| 3043 | "tmpdir" "/data/data/com.termux/files/home/tmp")) | ||
| 3044 | (connection-local-set-profiles | ||
| 3045 | '(:application tramp :machine "android") | ||
| 3046 | 'tramp-connection-local-termux-profile) | ||
| 3022 | @end group | 3047 | @end group |
| 3023 | @end lisp | 3048 | @end lisp |
| 3024 | 3049 | ||
| 3025 | @noindent | 3050 | @noindent |
| 3026 | Open a remote connection with a more concise command @kbd{C-x C-f | 3051 | Open a remote connection with the more concise command @kbd{C-x C-f |
| 3027 | @trampfn{ssh,android,} @key{RET}}. | 3052 | @trampfn{ssh,android,} @key{RET}}. |
| 3028 | @end itemize | 3053 | @end itemize |
| 3029 | 3054 | ||
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 4cc4ee0722e..5ffc4f1b88b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -6011,7 +6011,7 @@ This handles also chrooted environments, which are not regarded as local." | |||
| 6011 | 6011 | ||
| 6012 | (defun tramp-get-remote-tmpdir (vec) | 6012 | (defun tramp-get-remote-tmpdir (vec) |
| 6013 | "Return directory for temporary files on the remote host identified by VEC." | 6013 | "Return directory for temporary files on the remote host identified by VEC." |
| 6014 | (with-tramp-connection-property vec "tmpdir" | 6014 | (with-tramp-connection-property (tramp-get-process vec) "remote-tmpdir" |
| 6015 | (let ((dir | 6015 | (let ((dir |
| 6016 | (tramp-make-tramp-file-name | 6016 | (tramp-make-tramp-file-name |
| 6017 | vec (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp")))) | 6017 | vec (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp")))) |