Bug 355985

Summary: user scrripts nolonger run correctly
Product: [Plasma] plasmashell Reporter: Treeve Jelbert <treeve>
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED NOT A BUG    
Severity: normal CC: bshah, plasma-bugs-null
Priority: NOR    
Version First Reported In: master   
Target Milestone: 1.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Treeve Jelbert 2015-11-27 11:04:06 UTC
I have a si,mple script which should be run when starting a plasma session. It used to work but not now.

#!/bin/bash
killall ssh-agent
eval `/usr/bin/ssh-agent -s`


When this script is run manually it exports two variables
$ env |grep SSH
SSH_AGENT_PID=8661
SSH_AUTH_SOCK=/tmp/ssh-AmjFwSlh7nT3/agent.8660

When run by plasma, the variables are lost, which means that ssh-add fails
 
 $ ssh-add
Could not open a connection to your authentication agent

Reproducible: Always
Comment 1 David Edmundson 2015-11-29 15:16:12 UTC
What version of plasma?
Comment 2 Treeve Jelbert 2015-11-29 15:31:38 UTC
Plasma/5.5
Comment 3 David Edmundson 2015-11-29 15:37:03 UTC
ok. Verify the script is being run at all
touch /tmp/something

also startkde is just a shell script, so maybe you can add some hooks in there and investigate?
Comment 4 Treeve Jelbert 2015-11-29 15:46:36 UTC
from konsole in kde5:

$ env|grep SSH

nothing shown

$ ps -A |grep ssh
 3147 ?        00:00:00 sshd
24688 ?        00:00:00 ssh-agent

so the script has been started

If I then do 
$ source ~/bin/sshagent.sh
Agent pid 5215
$ env|grep SSH
SSH_AGENT_PID=5215
SSH_AUTH_SOCK=/tmp/ssh-E2xOT4JQz8e8/agent.5214
Comment 5 David Edmundson 2015-11-29 21:28:21 UTC
Please can you add an echo $SSH_AGENT_PID > /tmp/somefile into /usr/bin/startkde just after line 211 where it sources the files.
Comment 6 Treeve Jelbert 2015-11-30 09:49:48 UTC
I moved the scripts from ~/.config/autostart to .config/plaswm-workspace/env

It now works correctly
Comment 7 David Edmundson 2015-11-30 09:56:20 UTC
Ah, yes.

anything in "pre-startup" are run in a blocking way that sources any env changes
anything in "startup" are forked into the background by ksmserver (and therefore env changes dont' sync)

It's been like that since 4.x. AFAIK.

but I guess it's not super clear in the docs.