RemoteLinux: Hard-code /bin/sh for use in Open Terminal

... when changes to the environment are requested.

Ideally, that should be the user's chosen shell on the device,
but ssh does not support the case of specifying shell variables
without also giving an executable.

Short of playing tricks with /etc/passwd, getent, or env, use
/bin/sh which is guaranteed to exist.

Change-Id: I8d4b87f2a94eb9614d85dcacebd539ac645dc33d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-12-16 11:02:09 +01:00
parent 223bec26a1
commit 674aad728e

View File

@@ -976,7 +976,11 @@ LinuxDevice::LinuxDevice()
d->m_terminals.removeOne(proc);
});
proc->setCommand({filePath({}), {}});
// Empty command for ssh implies the user's shell, which would be nice in general,
// but we can't use that if we modify environment settings, as variables without
// command don't work on the ssh commandline.
const QString shell = env.toDictionary().size() == 0 ? QString() : QString("/bin/sh");
proc->setCommand({filePath(shell), {}});
proc->setTerminalMode(TerminalMode::On);
proc->setEnvironment(env);
proc->setWorkingDirectory(workingDir);