Add KIO::StatRecursiveSize detail value so kio_trash only does this on demand
ClosedPublic

Authored by dfaure on Apr 16 2020, 11:39 PM.

Details

Summary

This indirectly fixes the testtrash unittest which noticed that the
directory size cache was being updated when CopyJob stat's the
destination trash:/.

Test Plan

bin/testtrash

Diff Detail

Repository
R241 KIO
Branch
2020_optimize_recursive_size
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 25397
Build 25415: arc lint + arc unit
dfaure created this revision.Apr 16 2020, 11:39 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 16 2020, 11:39 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
dfaure requested review of this revision.Apr 16 2020, 11:39 PM
meven accepted this revision.Apr 17 2020, 8:04 AM

So we are gonna need a patch to baloo-widget stat, with KIO::StatRecursiveSize
A test would nice for trash:/ with KIO::StatRecursiveSize

src/ioslaves/trash/trashimpl.cpp
1105

Maybe, check for details & KIO::StatTime
Down the rabbit hole...

This revision is now accepted and ready to land.Apr 17 2020, 8:04 AM
meven requested changes to this revision.Apr 17 2020, 8:08 AM
meven added inline comments.
src/core/global.h
323

I don't think we should assume that, it defeats quite the purpose.
For instance even if we the ioslave gets the filename or type for its needs it may just not include it in the UDSEntry if StatBasic was not passed.

src/ioslaves/trash/trashimpl.cpp
1105

(I don't expect it)

This revision now requires changes to proceed.Apr 17 2020, 8:08 AM
dfaure added inline comments.Apr 17 2020, 8:55 AM
src/core/global.h
323

There are bugs in the current kio_file implementation if StatBasic isn't set.

mode_t type = 0;
if (details & KIO::StatBasic) {
    ... code that sets type ...
}
if (details & KIO::StatAcl) {
    appendACLAtoms(targetPath, entry, type); // oops type is 0
}

Hmm I thought I saw more, but now I don't see more (must have been fixed meanwhile). If you fix the bug I'm happy to remove the comment, LOL.

dfaure added inline comments.Apr 17 2020, 9:50 PM
src/ioslaves/trash/trashimpl.cpp
1105

Well, if StatRecursiveSize is set, we have the info, so we might as well provide it.

If it's not set, then this would mean we need to do the whole recursive thing also when StatTime is set, and it's part of StatDefaultDetails so I expect we'll do this often for nothing. I think we don't really want to do that, in practice we need both pieces of information, or none.

dfaure updated this revision to Diff 80428.Apr 17 2020, 9:51 PM

Remove comment change above StatBasic

meven accepted this revision.Apr 18 2020, 4:37 PM
meven added inline comments.
src/core/global.h
323

I believe it was StatResolveSymlink
D28947 for the StatAcl fix

This revision is now accepted and ready to land.Apr 18 2020, 4:37 PM
dfaure closed this revision.Apr 18 2020, 4:51 PM