D11753: baloodb: Add clean command

Stefan BrĂ¼ns noreply at phabricator.kde.org
Mon Apr 2 21:44:27 UTC 2018


bruns added inline comments.

INLINE COMMENTS

> michaelh wrote in databasesanitizer.cpp:316
> I've tried it. Sadly your suggestion does not work. With `fi = filePathToStat(info.symlink.toLocal8Bit())` fi._st_dev is == 0 when the symlink target does not exist. Hence it does tell me **why** the link can't be followed. baloo's db otoh knows about this. As `deviceIdFilter` does never contain 0 symlinks would be removed when they should be ignored. With `If(id != 0)` truly "dead" symlinks will not be removed.
> Maybe I didn't understand what you're suggesting?
> 
> `filePathToStat` returns `QT_STATBUF`. My guess is that is essentially the same as `QT_FSTAT`, at least `man fstat.2` says so.

What do you consider a "truly dead" symlink?

If you really want to do it correctly, you have to walk the file system yourself, one symlink target path component at a time - each path component can be a symlink itself, or a mount point. You should check the device id for *every* path component.

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D11753

To: michaelh, #baloo, #frameworks
Cc: bruns, cfeck, smithjd, ashaposhnikov, michaelh, astippich, spoorun, ngraham, alexeymin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180402/e967a8d2/attachment.html>


More information about the Kde-frameworks-devel mailing list