From 94c5f3674a4c158295aa7bde9521b1caa78ef5a1 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Wed, 30 Jun 2021 03:48:09 +0500 Subject: [PATCH] Do not start login shell and load ~/.profile if starting a failsafe session This is done by not starting arg `0` with `-` Fixes #2150. --- .../src/main/java/com/termux/shared/shell/TermuxSession.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/termux-shared/src/main/java/com/termux/shared/shell/TermuxSession.java b/termux-shared/src/main/java/com/termux/shared/shell/TermuxSession.java index e67ab9fd..b1a071d8 100644 --- a/termux-shared/src/main/java/com/termux/shared/shell/TermuxSession.java +++ b/termux-shared/src/main/java/com/termux/shared/shell/TermuxSession.java @@ -91,9 +91,12 @@ public class TermuxSession { if (executionCommand.executable == null) { // Fall back to system shell as last resort: + // Do not start a login shell since $HOME/.profile, etc may cause startup failure if they are not valid executionCommand.executable = "/system/bin/sh"; + } else { + isLoginShell = true; } - isLoginShell = true; + } String[] processArgs = shellEnvironmentClient.setupProcessArgs(executionCommand.executable, executionCommand.arguments);