Create a "." entry even on empty dirs
ClosedPublic

Authored by albertvaka on Jul 25 2017, 11:10 PM.

Details

Summary

If a slave doesn't (or can't) emit an UDSEntry for the "." entry, we do it in the SlaveBase base class.

This was not the case for empty directories, which this patch fixes.

Fixes bug 382046

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
albertvaka created this revision.Jul 25 2017, 11:10 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 25 2017, 11:10 PM
albertvaka edited the summary of this revision. (Show Details)Jul 25 2017, 11:12 PM
albertvaka added a reviewer: elvisangelaccio.
elvisangelaccio accepted this revision.Jul 26 2017, 8:18 AM

Tested with mtp and it works, thanks.

This revision is now accepted and ready to land.Jul 26 2017, 8:18 AM
This revision was automatically updated to reflect the committed changes.
dfaure added a subscriber: dfaure.Jul 28 2017, 8:57 AM

This commit breaks plasmashell startup for me, with a non-empty desktop:/

2017-07-28T10:51:54 plasmashell(5605)/kf5.kio.core.dirlister KCoreDirListerCache::slotEntries: KCoreDirListerCache(0x7f6a2002c980) KIO::ListJob(0x26a9ae0) new entries for QUrl("desktop:/")
2017-07-28T10:51:54 plasmashell(5605)/default KCoreDirListerCache::slotEntries: ".directory"
2017-07-28T10:51:54 plasmashell(5605)/kf5.kio.core.dirlister KCoreDirListerCache::slotEntries: Adding item: QUrl("desktop:/.directory")
2017-07-28T10:51:54 plasmashell(5605)/default KCoreDirListerCache::slotEntries: ".."
2017-07-28T10:51:54 plasmashell(5605)/default KCoreDirListerCache::slotEntries: "."
2017-07-28T10:51:54 plasmashell(5605)/default KCoreDirListerCache::slotEntries: "Home.desktop"
2017-07-28T10:51:54 plasmashell(5605)/kf5.kio.core.dirlister KCoreDirListerCache::slotEntries: Adding item: QUrl("desktop:/Home.desktop")
2017-07-28T10:51:54 plasmashell(5605)/kf5.kio.core.dirlister KCoreDirLister::Private::addNewItem: in QUrl("desktop:/") item: QUrl("desktop:/Home.desktop")
2017-07-28T10:51:54 plasmashell(5605)/default KCoreDirListerCache::slotEntries: "trash.desktop"
2017-07-28T10:51:54 plasmashell(5605)/kf5.kio.core.dirlister KCoreDirListerCache::slotEntries: Adding item: QUrl("desktop:/trash.desktop")
2017-07-28T10:51:54 plasmashell(5605)/kf5.kio.core.dirlister KCoreDirLister::Private::addNewItem: in QUrl("desktop:/") item: QUrl("desktop:/trash.desktop")
2017-07-28T10:51:54 plasmashell(5605)/default KCoreDirListerCache::slotEntries: done
2017-07-28T10:51:54 plasmashell(5605)/kf5.kio.core.dirlister KCoreDirListerCache::slotEntries: KCoreDirListerCache(0x7f6a2002c980) KIO::ListJob(0x26a9ae0) new entries for QUrl("desktop:/")
2017-07-28T10:51:54 plasmashell(5605)/default unknown: ASSERT: "dir->rootItem.isNull()" in file /d/kde/src/5/frameworks/kio/src/core/kcoredirlister.cpp, line 1202

At first sight it looks like "." is emitted multiple times.

Please revert and fix it better ;)

aacid added a subscriber: aacid.Jul 28 2017, 9:55 AM

Can we get tests?

Difficult to test in kio itself, but for sure testable in the autotest for kio_desktop (plasma-workspace/kioslave/desktop/tests)

Reverted the patch. Couldn't figure out what is wrong with it though... I don't think that "." is being emitted multiple times because of this patch. It looks more like if kio_desktop was causing listEntries to be called twice.

Mmmm it could be because kio_desktop is a ForwardingSlave, so the entry is added first by its forwardee (kio_file I think) and then again by kio_desktop itself?

I'm not sure if what I'm saying even makes sense because I don't really know how KIO works. Will investigate a bit...