Re: [Tracker] Tracker to do list



Laurent Aguerreche wrote:

Let see tracker_is_directory():

        if (dir_in_locale) {
                struct stat finfo;

                g_lstat (dir_in_locale, &finfo);

                g_free (dir_in_locale);

                return S_ISDIR (finfo.st_mode);
        }

g_lstat() is just a wrapper for lstat(). This system call works on the
link itself and not on the pointed file. So S_ISDIR() pretends that the
link is not a directory. Furthermore Tracker will mark this link as a
regular file and I think that trackerd will try to open it with fgets()
which will make it to block.

IMHO, we should use g_stat() here to know properties of the pointed
file.

What do you think about that?


When designing tracker, I deliberated avoided following links for a number of reasons :

1) A directory link could force indexing into areas that the user does not want indexed (or rather would not expect to be indexed)

2) Recursive links would cause trackerd to loop endlessly

3) The link might point to a really slow nfs mount which could seriously degrade tracker's performance.

Ergo the use of lstat()

In this case, the best course of action would be to test if file is a link before calling is_text_file() on it.

--
Mr Jamie McCracken
http://jamiemcc.livejournal.com/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]