[PATCHSET] Add OS X Spotlight support (was: Spotlight support)

Ralph Böhme rb at sernet.de
Fri Aug 1 06:27:45 MDT 2014


Hi

On Wed, Apr 16, 2014 at 02:31:44PM -0700, Jeremy Allison wrote:
> On Thu, Apr 10, 2014 at 01:42:48PM +0200, Ralph Böhme wrote:
> > For all interested in Samba supporting Spotlight for OS X clients:
> > 
> > <https://github.com/slowfranklin/samba/commits/spotlight>
> > 
> > is already working as far as correctly replying to queries from
> > clients. \o/
> > 
> > Samba acts as a proxy fowarding search queries to Gnome Tracker after
> > mapping Apple's Spotlight query language to SPARQL.
> > 
> > IPC between Samba and the Tracker store is done via dbus in the
> > relevant tracker library (libtracker-sparql). As all but the very
> > latest Tracker version register services in DBUS user context, I have
> > to use a bit of a hack in order to
> > 
> > - run Tracker in root DBUS user context
> > 
> > - pair every call to tracker in Samba within
> >   become_root()/unbecome_root()
> > 
> > Latest Tracker 1.0 adds support for registering Tracker in DBUS system
> > context, which will allow for a cleaner integration in the future.
> > 
> > Usage:
> > 
> > - install tracker and libtracker-sparql-dev (or whatever it's called
> >   on your system)
> > 
> > - use a script like the following for starting Samba and a "private"
> >   dbus instance: <https://gist.github.com/slowfranklin/10371423>
> > 
> > - install a dbus-session.conf file in the location referenced in the
> >   start script and adust path in listen directive:
> >   <https://gist.github.com/slowfranklin/8a52c36be3b6579f62ab>
> >   
> > - configure samba with --enable-spotlight
> > 
> > Comments welcome :-)
> 
> So I'd love to see you finish this up and send
> it as a patchset to samba-technical for formal
> review.

Here we go... final patches attached. For those who prefer a git repo:
<https://github.com/slowfranklin/samba/commits/spotlight>

It's now fully async. The async tracker-sparql API uses a glib event
loop with threads. That means, on occasion whenever I'm want to check
whether any queued request is finished, I have to iteratate the glib
event loop. This is done without blocking by using
g_main_context_iteration().

Seems to work without unwanted side effects. Question to the threading
experts: do you see any unwanted possible side effects here by going
in bed with glib?

I'm not forcing DBUS IPC anymore with libtracker-sparql which means
the library uses the so called direct backend: the database files are
mmaped into the process address space. This got me rid of the
become_root() calls.

Review appreciated. I would love to see this hit 4.2. :)

For those who want to test it out, above instructions still apply. You
also need these settings in smb.conf [1]:

[global]
        ...
        rpc_server:mdssvc = embedded
        ...
 
[share]
        ...
        spotlight = yes
        ...

For testing with Tracker commandline utils, you have to run a root
shell and source these shell commands [2]:

INSTALLDIR=/some/dir
TRACKER_DIR="$INSTALLDIR/var/tracker"
export HOME="$TRACKER_DIR"
export DBUS_SESSION_BUS_ADDRESS="unix:path=$INSTALLDIR/var/run/spotlight.ipc"

-Ralph

[1] <https://gist.github.com/slowfranklin/d97aaf4b11febb187793>
[2] <https://gist.github.com/slowfranklin/f93e21b4371d8429b82b>

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spotlight-patches.tgz
Type: application/gzip
Size: 62166 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140801/39bddfd8/attachment.bin>


More information about the samba-technical mailing list