#1432 closed enhancement

Magic Folder on Mac OS X and other BSDs — at Version 12

Reported by: davidsarah Owned by:
Priority: normal Milestone: undecided
Component: code-frontend-magic-folder Version: 1.8.2
Keywords: fsevents mac bsd magic-folder Cc:
Launchpad Bug:

Description (last modified by daira)

The Magic Folder feature currently only works on Linux (where it uses inotify to detect filesystem changes), and Windows (where it uses ReadDirectoryChangesW). This ticket is about supporting the same feature on Mac OS X and possibly other BSD-based operating systems.

Mac OS X has the fsevents, and all BSDs including Mac OS X have kqueue/kevent. If I understand correctly, neither fsevents nor kqueue/kevent give notifications of which files have changed, so the implementation will have to scan the directory and look at last-modified times to determine that. (This is occasionally also necessary for correctness on Linux and Windows; see #1430.)

Change History (12)

comment:1 Changed at 2011-07-17T02:21:50Z by davidsarah

  • Description modified (diff)
  • Keywords bsd added
  • Summary changed from drop-upload on Mac OS X to drop-upload on Mac OS X and other BSDs

comment:2 Changed at 2011-07-25T12:26:43Z by davidsarah

  • Type changed from defect to enhancement

comment:3 Changed at 2011-08-15T19:38:42Z by davidsarah

Python's select module supports kqueue, which is a lot easier and less error-prone than accessing it via ctypes or an extension module. Note that a critical bug in that support was fixed in Python 2.6.5. (2.7 was released after 2.6.5 and has this fix.)

comment:4 Changed at 2012-03-29T19:51:21Z by davidsarah

  • Priority changed from major to normal

comment:5 follow-up: Changed at 2012-11-15T06:07:59Z by malaparte

I thought I'd just save this thought here, because I don't know if I have time to look at it closely. Have you considered 'watchdog' http://packages.python.org/watchdog/ to watch for changes on a folder across platforms?

comment:6 in reply to: ↑ 5 Changed at 2012-11-15T06:11:24Z by malaparte

Last edited at 2012-11-15T06:12:02Z by malaparte (previous) (diff)

comment:7 Changed at 2012-11-15T23:39:14Z by davidsarah

watchdog uses a C extension module to access the fsevents API on OS X. I would strongly prefer to use ctypes for this (if needed, i.e. if we don't use kqueue instead) and not add any more native code dependencies.

Last edited at 2012-11-16T00:31:36Z by davidsarah (previous) (diff)

comment:8 Changed at 2012-11-16T00:22:50Z by davidsarah

Also,

davidsarah@shinier:~/tahoe/git$ cloc --no3 --quiet watchdog

http://cloc.sourceforge.net v 1.09  T=4.0 s (15.0 files/s, 2563.5 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                          36           1286           2238           4010
C                                3            168            473            738
Bourne Shell                    13             71            188            273
make                             3             46              5            193
DOS Batch                        2             27              1            172
XML                              1              0              0            155
C/C++ Header                     1             28             68             93
YAML                             1              0              0             21
-------------------------------------------------------------------------------
SUM:                            60           1626           2973           5655
-------------------------------------------------------------------------------

plus watchdog's PyYaml, argh and pathtools dependencies

compared to:

davidsarah@shinier:~/tahoe/git$ cloc --no3 --quiet trunk/support/lib/python2.6/site-packages/Twisted-12.0.0-py2.6-linux-x86_64.egg/twisted/internet/inotify.py

http://cloc.sourceforge.net v 1.09  T=0.5 s (2.0 files/s, 810.0 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                           1             84            140            181
-------------------------------------------------------------------------------
davidsarah@shinier:~/tahoe/git$ cloc --no3 --quiet trunk/src/allmydata/frontends/drop_upload.py

http://cloc.sourceforge.net v 1.09  T=0.5 s (2.0 files/s, 246.0 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                           1             25             10             88
-------------------------------------------------------------------------------

plus how ever much code it takes to support Windows (about 200-300 code lines), and BSD/OS X.

comment:9 Changed at 2012-11-16T00:29:27Z by davidsarah

I should mention that I don't care about lines of code per se; I'm just using it as a rough proxy measure for complexity and opportunity-for-bugs.

Last edited at 2015-10-28T23:13:52Z by daira (previous) (diff)

comment:10 Changed at 2014-12-02T19:48:43Z by warner

  • Component changed from code-frontend to code-frontend-drop-upload
  • Description modified (diff)

comment:11 Changed at 2015-06-01T16:11:09Z by daira

  • Keywords magic-folder added

Add magic-folder keyword to all drop-upload tickets.

comment:12 Changed at 2015-10-28T23:18:23Z by daira

  • Description modified (diff)
  • Keywords drop-upload removed
  • Summary changed from drop-upload on Mac OS X and other BSDs to Magic Folder on Mac OS X and other BSDs
Note: See TracTickets for help on using tickets.