D29780: Detach sensor shell agent from terminal

Jiří Paleček noreply at phabricator.kde.org
Fri May 15 16:45:30 BST 2020


jpalecek created this revision.
jpalecek added reviewers: Plasma, davidedmundson.
Herald added a project: Plasma.
jpalecek requested review of this revision.

REVISION 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.

REPOSITORY
  R111 KSysguard Library

BRANCH
  Plasma/5.18

REVISION DETAIL
  https://phabricator.kde.org/D29780

AFFECTED FILES
  ksgrd/SensorShellAgent.cpp

To: jpalecek, #plasma, davidedmundson
Cc: plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, ragreen, ZrenBot, ngraham, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200515/e23354af/attachment.htm>


More information about the Plasma-devel mailing list