[balooctl] Print current state & indexing file when monitor starts
ClosedPublic

Authored by poboiko on Oct 6 2018, 5:46 PM.

Details

Summary

This is based on D15943: [balooctl] Monitor also for state changes.
Simply print current state & file when monitor starts.

BUG: 364858
FIXED-IN: 5.52

Test Plan

balooctl monitor now prints

Press ctrl+c to stop monitoring
File indexer is running
Idle

Diff Detail

Branch
monitor-initial-state (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 3547
Build 3565: arc lint + arc unit
poboiko requested review of this revision.Oct 6 2018, 5:46 PM
poboiko created this revision.
bruns accepted this revision.Oct 7 2018, 12:20 AM
bruns added a subscriber: bruns.

Looks sane ...

This revision is now accepted and ready to land.Oct 7 2018, 12:20 AM
ngraham accepted this revision.Oct 7 2018, 1:42 AM
ngraham added a subscriber: ngraham.

Fantastic! Works great.

poboiko closed this revision.Oct 8 2018, 10:16 PM

Woops! startedIndexingFile does not print a newline. I guess I can just add m_out << endl...

Woops! startedIndexingFile does not print a newline. I guess I can just add m_out << endl...

No, definitely not, see D15995.

No, definitely not, see D15995.

I don't see how it is a problem. The problem is not that it's not written to terminal (it is), but that it just doesn't have a trailing newline, i.e. output looks like

Indexing /some/file1Indexing /some/file2: OK
Indexing /some/file3: OK
...

A flush shouldn't hurt.

Just in case, I suggest not to do it inside startedIndexingFile, but right here, after line 73 (that's because we have a special case of startedIndexingFile without finsihedIndexingFile).

bruns added a comment.Oct 12 2018, 2:21 PM

No, definitely not, see D15995.

I don't see how it is a problem. The problem is not that it's not written to terminal (it is), but that it just doesn't have a trailing newline, i.e. output looks like

Indexing /some/file1Indexing /some/file2: OK
Indexing /some/file3: OK
...

So apparently the indexer has not yet processed the registration request and does not send us a finished signal?

Can you try to find out the exact sequence of messages using dbus-monitor interface='org.kde.fileindexer'?

bruns added a comment.Oct 12 2018, 2:27 PM
Indexing /some/file1Indexing /some/file2: OK

Are you sure its file1...file2 and not the same file twice? If it is the same, we can set m_currentFile in 71 and suppress the duplicated output in startedIndexingFile.

bruns added a comment.Oct 12 2018, 2:37 PM

Also, is your running baloo_file using current master? Otherwise, it may return a file finished long ago, see D15994.

That's weird. I caught it only once and thought that it is because I trivially forgot the endl. But now I cannot reproduce it anymore.
Seems like it should be fine, since we do emit finished signal, which will write the 'OK' part.
Sorry for the noise.