Re: [Tracker] Tracker to do list



Le samedi 09 septembre 2006 Ã 00:31 +0100, Jamie McCracken a Ãcrit :
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.

I have decided to check whether the file is a link or not before
xdg_mime_get_mime_type_for_file() is called. If it is a link then
tracker_get_mime_type() returns "symlink".

There was also a little bug with tracker-meta-folder which never found a
passed directory name ended by a '/'. So in
tracker_dbus_method_files_get_metadata_for_files_in_folder() I remove
this slash.

And this patch contains many cleanups... I didn't look at
tracker-db-sqlite.*.



Laurent.

Attachment: big-cleanup-2+more.diff.gz
Description: GNU Zip compressed data



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