git-annex/doc/design/assistant/blog/day_11__freebsd.mdwn
Joey Hess b6d46c212e git-annex (5.20140402) unstable; urgency=medium
* unannex, uninit: Avoid committing after every file is unannexed,
    for massive speedup.
  * --notify-finish switch will cause desktop notifications after each
    file upload/download/drop completes
    (using the dbus Desktop Notifications Specification)
  * --notify-start switch will show desktop notifications when each
    file upload/download starts.
  * webapp: Automatically install Nautilus integration scripts
    to get and drop files.
  * tahoe: Pass -d parameter before subcommand; putting it after
    the subcommand no longer works with tahoe-lafs version 1.10.
    (Thanks, Alberto Berti)
  * forget --drop-dead: Avoid removing the dead remote from the trust.log,
    so that if git remotes for it still exist anywhere, git annex info
    will still know it's dead and not show it.
  * git-annex-shell: Make configlist automatically initialize
    a remote git repository, as long as a git-annex branch has
    been pushed to it, to simplify setup of remote git repositories,
    including via gitolite.
  * add --include-dotfiles: New option, perhaps useful for backups.
  * Version 5.20140227 broke creation of glacier repositories,
    not including the datacenter and vault in their configuration.
    This bug is fixed, but glacier repositories set up with the broken
    version of git-annex need to have the datacenter and vault set
    in order to be usable. This can be done using git annex enableremote
    to add the missing settings. For details, see
    http://git-annex.branchable.com/bugs/problems_with_glacier/
  * Added required content configuration.
  * assistant: Improve ssh authorized keys line generated in local pairing
    or for a remote ssh server to set environment variables in an
    alternative way that works with the non-POSIX fish shell, as well
    as POSIX shells.

# imported from the archive
2014-04-02 21:42:53 +01:00

50 lines
2.7 KiB
Markdown

I've been investigating how to make `git annex watch` work on
FreeBSD, and by extension, OSX.
One option is kqueue, which works on both operating systems, and allows
very basic monitoring of file changes. There's also an OSX specific
hfsevents interface.
Kqueue is far from optimal for `git annex watch`, because it provides even
less information than inotify (which didn't really provide everything I
needed, thus the lsof hack). Kqueue doesn't have events for files being
closed, only an event when a file is created. So it will be difficult for
`git annex watch` to know when a file is done being written to and can be
annexed. git annex will probably need to run lsof periodically to check when
recently added files are complete. (hsevents shares this limitation)
Kqueue also doesn't provide specific events when a file or directory is
moved. Indeed, it doesn't provide specific events about what changed at
all. All you get with kqueue is a generic "oh hey, the directory you're
watching changed in some way", and it's up to you to scan it to work out
how. So git annex will probably need to run `git ls-tree --others`
to find changes in the directory tree. This could be expensive with large
trees. (hsevents has per-file events on current versions of OSX)
Despite these warts, I want to try kqueue first, since it's more portable
than hfsevents, and will surely be easier for me to develop support for,
since I don't have direct access to OSX.
So I went to a handy Debian kFreeBSD porter box, and tried some kqueue
stuff to get a feel for it. I got a python program that does basic
directory monitoring with kqueue to work, so I know it's usable there.
Next step was getting kqueue working from Haskell. Should be easy, there's
a Haskell library already. I spent a while trying to get it to work on
Debian kFreeBSD, but ran into a
[problem](https://github.com/hesselink/kqueue/issues/1) that could be
caused by the Debian kFreeBSD being different, or just a bug in the Haskell
library. I didn't want to spend too long shaving this yak; I might install
"real" FreeBSD on a spare laptop and try to get it working there instead.
But for now, I've dropped down to C instead, and have a simple C program
that can monitor a directory with kqueue. Next I'll turn it into a simple
library, which can easily be linked into my Haskell code. The Haskell code
will pass it a set of open directory descriptors, and it'll return the
one that it gets an event on. This is necessary because kqueue doesn't
recurse into subdirectories on its own.
I've generally had good luck with this approach to adding stuff in Haskell;
rather than writing a bit-banging and structure packing low level interface
in Haskell, write it in C, with a simpler interface between C and
Haskell.