Subject: bug#79120: 30.1; Emacs android can't execute programs in /system/bin (127)

From: Theia <[email-masked]>
Date: Mon, 28 Jul 2025 13:16:15 -0700

With a fresh app install on Android 15+:
1. Launch emacs
2. M-x term, RET
3. Error is written in buffer *terminal*:

  Process terminal exited abnormally with code 127

When I first started using emacs on android I assumed this was normal
and immediately jumped to using emacs with termux. However, a number
of built-in packages (term, tramp, etc) assume that /system/bin/sh (or
other programs) are executable. I'm guessing this is some change in
security on Android's part, but it's unclear to me the exact issue.

I've tested this on my phone and in an emulator. I acquired the package
for this test from f-droid.

For what it is worth, /system/bin/sh can be called from termux on
Android 15+, so there must be some way to get it to work.

In GNU Emacs 30.1 (build 1, aarch64-unknown-linux-android22) of
 2025-02-27 built on bookworm
Repository revision: 8ac894e2246f25d2a2a97d866b10e6e0b0fede5a
Repository branch: HEAD
Windowing system distributor 'Google', version 35.0.0
System Description:
google/sdk_gphone64_x86_64/emu64xa:15/AE3A.240806.043/12960925:userdebug/dev-keys

Configured using:
 'configure --with-png=yes --with-webp=yes --with-gif=yes
 --with-jpeg=yes --with-xml2=yes --with-sqlite3=yes --with-gnutls=yes
 --with-tiff=yes --with-selinux=yes --with-modules=yes
 --with-tree-sitter=yes --with-imagemagick=no --with-lcms2=yes
 --with-mailutils= --with-pop=no-by-default --with-harfbuzz=yes
 --with-threads=yes --with-rsvg=yes --enable-check-lisp-object-type=
 'CFLAGS= -Werror=implicit-function-declaration''

Configured features:
GIF GMP GNUTLS HARFBUZZ JPEG LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP THREADS TIFF TREE_SITTER WEBP ZLIB

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
term disp-table shell pcomplete ehelp comint subr-x ansi-osc ansi-color
ring rmc iso-transl tooltip cus-start cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
android-win term/common-win touch-screen ls-lisp tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads inotify android multi-tty
move-toolbar make-network-process emacs)

Memory information:
((conses 16 52478 20929) (symbols 48 6261 0) (strings 32 15983 2245)
 (string-bytes 1 365002) (vectors 16 11628)
 (vector-slots 8 122476 10946) (floats 8 27 2) (intervals 56 803 23)
 (buffers 992 14))