termux-play-store / termux-issues

Issues for the Play Store build of Termux
5 stars 24 forks source link

[Bug]: default $PATH contains an inaccssible directory /system_ext/bin #178

Open mgedmin opened 3 weeks ago

mgedmin commented 3 weeks ago

Problem description

The default value of $PATH in my Termux shell is

$ echo $PATH | tr : '\n'
/usr/games
/usr/local/sbin
/usr/local/bin
/usr/sbin
/sbin
/data/data/com.termux/files/usr/bin
/product/bin
/apex/com.android.runtime/bin
/apex/com.android.art/bin
/system_ext/bin
/system/bin
/system/xbin
/odm/bin
/vendor/bin
/vendor/xbin

One of these things is not like the others:

$ ls -l /system_ext/bin
ls: cannot open directory '/system_ext/bin': Permission denied

$ ls -ld /system_ext/bin
drwxr-x--x. 3 root shell 4096 Jan  1  2009 /system_ext/bin

which causes programs that loop through all $PATH entries (e.g. https://github.com/pypa/virtualenv/issues/2794).

Actually, three more of those directories are inaccessible:

$ ls /system/xbin /odm/bin /vendor/bin /vendor/xbin
ls: cannot access '/system/xbin': No such file or directory
ls: cannot access '/vendor/xbin': No such file or directory
/odm/bin

ls: cannot open directory '/vendor/bin': Permission denied

What steps will reproduce the bug?

Install Termux from the Google Play Store, launch it, look at $PATH.

What is the expected behavior?

PATH contains only directories that the Termux user (u0_a368, although I wonder if this varies per device) can actually access.

System information

Termux Variables:
TERMUX_EXEC__PROC_SELF_EXE=/data/data/com.termux/files/usr/bin/termux-info
TERMUX_VERSION=googleplay.2024.10.30
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.net stable main
Updatable packages:
All packages up to date
termux-tools version:
3.0.8
Android version:
14
Kernel build information:
Linux localhost 5.15.137-android14-11-gbc062a78e195-ab12057991 #1 SMP PREEMPT Mon Jul 8 12:34:46 UTC 2024 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
a404050aaa commented 3 weeks ago

Problem description

The default value of $PATH in my Termux shell is

$ echo $PATH | tr : '\n'
/usr/games
/usr/local/sbin
/usr/local/bin
/usr/sbin
/sbin
/data/data/com.termux/files/usr/bin
/product/bin
/apex/com.android.runtime/bin
/apex/com.android.art/bin
/system_ext/bin
/system/bin
/system/xbin
/odm/bin
/vendor/bin
/vendor/xbin

One of these things is not like the others:

$ ls -l /system_ext/bin
ls: cannot open directory '/system_ext/bin': Permission denied

$ ls -ld /system_ext/bin
drwxr-x--x. 3 root shell 4096 Jan  1  2009 /system_ext/bin

which causes programs that loop through all $PATH entries (e.g. pypa/virtualenv#2794).

Actually, three more of those directories are inaccessible:

$ ls /system/xbin /odm/bin /vendor/bin /vendor/xbin
ls: cannot access '/system/xbin': No such file or directory
ls: cannot access '/vendor/xbin': No such file or directory
/odm/bin

ls: cannot open directory '/vendor/bin': Permission denied

What steps will reproduce the bug?

Install Termux from the Google Play Store, launch it, look at $PATH.

What is the expected behavior?

PATH contains only directories that the Termux user (u0_a368, although I wonder if this varies per device) can actually access.

System information

Termux Variables:
TERMUX_EXEC__PROC_SELF_EXE=/data/data/com.termux/files/usr/bin/termux-info
TERMUX_VERSION=googleplay.2024.10.30
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.net stable main
Updatable packages:
All packages up to date
termux-tools version:
3.0.8
Android version:
14
Kernel build information:
Linux localhost 5.15.137-android14-11-gbc062a78e195-ab12057991 #1 SMP PREEMPT Mon Jul 8 12:34:46 UTC 2024 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so