Polkit Support in KIO - Progess so far
It has been more than a month since I last blogged. This is not really a good situation. Nevertheless, for the remaining period of GSOC I will try to be more regular.
In this post I intend to report the whereabouts of my project. First of all me not posting any updates about my project was due to two problems that showed up when I was two weeks into the coding period. One, which I had anticipated, was to decide from where to show a warning dialog during the brief period of time when privileges are elevated. The problem was that showing the prompt from
KIO::Slave resulted in repetition and to show it from
KIO::JobUiDelegate permissions of destination folder was needed beforehand which required additional computation. So for this I decided to add a signal in
KIO::Slave and all the necessary code for additional prompts in
KIO::Job. This way the KIO slave emits the signal whenever it encounters ACCESS DENIED error and then job decides whether or not to show the prompt. The other problem was to figure out how to modify files created by a privileged process by an underprivileged one. By the way the latter was completely uncalled-for and it took me around two weeks to decide on a solution. To send data between processes I tried every possible IPC mechanism involving shared memory, pipes and sockets. At last I decided on sharing file descriptor between the privileged and under-privileged process and to accomplish that I used Unix local domain sockets.
Now fast-forward to today, I have found solutions to my problems and I can say I have finally made some real progress. To be precise with my current state of project dolphin’s context menu is very much usable inside a read-only folder. Most of the action in dolphin’s context menu, which includes copy/cut/paste, rename, creating new file, creating new folder, creating links, trash and delete, are working without any issues whatsoever. The actions that are not working are Creating desktop files, Creating Link to Application (technically both involves creating desktop files but have two separate menu options), Compressing files, Drag and Drop, Undoing and Renaming multiple files in one go. The first two need changes in
KIO::KPropertiesDialog in order to work. For compressing to work changes have to be done from ark’s side. DnD requires changes in
KIO::DropJob. Undoing and renaming many files kind of challenge my current solution but I have explained their case and the possible workaround in the end of post.
I have created a phabricator task in which I have listed all the related revisions and also tried to explain how everything is going to work. If anyone has a kde build environment set up and is interested to try out the changes then apply the patches listed in this repo. Unlike my previous patches which required separate branch for every file operation, all of my current patches can be applied at once and changes can be tested without having to checkout to a new branch.
Now coming back to the issue with undoing and renaming files. My design assumes one top-level parent job and many sub-jobs. However while undoing changes and renaming files, jobs are created in a loop. This means creation of many top-level jobs (like
KIO::CopyJob) and that many sub jobs (like
KIO::SimpleJob). So a possible workaround is to introduce a new
KIO::Job that can be placed outside the loop body and would serve as a parent job for all the jobs created inside the loop. But I will consider this only after my current changes are reviewed by KIO developers.
Till then cheers.