Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Spotlight: searching in user homes, bug #543 #7

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Changes in 3.1.7
escalation in afpd processes
* FIX: afpd: ACL related error messages, now logged with loglevel
debug instead of error
* FIX: Spotlight: searching in user homes, bug #543

Changes in 3.1.6
================
Expand Down
18 changes: 18 additions & 0 deletions libatalk/util/netatalk_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ static struct vol *creatvol(AFPObj *obj,
char *p, *q;
bstring dbpath = NULL;
bstring global_path_tmp = NULL;
bstring cmd = NULL;

strlcpy(path, path_in, MAXPATHLEN);

Expand Down Expand Up @@ -1028,6 +1029,21 @@ static struct vol *creatvol(AFPObj *obj,
volume->v_localname, volume->v_uuid);
}

#ifdef HAVE_TRACKER
if (STRCMP(section, ==, INISEC_HOMES) && IS_AFP_SESSION(obj)) {
if (volume->v_flags & AFPVOL_SPOTLIGHT) {
setenv("DBUS_SESSION_BUS_ADDRESS", "unix:path=" _PATH_STATEDIR "spotlight.ipc", 1);
setenv("XDG_DATA_HOME", _PATH_STATEDIR, 0);
setenv("XDG_CACHE_HOME", _PATH_STATEDIR, 0);
setenv("TRACKER_USE_LOG_FILES", "1", 0);
system(TRACKER_PREFIX "/bin/tracker-control -s");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid calling tracker-control -s for every home mount? This should probably be moved to etc/netatalk/netatalk.c or something similar that ensures we only call out to tracker-control once in order to start it up.

cmd = bformat("tracker-control -f \"%s\"", path);
LOG(log_debug, logtype_sl, "creatvol: sl (re)indexing home: %s", bdata(cmd));
system(bdata(cmd));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And another one: will system() return after tracker-control -f scheduled the reindexing or will it wait until the reindexing completed ? If tracker-control -f doesn't exit until the reindexing is complete so would system(), so you may test this by calling tracker-control -f on some big directory tree.

If it turns out that tracker-control -f waits till the indexing completes, the afpd process waiting for the system() command will be stuck there and the AFP session might run into timeouts.

}
}
#endif

/* no errors shall happen beyond this point because the cleanup would mess the volume chain up */
volume->v_next = Volumes;
Volumes = volume;
Expand All @@ -1039,6 +1055,8 @@ static struct vol *creatvol(AFPObj *obj,
bdestroy(dbpath);
if (global_path_tmp)
bdestroy(global_path_tmp);
if (cmd)
bdestroy(cmd);
if (ret != 0) {
if (volume)
volume_free(volume);
Expand Down