-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kwin: Unwrap executable name for desktop file search #116549
kwin: Unwrap executable name for desktop file search #116549
Conversation
@@ -37,6 +37,7 @@ mkDerivation { | |||
patches = [ | |||
./0001-follow-symlinks.patch | |||
./0002-xwayland.patch | |||
./0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch | |
./0003-NixOS-Unwrap-executable-name-for-.desktop-search.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed. git format-patch
handles naming the file from the commit message. The prefix is to order patches in a group, so that e.g. patch 0002 happens after 0001, because the reverse will not necessarily apply.
0001
here is fine as it is not linked to the other two patches. It can be applied before or after the other two patches.
Or, let's say, let's see what the maintainer of the package thinks about that. But forcing arbitrary naming of the patch files compared to what the tooling gives is going to make it more awkward to work with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't git name them continues when you export them all at once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @samueldr is not applying all the patches at once. I usually do git am *.patch
when I'm working on a package. I don't have feelings about the file name. I expect it will get renamed the next time anyone works on this package's patches, and that's fine.
Result of 30 packages marked as broken and skipped:
5 packages skipped due to time constraints:
14 packages built successfully:
Result of 30 packages marked as broken and skipped:
6 packages skipped due to time constraints:
14 packages built successfully:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've wondered about this for a while, thanks for fixing it ✨
As I don't know a thing about this kind of code, I will leave the review of the patch to @ttuegel. But from looking it over, you for sure made the patch non-intrusive and commented in a very understandable way A+
An excellent choice to get working with Mobile NixOS ❤️ |
Screenshot and Task Manager both work now. ❤️ |
@ofborg test plasma5 (not that this test has any real coverage other than it started) |
What processes are going to call the patched function? I think this is likely the only approach that will work, but path trickey usually ends, so I have to make sure there's no other way. 😅 |
The particular instance I was working against was internal to kwin: Where you can see it uses Logs from the kde-plasmamobile IRC channel:
Then I extrapolated from there, figuring out where it went wrong. Traced it to |
pkgs/desktops/plasma-5/kwin/0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch
Outdated
Show resolved
Hide resolved
pkgs/desktops/plasma-5/kwin/0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch
Outdated
Show resolved
Hide resolved
@@ -37,6 +37,7 @@ mkDerivation { | |||
patches = [ | |||
./0001-follow-symlinks.patch | |||
./0002-xwayland.patch | |||
./0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @samueldr is not applying all the patches at once. I usually do git am *.patch
when I'm working on a package. I don't have feelings about the file name. I expect it will get renamed the next time anyone works on this package's patches, and that's fine.
e583c2a
to
7d714d1
Compare
Applied both suggestions and verified it still worked as expected, by being able to use Plasma Mobile. |
Aargh, conflicts. Feel free to merge once you resolve them. |
7d714d1
to
100db99
Compare
KWin for wayland uses the `.desktop` file to determine whether a process is allowed to access some wayland services. This would be fine if there was a stable interface to map a process to a `.desktop` file. Since there is no such interface, they are scanning `.desktop` files for one where the executable path matches the resolved file "exe" from `/proc/$PID/exe`. This would be fine, if we didn't wrap many (most?) KDE/Plasma binaries. Since we are wrapping binaries, the `exe` symlink points to a wrapped binary. No `.desktop` file will match for the wrapped binary. The solution here is to peel away at the `.${name}-wrapped` layers until we have the intended name for the executable. It is expected that no `.desktop` file will ever point to a wrapped binary.
100db99
to
1ba2080
Compare
(Currently waiting on the mass rebuild on my end to confirm things do still work...) |
see NixOS/nixpkgs#116549 * gnu/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/kde-plasma.scm (kwin)[origin]: Use it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
KWin for wayland uses the
.desktop
file to determine whether a processis allowed to access some wayland services.
This would be fine if there was a stable interface to map a process to a
.desktop
file.Since there is no such interface, they are scanning
.desktop
files forone where the executable path matches the resolved file "exe" from
/proc/$PID/exe
.This would be fine, if we didn't wrap many (most?) KDE/Plasma binaries.
Since we are wrapping binaries, the
exe
symlink points to a wrappedbinary. No
.desktop
file will match for the wrapped binary.The solution here is to peel away at the
.${name}-wrapped
layers untilwe have the intended name for the executable.
It is expected that no
.desktop
file will ever point to a wrappedbinary.
Motivation for this change
Fixing plasma mobile (PR will be coming later), and fixing plasma wayland session in general.
Should fix some of the issues in this linked comment:
As for plasma mobile shell, it fixes all of its "tasks" management. Without this, it cannot get the appropriate services from the compositor, meaning it cannot spy at the tasks running, so it cannot switch between tasks, or ask to go back to the desktop, among other things.
The patch was written in a way where it would be the least instrusive possible.
It is highly likely other KDE or Plasma components or apps use similar trickeries to get information from the desktop files. Coordination with upstream to produce a common interface those apps should use instead of readin
exe
themselves is likely the better solution.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)Ran this with a VM with a fresh plasma mobile shell setup. Worked quite well.
cc @oxalica if you want to test for the issues you were having
cc @worldofpeace @ttuegel as plasma5 peeps