Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 688366 - [kde overlay] >=kde-plasma/plasma-workspace-5.16.80: Restore Gentoo FHS script support
Summary: [kde overlay] >=kde-plasma/plasma-workspace-5.16.80: Restore Gentoo FHS scrip...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords: NeedPatch
: 695892 (view as bug list)
Depends on:
Blocks: 698132
  Show dependency tree
 
Reported: 2019-06-19 19:03 UTC by Eugene Shalygin
Modified: 2019-12-22 20:37 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
migrate-agent-scripts-to-new-layout.patch (migrate-agent-scripts-to-new-layout.patch,2.64 KB, patch)
2019-11-12 01:49 UTC, Maciej Mrozowski
Details | Diff
migrate-agent-scripts-to-new-layout.patch (migrate-agent-scripts-to-new-layout.patch,2.71 KB, patch)
2019-11-12 18:30 UTC, Maciej Mrozowski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Shalygin 2019-06-19 19:03:43 UTC
* Applying plasma-workspace-5.14.80-startkde-script.patch ...
The text leading up to this was:
--------------------------
|From bf569560bf195ac4e79d65d4103a7161a6a2f2ac Mon Sep 17 00:00:00 2001
|From: Elias Probst <mail@eliasprobst.eu>
|Date: Sat, 4 Jul 2015 11:33:01 +0200
|Subject: [PATCH] [startkde] Gentoo FHS script support
|
|---
| startkde/startkde.cmake | 10 ++++++++++
| 1 file changed, 10 insertions(+)
|
|diff --git a/startkde/startkde.cmake b/startkde/startkde.cmake
|index 2585600..9350158 100644
|--- a/startkde/startkde.cmake
|+++ b/startkde/startkde.cmake
--------------------------
No file to patch.  Skipping patch.
2 out of 2 hunks ignored
Comment 1 Andreas Sturmlechner gentoo-dev 2019-06-20 10:23:29 UTC
Elias, are you up to speed with how this patch should be changed after the recent upstream changes?
Comment 2 Elias Probst 2019-06-20 14:18:43 UTC
Sorry, I'm out of the loop wrt Gentoo/KDE since more than a year - can't really help here.
Comment 3 Duncan 2019-06-23 05:05:50 UTC
I was about to file a bug on this myself.
Comment 4 Duncan 2019-06-23 05:14:48 UTC
(In reply to Andreas Sturmlechner from comment #1)
> Elias, are you up to speed with how this patch should be changed after the
> recent upstream changes?

Not Elias and I'm definitely more comfortable in shell than C++, but...

You're referring to upstream commit 33ff53ca2 (and followups), where they're replacing the startkde shell-script startup with a native-compiled executable, leaving us no shell-script to patch, correct?

ATM I'm following sourceFile() in the cpp files and the plasma-sourceenv.sh helper-script.  That seems to be the functionality we need, as ported across.  (I traced it in the initial commit and am working on the followup commits that refactor things now.)
Comment 5 Duncan 2019-06-23 06:56:10 UTC
(In reply to Duncan from comment #4)
> 
> ATM I'm following sourceFile() in the cpp files and the plasma-sourceenv.sh
> helper-script.  That seems to be the functionality we need, as ported
> across.  (I traced it in the initial commit and am working on the followup
> commits that refactor things now.)

[Pardon me if I'm way too detailed for my audience here, but if it saves the implementer even part of the several hours I spent looking into it...]

OK, as of 71a03a0b7 (current HEAD), ...

Looks like the code we're after is in startkde/startplasma.cpp, which is included in the final binaries that start both x11 and wayland.

As mentioned above, the core functionality we need is sourceFile(), which calls plasma-sourceenv.sh as a helper-script.

The caller we're interested in is runEnvironmentScripts() which has no parameters  and (sort-of) of hard-coding the config directories it sources from.  It is in turn called from main() in both startplasma-x11.cpp and startplasma-wayland.cpp.


Since runEnvironmentScripts() hard-codes its directory (well, sort-of, it gets it from the config) we can't use it directly, but we can use it as a pattern for our own code to call sourceFile().

I'd probably create a single runEnvironmentScriptsGentoo() in startplasma.cpp that takes a parameter pointing at the appropriate dir, and add one-line calls to it from startplasma-x11.cpp and startplasma-wayland.cpp (so they're directly mirroring the startup calls to the the original runEnvironmentScript() in those two files, tho of course that means adding the gentoo-suffixed function to the header as well.

It appears there's no native shutdown functionality (at this level anyway) to parallel, so as with the old patch we'll be adding our own shutdown-script calls to both startplasma-wayland.cpp and startplasma-x11.cpp, probably right before the cleanupPlasmaEnvironment() call in each, as that's most directly parallel to the old scripts placement.  Again, call runEnvironmentScriptsGentoo() in startplasma.cpp with a single passed parameter, making the call to it in the separate x11 and wayland files a single line.

Better yet, ask upstream to make runEnvironmentScript take a directory parameter so we don't have to reimplement it, and all we'd have to do would be add the four single-line calls to it, one each for startup and shutdown, in each of the x11 and wayland cpp files.  That way we'd get future code updates to it without having to mirror them to our own patch as well.  =:^)  (Tho that'll probably take some time to get approved, and the approach above can be taken until the directory-parametered version is upstreamed.)
Comment 6 Duncan 2019-06-23 10:27:33 UTC
Another note, for anyone else just trying to get live-git plasma-workspace-9999 updating and building again, with or without the gentoo customization added by that patch, lest some other bug trigger and get hard to trace due to too long between updates on the live build.

Since I don't use the functionality at issue (nothing but the gentoo-default agent scripts in the dirs in question and I don't use them), I decided to simply try killing the patch[1].

That wasn't enough.  I had to kill the one for wayland too, since that script is replaced by a native executable too.

But that wasn't enough either.  There's a sed call in src_prepare that fails due to missing those same two scripts now.

Fortunately it's a four-line sed script killing the four lines in the ebuild, so it's easy enough to continue applying to further updates and/or to kill when this bug is fixed.

Anyway, that got plasma-workspace building again and it installed fine, but then X would start but quit after a few seconds without starting kde/plasma.

~/.xsessionerrors revealed the problem.  My (custom) /etc/X11/Xsessions was failing, as it had "exec startkde", and the new setup replaces the old startkde script with a native startplasma-x11 executable.  After replacing that with "exec startplasma-x11", I could start kde from my terminal login once again.

So while that post-install problem isn't gentoo's, there's more to fixing the ebuild than killing or updating that first patch.  It's two patches and removal of that sed.  Plus potentially updating the kde/plasma session launch scripts if they call startkde to call startplasma-x11 instead now. I'm not sure on the last because as I said I have a custom script, which /did/ need updated.

---
[1] I've an update script that applies ebuild patches or seds automatically, much as portage does with /etc/portage/patches, so once I figure out what I want to change in the ebuild, it's trivial to add a patch or sed script to the appropriate dir so it gets auto-applied after that.
Comment 7 Andreas Sturmlechner gentoo-dev 2019-07-02 13:53:56 UTC
Is there any specific reason why we can't simply use these?

$HOME/.config/autostart
$HOME/.config/plasma-workspace/shutdown
Comment 8 Duncan 2019-07-03 11:56:23 UTC
(In reply to Andreas Sturmlechner from comment #7)
> Is there any specific reason why we can't simply use these?
> 
> $HOME/.config/autostart
> $HOME/.config/plasma-workspace/shutdown

Those are individual user dirs, not the system-wide locations that package-management can legitimately touch.

Which was if I'm reading the comment in the patch correctly, the point of the patch.  There are system-parallel XDG locations matching the user locations, but the startup/shutdown scripts weren't looking in them, only the user locations.

Of course we should try upstreaming the patch as well once we've come up with the new version, thus getting rid of our maintenance headaches by upstreaming them, but we gotta create a patch, first.
Comment 9 jospezial 2019-07-03 22:32:52 UTC
(In reply to Duncan from comment #3)
> I was about to file a bug on this myself.

confirming
Comment 10 jospezial 2019-07-03 23:25:38 UTC
If I disable that patch it fails to apply plasma-workspace-5.10-startplasmacompositor-script.patch.

If I disable that, then sed fails:

>>> Preparing source in /var/tmp/portage/kde-plasma/plasma-workspace-9999/work/plasma-workspace-9999 ...
 * Applying plasma-workspace-5.14.2-split-libkworkspace.patch ...                                                                                                     [ ok ]
sed: can't read startkde/startkde.cmake: No such file or directory
sed: can't read startkde/startplasmacompositor.cmake: No such file or directory
Comment 11 Andreas Sturmlechner gentoo-dev 2019-07-04 17:33:24 UTC
We are aware of that already.
Comment 12 Larry the Git Cow gentoo-dev 2019-07-16 18:37:13 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/kde.git/commit/?id=3f668bb654c817ec2b40cca7c2426c579d336bd8

commit 3f668bb654c817ec2b40cca7c2426c579d336bd8
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-07-16 18:36:48 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-07-16 18:36:48 +0000

    kde-plasma/plasma-workspace: Drop broken patches for now
    
    Bug: https://bugs.gentoo.org/688366
    Package-Manager: Portage-2.3.69, Repoman-2.3.16
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 kde-plasma/plasma-workspace/plasma-workspace-9999.ebuild | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
Comment 13 Andreas Sturmlechner gentoo-dev 2019-09-30 12:44:54 UTC
*** Bug 695892 has been marked as a duplicate of this bug. ***
Comment 14 tk+gentoo 2019-09-30 12:54:33 UTC
According to this[1] kde-bug I falsely opened, /etc/xdg/plasma-workspace/env/*.sh is sourced at plasma startup and might be a good replacement for this patch.

[1] https://bugs.kde.org/show_bug.cgi?id=412468
Comment 15 Andreas Sturmlechner gentoo-dev 2019-10-15 21:55:08 UTC
@kensington, did you have some time to look into this?
Comment 16 Andreas Sturmlechner gentoo-dev 2019-10-15 23:03:09 UTC
(In reply to Duncan from comment #8)
> Which was if I'm reading the comment in the patch correctly, the point of
> the patch.  There are system-parallel XDG locations matching the user
> locations, but the startup/shutdown scripts weren't looking in them, only
> the user locations.

The only package in Gentoo ebuild repo doing this is kde-plasma/ksshaskpass, but it is only using the startup dir - which presumably would be covered by /etc/xdg/plasma-workspace/env/ - although it is not clear if even that is necessary at this point.
Comment 17 Nils Freydank 2019-10-17 07:52:22 UTC
(In reply to Andreas Sturmlechner from comment #16)
> [...] which presumably would be covered by
> /etc/xdg/plasma-workspace/env/ - although it is not clear if even that is
> necessary at this point.

Creating the directory /etc/xdg/plasma-workspace/env/ and symlink’ing the startup files from /etc/plasma/startup works, i.e. the pre-5.17 behavior is enabled again.

Do you have another way in your mind?
Comment 18 George L. Emigh 2019-10-18 22:45:51 UTC
(In reply to Nils Freydank from comment #17)
> (In reply to Andreas Sturmlechner from comment #16)
> > [...] which presumably would be covered by
> > /etc/xdg/plasma-workspace/env/ - although it is not clear if even that is
> > necessary at this point.
> 
> Creating the directory /etc/xdg/plasma-workspace/env/ and symlink’ing the
> startup files from /etc/plasma/startup works, i.e. the pre-5.17 behavior is
> enabled again.
> 
> Do you have another way in your mind?

Thank you for that info, makes for a workaround in 5.17.0 until it gets figured out.
Comment 19 Andreas Sturmlechner gentoo-dev 2019-10-22 00:23:16 UTC
While /etc/xdg/plasma-workspace/env/ works for us (or ~/.config/plasma-workspace/env/ respectively), there is no(?) system replacement for /etc/plasma/shutdown. I tried with symlinking to ~/.config/plasma-workspace/shutdown but this requires executable bit. Without that, logout won't e.g. kill ssh-agent.

So I'm afraid the only way forward will be to add new instructions for pkg_postinst (and the Wiki) to copy these files into the respective user directories.
Comment 20 Larry the Git Cow gentoo-dev 2019-10-22 20:06:42 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/kde.git/commit/?id=1ba24fece412632e75365787b0206c30b663f3a3

commit 1ba24fece412632e75365787b0206c30b663f3a3
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-10-21 22:09:26 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-10-22 20:04:59 +0000

    kde-plasma/plasma-workspace: Update pkg_postinst
    
    Keep old locations for now, but instruct users to copy to home directory.
    
    Bug: https://bugs.gentoo.org/688366
    Package-Manager: Portage-2.3.78, Repoman-2.3.17
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 kde-plasma/plasma-workspace/plasma-workspace-5.17.49.9999.ebuild | 9 +++++++--
 kde-plasma/plasma-workspace/plasma-workspace-9999.ebuild         | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

https://gitweb.gentoo.org/proj/kde.git/commit/?id=725dbd794d895749b72f42a764482ce60657e794

commit 725dbd794d895749b72f42a764482ce60657e794
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-10-21 22:00:45 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-10-22 17:28:27 +0000

    kde-plasma/ksshaskpass: Update env script install path, pkg_postinst
    
    Bug: https://bugs.gentoo.org/688366
    Package-Manager: Portage-2.3.78, Repoman-2.3.17
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 .../ksshaskpass/ksshaskpass-5.17.49.9999.ebuild    | 23 +++++++++++-----------
 kde-plasma/ksshaskpass/ksshaskpass-9999.ebuild     | 23 +++++++++++-----------
 2 files changed, 22 insertions(+), 24 deletions(-)
Comment 21 Andreas Sturmlechner gentoo-dev 2019-10-23 17:10:39 UTC
Workaround in place.
Comment 22 Maciej Mrozowski gentoo-dev 2019-11-12 01:49:48 UTC
Created attachment 595834 [details, diff]
migrate-agent-scripts-to-new-layout.patch

Patch proposal:
- support new layout:
  /etc/xdg/plasma-workspace/env/
  /etc/xdg/plasma-workspace/shutdown/ (script require executable bit because run via QProcess)
- migrate existing /etc/plasma/ scripts
- warn when leftover scripts are found in old location
Comment 23 Maciej Mrozowski gentoo-dev 2019-11-12 18:30:16 UTC
Created attachment 595914 [details, diff]
migrate-agent-scripts-to-new-layout.patch

Fixed patch. Previous patch was not playing nice with portage confmem behaviour. Now, migrated config is no longer is part of initial ebuild qmerge so won't get silently replaced due to "not being touched by user".
Comment 24 Larry the Git Cow gentoo-dev 2019-11-12 23:56:23 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/kde.git/commit/?id=f3fdca23a349b3059cad5834e5e4fe9f945a52c6

commit f3fdca23a349b3059cad5834e5e4fe9f945a52c6
Author:     Maciej Mrozowski <reavertm@gentoo.org>
AuthorDate: 2019-11-12 22:51:22 +0000
Commit:     Maciej Mrozowski <reavertm@gentoo.org>
CommitDate: 2019-11-12 23:50:51 +0000

    kde-plasma/plasma-workspace: migrate {ssh,gpg}-agent scripts to new layout
    
    Bug: https://bugs.gentoo.org/688366
    Package-Manager: Portage-2.3.76, Repoman-2.3.16
    Signed-off-by: Maciej Mrozowski <reavertm@gentoo.org>

 .../plasma-workspace-5.17.49.9999.ebuild           | 50 ++++++++++++++++------
 .../plasma-workspace/plasma-workspace-9999.ebuild  | 50 ++++++++++++++++------
 2 files changed, 76 insertions(+), 24 deletions(-)
Comment 25 Larry the Git Cow gentoo-dev 2019-11-25 00:33:29 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdb0f5267d00191069c4bf88b98fe759441a2a2b

commit bdb0f5267d00191069c4bf88b98fe759441a2a2b
Author:     Maciej Mrozowski <reavertm@gentoo.org>
AuthorDate: 2019-11-12 23:39:50 +0000
Commit:     Maciej Mrozowski <reavertm@gentoo.org>
CommitDate: 2019-11-25 00:32:57 +0000

    kde-plasma/plasma-workspace: migrate {ssh,gpg}-agent scripts to new layout
    
    Bug: https://bugs.gentoo.org/688366
    Package-Manager: Portage-2.3.76, Repoman-2.3.16
    Signed-off-by: Maciej Mrozowski <reavertm@gentoo.org>

 .../plasma-workspace-5.17.3-r1.ebuild              | 205 +++++++++++++++++++++
 1 file changed, 205 insertions(+)
Comment 26 Maciej Mrozowski gentoo-dev 2019-11-25 00:41:45 UTC
This is fixed now. There will be elog informing that /etc agent startup/shutdown scripts has been migrated to new locations and that scripts can be deleted from old location.
Comment 27 Larry the Git Cow gentoo-dev 2019-12-22 18:58:20 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d82536728651a74bb9e3db51040aeded8824df89

commit d82536728651a74bb9e3db51040aeded8824df89
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-12-22 13:45:11 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-12-22 18:57:58 +0000

    kde-plasma/ksshaskpass: Add old script migration, update postinst
    
    Follow-up to bdb0f5267d00191069c4bf88b98fe759441a2a2b and
    77aa9069fe3cc4680c446a3d9ecd2f5f695f171d.
    
    Bug: https://bugs.gentoo.org/688366
    Package-Manager: Portage-2.3.82, Repoman-2.3.20
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 kde-plasma/ksshaskpass/ksshaskpass-5.17.4.ebuild | 50 ++++++++++++++++++------
 1 file changed, 39 insertions(+), 11 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77aa9069fe3cc4680c446a3d9ecd2f5f695f171d

commit 77aa9069fe3cc4680c446a3d9ecd2f5f695f171d
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-12-22 17:06:58 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-12-22 18:57:48 +0000

    kde-plasma/plasma-workspace: Improve old script detection/migration
    
    - Drop mkdir and chmod commands
    - Add missing || die
    - No need for subshells to detect constant paths
    - Use md5sum to detect if existing scripts were modified at all
    - Clean up pre-5.17.4 scripts, they were owned by plasma-workspace anyway
    
    Bug: https://bugs.gentoo.org/688366
    Package-Manager: Portage-2.3.82, Repoman-2.3.20
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 .../plasma-workspace-5.17.4-r1.ebuild              | 82 +++++++++++++---------
 1 file changed, 48 insertions(+), 34 deletions(-)
Comment 28 Larry the Git Cow gentoo-dev 2019-12-22 20:34:47 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/kde.git/commit/?id=3293034ed718aaee2de79c999b53f313ce2beec1

commit 3293034ed718aaee2de79c999b53f313ce2beec1
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-12-22 13:45:11 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-12-22 20:16:17 +0000

    kde-plasma/ksshaskpass: Add old script migration, update postinst
    
    Follow-up to bdb0f5267d00191069c4bf88b98fe759441a2a2b and
    77aa9069fe3cc4680c446a3d9ecd2f5f695f171d.
    
    Bug: https://bugs.gentoo.org/688366
    Package-Manager: Portage-2.3.82, Repoman-2.3.20
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 .../ksshaskpass/ksshaskpass-5.17.49.9999.ebuild    | 33 ++++++++++++++++++++--
 kde-plasma/ksshaskpass/ksshaskpass-9999.ebuild     | 33 ++++++++++++++++++++--
 2 files changed, 60 insertions(+), 6 deletions(-)

https://gitweb.gentoo.org/proj/kde.git/commit/?id=749ca048e97ab86232907aa1caa13b4104779d32

commit 749ca048e97ab86232907aa1caa13b4104779d32
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-12-22 17:06:58 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-12-22 20:06:34 +0000

    kde-plasma/plasma-workspace: Improve old script detection/migration
    
    - Drop mkdir and chmod commands
    - Add missing || die
    - No need for subshells to detect constant paths
    - Use md5sum to detect if existing scripts were modified at all
    - Clean up pre-5.17.4 scripts, they were owned by plasma-workspace anyway
    
    Bug: https://bugs.gentoo.org/688366
    Package-Manager: Portage-2.3.82, Repoman-2.3.20
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 .../plasma-workspace-5.17.49.9999.ebuild           | 112 ++++++++++++---------
 .../plasma-workspace/plasma-workspace-9999.ebuild  |  83 ++++++++-------
 2 files changed, 112 insertions(+), 83 deletions(-)