mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-07 03:05:18 +08:00
Do not have /system/bin in the PATH
By appending the old system PATH environment variable to the paths setup by Termux system binaries are found as a fallback. This causes problems with system binaries not working (due to LD_LIBRARY_PATH) and causing a lot of confusion for new users when e.g. an Android system provides a system version of e.g. curl, ssh and other programs. It's better for these users to be prompted to install the proper Termux package, and advanced users can still add /system/bin to the PATH themselves. Certain programs such as 'am' and 'pm' are already setup in $PREFIX/bin to clear LD_LIBRARY_PATH and launch the binaries in /system/bin - if there are some more popular ones they could be added in the same way.
This commit is contained in:
@@ -243,13 +243,14 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
||||
final String androidDataEnv = "ANDROID_DATA=" + System.getenv("ANDROID_DATA");
|
||||
String[] env;
|
||||
if (failSafe) {
|
||||
// Keep the default path so that system binaries can be used in the failsafe session.
|
||||
final String pathEnv = "PATH=" + System.getenv("PATH");
|
||||
env = new String[] { termEnv, homeEnv, prefixEnv, androidRootEnv, androidDataEnv, pathEnv };
|
||||
} else {
|
||||
final String ps1Env = "PS1=$ ";
|
||||
final String ldEnv = "LD_LIBRARY_PATH=" + PREFIX_PATH + "/lib";
|
||||
final String langEnv = "LANG=en_US.UTF-8";
|
||||
final String pathEnv = "PATH=" + PREFIX_PATH + "/bin:" + PREFIX_PATH + "/bin/applets:" + System.getenv("PATH");
|
||||
final String pathEnv = "PATH=" + PREFIX_PATH + "/bin:" + PREFIX_PATH + "/bin/applets";
|
||||
final String pwdEnv = "PWD=" + cwd;
|
||||
|
||||
env = new String[] { termEnv, homeEnv, prefixEnv, ps1Env, ldEnv, langEnv, pathEnv, pwdEnv, androidRootEnv, androidDataEnv };
|
||||
|
Reference in New Issue
Block a user