Avoid failing installation via temporary dir due to file name clashes
AbandonedPublic

Authored by kossebau on Mar 21 2019, 11:45 AM.

Details

Reviewers
leinir
apol
Group Reviewers
Frameworks
Summary

When installing to a temporary dir, there could be file name clashes
as the plain temporary dir path was used, with no further namespacing.
So if e.g. some other user on the same system had downloaded the same
resource before, that existing file due to its file rights would even
prevent the installation.

Test Plan

Installing, updating, deleting and reinstalling widget themes, window
themes, color themes as different users works.

Diff Detail

Repository
R304 KNewStuff
Branch
avoidtmpinstallclashes
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 9935
Build 9953: arc lint + arc unit
kossebau created this revision.Mar 21 2019, 11:45 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptMar 21 2019, 11:45 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
kossebau requested review of this revision.Mar 21 2019, 11:45 AM
kossebau planned changes to this revision.Mar 21 2019, 12:26 PM

Found a flaw: this will result in a different path on every call of the method for the same object, which can happen. Needs more thought.

So the solution would be to cache the calculated result. Which would also allow to have this as flag for some proper post-install cleanup once that is sorted out and defined.

Problem is: KNSCore::Installation is an exported class, with an installed header. So it would need to stay binary compatible.
Unless we give the comment "@internal" in the class documentation more emphasis. Not sure though if people have been aware of that, given the resulting API dox page does not carry that information bit: https://api.kde.org/frameworks/knewstuff/html/classKNSCore_1_1Installation.html

Now does the class not have a pimpl implementation, so we could simply add another data item.
Another option would be to reuse the existing set of directory/path members for the different installation dir types, where only one of is used. By the cost of a bit more fragile logic due to the abuse, but what else could be done?

kossebau abandoned this revision.Nov 29 2019, 6:20 PM

Not having looked more at this for some months, and will not do in foreseeable future, so abandoning to clean up stack.