Update Android port

* lisp/net/tramp.el (tramp-encoding-shell):
* lisp/obsolete/terminal.el (terminal-emulator):
* lisp/term.el (term-exec-1):
* lisp/textmodes/artist.el (artist-figlet-get-font-list):
* src/android.c (JNICALL): Where /bin/sh was previously used,
use /system/bin/sh on Android.
This commit is contained in:
Po Lu 2023-06-11 17:58:47 +08:00
parent 24f25fc2f8
commit aad78abfd2
5 changed files with 22 additions and 4 deletions

View file

@ -148,7 +148,12 @@ This setting has precedence over `auto-save-file-name-transforms'."
;; Suppress `shell-file-name' for w32 systems.
(defcustom tramp-encoding-shell
(let (shell-file-name)
(or (tramp-compat-funcall 'w32-shell-name) "/bin/sh"))
(or (tramp-compat-funcall 'w32-shell-name)
(if (eq system-type 'android)
;; The shell is located at /system/bin/sh on Android
;; systems.
"/system/bin/sh"
"/bin/sh")))
"Use this program for encoding and decoding commands on the local host.
This shell is used to execute the encoding and decoding command on the
local host, so if you want to use \"~\" in those commands, you should

View file

@ -1095,7 +1095,9 @@ subprocess started."
(or explicit-shell-file-name
(getenv "ESHELL")
(getenv "SHELL")
"/bin/sh"))
(if (eq system-type 'android)
"/system/bin/sh"
"/bin/sh")))
(s (read-string
(format "Run program in emulator (default %s): "
default-s))))

View file

@ -1726,7 +1726,12 @@ Nil if unknown.")
(push (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
process-environment))
(apply #'start-process name buffer
"/bin/sh" "-c"
;; On Android, /bin doesn't exist, and the default shell is
;; found as /system/bin/sh.
(if (eq system-type 'android)
"/system/bin/sh"
"/bin/sh")
"-c"
(format "stty -nl echo rows %d columns %d sane 2>%s;\
if [ $1 = .. ]; then shift; fi; exec \"$@\""
term-height term-width null-device)

View file

@ -2800,7 +2800,9 @@ EXTRA-ARGS for figlet, for the command line, may be specified."
(defun artist-figlet-get-font-list ()
"Read fonts in with the shell command.
Returns a list of strings."
(let* ((cmd-interpreter "/bin/sh")
(let* ((cmd-interpreter (if (eq system-type 'android)
"/system/bin/sh"
"/bin/sh"))
(ls-cmd artist-figlet-list-fonts-command)
(result (artist-system cmd-interpreter ls-cmd nil))
(exit-code (elt result 0))

View file

@ -2518,6 +2518,10 @@ NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv,
/* Set TMPDIR to the temporary files directory. */
setenv ("TMPDIR", android_cache_dir, 1);
/* And finally set "SHELL" to /system/bin/sh. Otherwise, some
programs will look for /bin/sh, which is problematic. */
setenv ("SHELL", "/system/bin/sh", 1);
/* Set the cwd to that directory as well. */
if (chdir (android_files_dir))
__android_log_print (ANDROID_LOG_WARN, __func__,