Bug 379215 - When 2 processes call the same KAuth action, first executed action result returns to both
Summary: When 2 processes call the same KAuth action, first executed action result ret...
Status: CONFIRMED
Alias: None
Product: frameworks-kauth
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.33.0
Platform: Arch Linux Linux
: VHI critical
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-25 17:41 UTC by Martin Kostolný
Modified: 2021-12-20 15:56 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Kostolný 2017-04-25 17:41:59 UTC
I'm currently working on a KAuth integration into KTextEditor document saving. First iteration is already in master, second is being worked on here: https://phabricator.kde.org/D5394

I have simulated following behaviour (copied from a comment in D5494):
1) open Kate to edit a privileged file1
2) open KWrite to edit a different privileged file2
3) edit & save file1 (KAuth dialog is shown, do not enter password yet)
4) edit & save file2 -> it seems nothing happens (thats probably because one KAuth dialog of the same action is already opened)
5) fill password to existing KAuth dialog and send -> both editors say "saved", although only the first one is really saved

This means that KAuth::Action::execute().exec() returns in both processes (Kate and KWrite) at the same time when the first action was finished.

I believe that each such action should end on its own even if they both have the same ID and use the same helper binary.

PS: Alternatively I could differentiate the Action reply by returning different data in data() map. But no data are actually returned back from helper binary (just Success or Error reply) - I'll create another bug report for that.

I'll gladly provide more information on demand :).
Comment 1 Harald Sitter 2020-09-05 15:47:32 UTC
Mhhh. This may actually be a substantial architectural defect. I'm only glancing over the code but it looks a whole lot like the way the client<->helper communication is built assumes that only one action of a single type e.g. "org.kde.foo.action" is run at any given time. Specifically the helper gets told to run an action and then informs on progress for that action via signals that only link to the request by the action name. That is why two instances of kwrite would get finished, the helper emits actionPerformed("org.kate.whatevs", {}) and both clients think their request is the one that was performed.

Fixing this essentially needs the entire IPC to get changed :|
Oh dear oh dear