Detach sensor shell agent from terminal
Needs ReviewPublic

Authored by jpalecek on Fri, May 15, 3:45 PM.

Details

Reviewers
davidedmundson
Group Reviewers
Plasma
Summary

When I run ksysgruard from a terminal, I found out it doesn't
connect to remote hosts' sensors (tried with localhost, but anyway)
and messes up the terminal (which doesn't show the input
afterwards). This is caused by ssh, which ksysguard uses to connect to
remote host, asking for the password on the terminal. This is super
annoying, because you don't normally expect a GUI application like
ksysguard to ask for anything on the terminal, and also because the
mess up later.

The reason is that nothing changes the controlling terminal when
ksysguard runs ssh, so it inherits the parent's terminal. SSH
normally uses the terminal to get password if it has one. However, it
will use SSH_ASKPASS if it doesn't, which is what we want.

This patch fixes it by running whatever is ran by SensorShellAgent
with setsid, which is an executable from the util-linux package. I've
considered the following alternatives and found this one to be the
simplest:

  1. Use QProcess::startDetached. Detaches from the terminal, but has the drawback that this method doesn't allow to interact with input/output or wait for completion, which is what we want.
  2. Use KPtyProcess: Not possible since while this detaches the ssh process from the parent's terminal, it creates a new one which would cause ssh to ask for password on that terminal. We would have to add code to relay interaction on the terminal to the user.
  3. Create our own wrapper executable. That would have the advantage that it works on other systems than linux, eg. freebsd.
Test Plan
  1. Run ksysguard from konsole
  2. Inspect sensors on another host that you need a password to log on
  3. The prompt for a password should show up as a X dialog.

Diff Detail

Repository
R111 KSysguard Library
Branch
Plasma/5.18
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 26959
Build 26977: arc lint + arc unit
jpalecek created this revision.Fri, May 15, 3:45 PM
Restricted Application added a project: Plasma. ยท View Herald TranscriptFri, May 15, 3:45 PM
jpalecek requested review of this revision.Fri, May 15, 3:45 PM