Comment 3 for bug 267240

Revision history for this message
Benjamin Kampmann (lightyear) wrote : Re: Scanning report goes over 100% in 0.5.9

I explained this issue would happen at the time I was told to implement this feature. There is even a FIXME around it. To explain again why this happens:

To calculate the amount of files we are scanning we use a very simple os.walk. This os.walk is the fastest way to find all the files but it has two major problems: it is *not* following any symlinks (I am not sure for hardlinks) on linux and no .LNK-Files on Windows (which is the system for file system linking there). So files inside these directories are not counted. But atm the media scanner is using LocalResource and LocalResource is a bit more intelligent than os.walk. It figures out if something is a link (sym- or hardlinks on Linux and .LNK-Files on Windows) and acts accordingly. That means that the media scanner is entering such links if they are directories.

Because of that the media scanner estimation is likely to be wrong if there are any kind of links inside the media directories. There are three ways to fix this:
 - deactivate the link following during scan (not wanted)
 - follow links in counting (would slow down the estimating)
 - rewrite the whole part to use in any case the same system for estimating AND scanning (so that there would always be a consistency of the way the file system is build into a tree)

The last one is the only proper fix to this issue but I am not sure about how much time that would take.