Bug 498918 - Shell scripts in .config/plasma-workspace/env/ with `exit` in them cause all alphabetically subsequent scripts to not get executed
Summary: Shell scripts in .config/plasma-workspace/env/ with `exit` in them cause all ...
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: Startup process (show other bugs)
Version: 6.2.5
Platform: Neon Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-20 08:40 UTC by Nai Xia
Modified: 2025-01-24 06:11 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nai Xia 2025-01-20 08:40:07 UTC
After a recent update to plasma 6.2.5, 
not all scripts in $HOME/.config/plasma-workspace/env/  get executed
and I cannot find out why.
Comment 1 Nate Graham 2025-01-21 21:45:43 UTC
So some still work, and some don't? Can you see if you can figure out a pattern to explain the difference? Otherwise there's not much to go on here.
Comment 2 Nai Xia 2025-01-22 08:22:30 UTC
(In reply to Nate Graham from comment #1)
> So some still work, and some don't? Can you see if you can figure out a
> pattern to explain the difference? Otherwise there's not much to go on here.

OK. I am using X11,  I found that one of my bash scripts (headed with "#!/bin/bash") has an "exit" cmd.  The scripts alphabetically after that didn't get executed. So are there any restrictions for these scripts? I remember they all worked before the plasma update.
Comment 3 Nate Graham 2025-01-22 20:55:13 UTC
Interesting observation. Evidently something changed under the hood to make that `edit` cause some mischief.
Comment 4 Nai Xia 2025-01-23 06:21:25 UTC
I guess all these scripts are "source"d to keep the env variables. I can make a workaround without "exit".
But I still wish there is a way to let users to "./script.sh" for a more robust session start process.
My sugguesstion is that if the script.sh is headed with like "#!/bin/bash" then "./script.sh",
else "souce script.sh".
Comment 5 David Redondo 2025-01-23 07:43:05 UTC
If you need a more complex script, just use the normal autostart mechanism, it's a better fit  (desktop file in /etc/xdg/autostart). Or as a systemd service in that's Wanted-By plasma-workspace.target for example.

On the topic I dont see any recent changes  in how these scripts are run.

these are  https://invent.kde.org/plasma/plasma-workspace/-/blob/Plasma/6.2/startkde/startplasma.cpp?ref_type=heads#L139 and 
https://invent.kde.org/plasma/plasma-workspace/-/blob/Plasma/6.2/startkde/plasma-sourceenv.sh?ref_type=heads
Comment 6 Nai Xia 2025-01-24 06:11:27 UTC
(In reply to David Redondo from comment #5)
> If you need a more complex script, just use the normal autostart mechanism,
> it's a better fit  (desktop file in /etc/xdg/autostart). Or as a systemd
> service in that's Wanted-By plasma-workspace.target for example.
> 
> On the topic I dont see any recent changes  in how these scripts are run.
> 
> these are 
> https://invent.kde.org/plasma/plasma-workspace/-/blob/Plasma/6.2/startkde/
> startplasma.cpp?ref_type=heads#L139 and 
> https://invent.kde.org/plasma/plasma-workspace/-/blob/Plasma/6.2/startkde/
> plasma-sourceenv.sh?ref_type=heads

OK, I got it. Thanks for the reply.