Commit graph

591 commits

Author SHA1 Message Date
Joey Hess
56830af8d8 simpler use of MIN_VERSION checks 2013-03-10 15:43:17 -04:00
Joey Hess
3e32bb41f6 webapp: Work around bug in Warp's slowloris attack prevention code, that caused regular browsers to stall when they reuse a connection after leaving it idle for 30 seconds. (See https://github.com/yesodweb/wai/issues/146) 2013-03-09 14:57:48 -04:00
Joey Hess
cbb6e1fae4 tag xmpp pushes with jid
This fixes the issue mentioned in the last commit.

Turns out just collecting UUID of clients behind a XMPP remote is
insufficient (although I should probably still do it for other reasons),
because a single remote repo might be connected via both XMPP and local
pairing. So a way is needed to know when a push was received from any
client using a given XMPP remote over XMPP, as opposed to via ssh.
2013-03-06 16:29:19 -04:00
Joey Hess
5895b2ac75 check that gpg generated as much data as we asked for 2013-03-03 20:39:01 -04:00
Joey Hess
13cfe5c582 improve comments and variable names WRT base64 encoded encryption keys 2013-03-03 19:44:48 -04:00
Joey Hess
1865b28094 assistant: Logs are rotated to avoid them using too much disk space.
This cannot completely guard against a runaway log event, and only runs
every hour anyway, but it should avoid most problems with very
long-running, active assistants using up too much space.
2013-03-01 13:30:48 -04:00
Joey Hess
0151f42cdf Stop depending on testpack. 2013-02-27 23:23:41 -04:00
Joey Hess
24316f6562 improve imports 2013-02-27 21:48:46 -04:00
Joey Hess
a2f17146fa move Arbitrary instances out of Test and into modules that define the types
This is possible now that we build-depend on QuickCheck.
2013-02-27 21:42:07 -04:00
Joey Hess
cbd53b4a8c Makefile now builds using cabal, taking advantage of cabal's automatic detection of appropriate build flags.
The only thing lost is ./ghci

Speed: make fast used to take 20 seconds here, when rebuilding from
touching Command/Unused.hs. With cabal, it's 29 seconds.
2013-02-27 02:39:22 -04:00
Joey Hess
9d6fd5b927 webapp: Display any error message from git init if it fails to create a repository. 2013-02-26 13:04:37 -04:00
Peter Simons
d74509da86 Utility/Path.hs: System.Path is exported by "MissingH" and "pathtype" package 2013-02-23 17:05:44 +01:00
Joey Hess
a7a1bcd1d6 Avoid passing -p to rsync, to interoperate with crippled filesystems.
In general, git-annex does not try to preserve file permissions. For
example, they don't round trip through special remotes. So it's ok to not
preserve them for git remotes either.

On crippled filesystems, rsync has been observed failing after the file
was transferred because it couldn't set some permission or other.
2013-02-22 15:23:29 -04:00
Joey Hess
e1dba0c3dc avoid trying to use GECOS on Android, which responds with sig11 2013-02-19 18:06:27 -04:00
Joey Hess
624e34649f Direct mode: Support filesystems like FAT which can change their inodes each time they are mounted. 2013-02-19 17:31:03 -04:00
Joey Hess
eb0e5be62f set fileEncoding on the off chance lsof outputs binary garbage 2013-02-18 17:20:52 -04:00
Joey Hess
a988b90826 avoid warning 2013-02-15 13:05:39 -04:00
Joey Hess
a3a567da13 little xargs eqivilant as a pure function 2013-02-15 13:05:19 -04:00
Joey Hess
a52f8f382b split out Utility.InodeCache 2013-02-14 16:17:40 -04:00
Joey Hess
f40180f033 deal with Android's nonstandard shell location
This is so gratutious and pointless. It's a shame that everything we
learned about Unix portability and the importance of standards has been
thrown out the window by these guys.
2013-02-13 14:30:04 -04:00
Joey Hess
5737c49804 support Android's crippled lsof 2013-02-11 17:33:45 -04:00
Joey Hess
43b4b7d43a can now build Android targeted binary
Various things that don't work on Android are just ifdefed out.

* the webapp (needs template haskell for arm)
* --include and --exclude globbing (needs libpcre, which is not ported;
  probably I'll make it use the pure haskell glob library instead)
* annex.diskreserve checking (missing sys/statvfs.h)
* timestamp preservation support (yawn)
* S3
* WebDAV
* XMPP

The resulting 17mb binary has been tested on Android, and it is able to,
at least, print its usage message.
2013-02-10 15:48:38 -04:00
Joey Hess
981dbc02f5 cleanup 2013-01-28 11:32:30 +11:00
Joey Hess
d3d791c7e7 addurl --fast: Use curl, rather than haskell HTTP library, to support https. 2013-01-27 09:30:53 +11:00
Joey Hess
88df952243 Deal with incompatability in gpg2, which caused prompts for encryption passphrases rather than using the supplied --passphrase-fd. 2013-01-16 15:27:46 -04:00
Joey Hess
e15cca7db8 webapp: Now has a page to view the log, accessed from the control menu. 2013-01-15 13:52:35 -04:00
Joey Hess
d7ca6fb856 webapp: Now always logs to .git/annex/daemon.log
It used to not log to daemon.log when a repository was first created, and
when starting the webapp. Now both do. Redirecting stdout and stderr to the
log is tricky when starting the webapp, because the web browser may want to
communicate with the user. (Either a console web browser, or web.browser = echo)
This is handled by restoring the original fds when running the browser.
2013-01-15 13:34:59 -04:00
Joey Hess
6f7ae84650 webapp: Use IP address, rather than localhost
since some systems may have configuration problems or other issues that
prevent web browsers from connecting to the right localhost IP for the
webapp.

Tested on both ipv4 and ipv6 localhost. Url for the latter looks like:
http://[::1]:50676
2013-01-09 23:18:00 -04:00
Joey Hess
13d2fffb2d assistant: Detect when system is not configured with a user name, and set environment to prevent git from failing. 2013-01-06 13:34:08 -04:00
Joey Hess
bad9b6761d restart UI
Browser behavior is not ideal; a new tab is opened on restart.
Browsers won't let me redirect to a file:// so I cannot use the old tab.
2013-01-03 18:50:30 -04:00
Joey Hess
8cc27b8afc avoid double commits with inotify when direct mode file is created 2012-12-29 14:58:13 -04:00
Joey Hess
94d735c12a fix fsevents rename handling
For both files and whole directories; also tested on moving whole dirs out
of and into the working copy.
2012-12-28 16:20:05 -04:00
Joey Hess
6e4ec17da4 ignore events generated by us in fsevents
This avoids some churn.
2012-12-28 16:05:33 -04:00
Joey Hess
69247ebd28 startup scan for FSEvents 2012-12-27 15:46:37 -04:00
Joey Hess
bd31a9fbd1 fsevents bugfix for symlinks 2012-12-27 15:35:35 -04:00
Joey Hess
7af958d92c OSX FSEvents support
Needs work to deal with directory renames better; otherwise seems to
basically work.
2012-12-27 15:22:29 -04:00
Joey Hess
3ef0ac2fa5 refactor 2012-12-19 23:13:50 -04:00
Joey Hess
3b54c1d3e4 kqueue: Fix bug that made broken symlinks not be noticed. 2012-12-14 16:28:27 -04:00
Joey Hess
82617b92e9 move thirdparty program installation for standalone bundle into haskell program
This allows it to use Build.SysConfig to always install the programs
configure detected. Amoung other fixes, this ensures the right uuid
generator and checksum programs are installed.

I also cleaned up the handling of lsof's path; configure now checks for
it in PATH, but falls back to looking for it in sbin directories.
2012-12-14 16:07:59 -04:00
Joey Hess
0d50a6105b whitespace fixes 2012-12-13 00:45:27 -04:00
Joey Hess
f87a781aa6 finished where indentation changes 2012-12-13 00:24:19 -04:00
Joey Hess
99a8a5297c --auto fixes
* get/copy --auto: Transfer data even if it would exceed numcopies,
  when preferred content settings want it.
* drop --auto: Fix dropping content when there are no preferred content
  settings.
2012-12-06 13:22:16 -04:00
Joey Hess
d56a5c9996 export function to avoid 2 warnings 2012-11-29 18:40:25 -04:00
Joey Hess
e6e7f45716 fix "daemon is already running" message display
Display it before daemon forks, so it's not shown after the shell prompt
returns.
2012-11-29 15:44:46 -04:00
Joey Hess
2525fefbb9 The standalone builds now unset their special path and library path variables before running the system web browser.
Should fix a crash reported on OSX.
2012-11-27 17:05:29 -04:00
Joey Hess
44a7387eba Fix dirContentsRecursive, which had missed some files in deeply nested subdirectories. Could affect various parts of git-annex. 2012-11-26 16:45:55 -04:00
Joey Hess
907d25cb32 squelch warning 2012-11-26 16:29:05 -04:00
Joey Hess
5f3661238d Display a warning when a non-existing file or directory is specified. 2012-11-25 17:54:08 -04:00
Joey Hess
606c210378 progress bars for glacier uploads 2012-11-25 13:27:20 -04:00
Joey Hess
afa2f9c967 upload progress bars for webdav! 2012-11-18 20:30:05 -04:00
Joey Hess
81379bb29c better streaming while encrypting/decrypting
Both the directory and webdav special remotes used to have to buffer
the whole file contents before it could be decrypted, as they read
from chunks. Now the chunks are streamed through gpg with no buffering.
2012-11-18 15:27:44 -04:00
Joey Hess
a9633d3e70 fix warning 2012-11-17 16:19:42 -04:00
Joey Hess
d3766803b4 OSX: Fix RunAtLoad value in plist file. 2012-11-15 01:01:54 -04:00
Joey Hess
98d45cd383 use System.Timeout
I'd forgotten this existed!
2012-11-14 11:53:23 -04:00
Joey Hess
8a89575526 where indentation 2012-11-12 17:43:10 -04:00
Joey Hess
7c30be0e8c use cabal macro to detect if old version of network is being used 2012-11-11 18:05:01 -04:00
Joey Hess
b312e54ba7 added a runTimeout function
This adds a dep on haskell's async library, but since that's been
added to the recent haskell platform release, it should not be
much hardship to my poor long-suffering library chasing users.
2012-11-11 13:38:08 -04:00
Joey Hess
82ccb385e3 use xmpp::user@host for xmpp remotes
Inject the required git-remote-xmpp into PATH when running xmpp git push.
Rest of the time it will not be in PATH, and git won't be able to talk to
xmpp remotes.
2012-11-09 13:35:23 -04:00
Joey Hess
3af1984ed2 fix warning seen on OSX, apparently something there defines a close 2012-11-07 14:56:32 -04:00
Joey Hess
fd1824c3f7 cleanup 2012-11-06 15:58:35 -04:00
Joey Hess
359f386ad6 switch to new URI version by default, -DWITH_OLD_URI for old 2012-11-03 12:10:01 -04:00
Joey Hess
ec7a51727a pasto 2012-11-02 12:48:52 -04:00
Joey Hess
21d8f96679 give <&&> and <||> same fixity as && and ||
Suggestion by Daniel Trstenjak

These are not currently mixed in my code base, so no real change.
2012-11-02 11:20:55 -04:00
Joey Hess
60fba9097a don't test host in configure
That'll fail when building offline.
2012-10-30 19:28:46 -04:00
Joey Hess
4f763e52be build fix 2012-10-29 13:12:39 -04:00
Joey Hess
dd63cbb7bc allow WITH_HOST setting too 2012-10-28 21:21:01 -04:00
Joey Hess
9173c66e40 support using haskell-dns for SRV lookups
This library should be easier to install than ADNS, so I've made it
be used by default.
2012-10-28 19:14:30 -04:00
Joey Hess
9767562f65 rsync special remote: Include annex-rsync-options when running rsync to test a key's presence.
Also, use the new withQuietOutput function to avoid running the shell to
/dev/null stderr in two other places.
2012-10-28 13:51:14 -04:00
Joey Hess
2dc40ecbd1 reconnect XMPP when NetWatcher notices a change 2012-10-27 00:42:14 -04:00
Joey Hess
d1e5f2d596 Merge branch 'master' into xmpp
Conflicts:
	Assistant/Threads/NetWatcher.hs
2012-10-26 19:42:24 -04:00
Joey Hess
8e4620a6c7 NetWatcher: When dbus connection is lost, try to reconnect.
MountWatcher can't do this, because it uses the session dbus,
and won't have access to the new DBUS_SESSION_BUS_ADDRESS if a new session
is started.

Bumped dbus library version, FD leak in it is fixed.
2012-10-26 19:38:27 -04:00
Joey Hess
07494cbb4b XMPP configuration form
Currently relies on SRV being set, or the JID's hostname being the server
hostname and the port being default. Future work: Allow manual
configuration of user name, hostname, and port.
2012-10-26 14:17:09 -04:00
Joey Hess
a11fb94c65 SRV record construction 2012-10-26 13:03:08 -04:00
Joey Hess
8916ff1a6c hook up SRV lookups for XMPP 2012-10-26 12:55:29 -04:00
Joey Hess
0b1cf3a766 Merge branch 'master' into xmpp
Conflicts:
	Assistant/Threads/MountWatcher.hs
	Assistant/Threads/NetWatcher.hs
2012-10-26 00:10:41 -04:00
Joey Hess
ef7b53e784 improved dbus error handling
Now when the dbus connection is dropped, it'll fall back to polling.

I could make it try to reconnect, but there's a FD leak in the dbus
library, so not yet.
2012-10-26 00:02:03 -04:00
Joey Hess
7ee0ffaeb9 Use USER and HOME environment when set, and only fall back to getpwent, which doesn't work with LDAP or NIS. 2012-10-25 18:17:54 -04:00
Joey Hess
d23aea28eb add the SRV library, forgot to add 2012-10-25 17:56:03 -04:00
Joey Hess
9856641ef1 deal with mtl/monads-tf conflict
I had been using -ignore-package monads-tf to deal with this, but
the XMPP library uses monads-tf, so that also ignores it. Instead,
use PackageImports to force use of mtl in my own code.
2012-10-24 14:43:32 -04:00
Joey Hess
62f50b2052 file:/// URLs can now be used with the web special remote. 2012-10-21 01:28:10 -04:00
Joey Hess
14b376d440 Merge branch 'safesemaphore'
Conflicts:
	debian/changelog
	git-annex.cabal
2012-10-20 12:44:25 -04:00
Joey Hess
919fec85cd better fix for zombie problem, which turns out to be a zombie ssh started by rsync
When rsyncProgress pipes rsync's stdout, this turns out to cause a ssh
process started by rsync to be left behind as a zombie. I don't know why,
but my recent zombie reaping cleanup was correct, it's just that this other
zombie, that's not directly started by git-annex, was no longer reaped
due to changes in the cleanup. Make rsyncProgress reap the zombie started
by rsync, as a workaround.

FWIW, the process tree looks like this. It seems like the rsync child
is for some reason starting but not waiting on this extra ssh process.
Ssh connection caching may be involved -- disabling it seemed to change
the shape of the tree, but did not eliminate the zombie.

 9378 pts/14   S+     0:00  |           \_ rsync -p --progress --inplace -4 -e 'ssh' '-S' ...
 9379 pts/14   S+     0:00  |           |   \_ ssh ...
 9380 pts/14   S+     0:00  |           |   \_ rsync -p --progress --inplace -4 -e 'ssh' '-S' ...
 9381 pts/14   Z+     0:00  |           \_ [ssh] <defunct>
2012-10-17 00:47:52 -04:00
Joey Hess
1da89079f2 cleanup 2012-10-16 16:58:04 -04:00
Joey Hess
634b870240 releasing version 3.20121016 2012-10-16 16:47:59 -04:00
Joey Hess
509692847a remove unused function 2012-10-16 15:39:21 -04:00
Joey Hess
5513e71723 avoid partial !! in gpg list-keys parser 2012-10-16 01:43:54 -04:00
Joey Hess
d430fb1153 Bug fix: A recent change caused git-annex-shell to crash. 2012-10-15 22:22:40 -04:00
Joey Hess
c78975babb avoid duplicate code with a more generic monadic matcher
Interesting type signature ghc derived for this:
forall o (m :: * -> *). Monad m => Matcher o -> (o -> m Bool) -> m Bool
2012-10-13 15:17:15 -04:00
Joey Hess
e05c21cb73 Fix a crash when merging files in the git-annex branch that contain invalid utf8.
The crash actually occurred when writing out the file, which was done to a
handle that had not had fileSystemEncoding applied to it.
2012-10-12 12:19:30 -04:00
Joey Hess
f96725a292 remove env display from debugging
TMI when full env is passed in and modified..
2012-10-11 13:00:52 -04:00
Joey Hess
8fcb84dd2f deal with incompatable api change in network 2.4.0.1
On the cabal side, let's just require this new version, and set -DURI_24
to enable the code using it.
2012-10-10 11:26:30 -04:00
Joey Hess
71fd18a97f wired preferred content up to get, copy, and drop --auto 2012-10-08 13:16:53 -04:00
Joey Hess
18c9de5e14 Merge branch 'master' into safesemaphore
Conflicts:
	debian/changelog
2012-10-07 17:36:58 -04:00
Joey Hess
6cad247c5f look for sysctl in some common sbin locations when it's not in PATH 2012-10-06 16:16:31 -04:00
Ben Gamari
7fc4ee0dee NotificationBroadcaster: Use SampleVars from SafeSemaphores instead of base
SampleVars from base are unsafe
2012-10-05 17:04:46 -04:00
Joey Hess
f67b54e5e3 make a pipeReadStrict, that properly waits on the process
Nearly everything that's reading from git is operating on a small
amount of output and has been switched to use that. Only pipeNullSplit
stuff continues using the lazy version that yields zombies.
2012-10-04 18:04:09 -04:00
Joey Hess
bc649a35ba added preferred-content log, and allow editing it with vicfg
This includes a full parser for the boolean expressions in the log,
that compiles them into Matchers. Those matchers are not used yet.

A complication is that matching against an expression should never
crash git-annex with an error. Instead, vicfg checks that the expressions
parse. If a bad expression (or an expression understood by some future
git-annex version) gets into the log, it'll be ignored.

Most of the code in Limit couldn't fail anyway, but I did have to make
limitCopies check its parameter first, and return an error if it's bad,
rather than erroring at runtime.
2012-10-04 16:00:19 -04:00
Joey Hess
613e747d91 bring back default SIGINT handler
This seems to fix a problem I've recently seen where ctrl-c during rsync
leads to `git annex get` moving on to the next thing rather than exiting.

Seems likely that started happening with the switch to System.Process
(d1da9cf221), as the old code took care
to install a default SIGINT handler.

Note that since the bug was only occurring sometimes, I am not 100% sure
I've squashed it, although I seem to have.
2012-10-01 23:01:29 -04:00
Joey Hess
0ccfb3bbb2 let's not -DOSX, that results in unwanted mangling 2012-09-29 14:49:15 -04:00
Joey Hess
364ae8317d kqueue bugfix: apply pruner to changed files
It already applied the pruner when traversing directories, so .git is
excluded, but .gitignore was not. Now it is.
2012-09-28 17:31:54 -04:00
Joey Hess
fe3009d83b retry bind
This is a workaround for bind failing with EINVAL sometimes on OSX.
I don't know why; EVINAL should mean the socket is already bound to an
address, but this is with a new socket.
2012-09-27 12:23:27 -04:00
Joey Hess
3da78cc241 make the standalone OSX app automatically install itself when run 2012-09-26 16:50:04 -04:00
Joey Hess
926ffaf3f3 Fix fallback to ~/Desktop when xdg-user-dir is not available. Closes: #688833
Really the fix here is to make Utility.Process only throw IOErrors,
which is what I naturally assumed it'd throw.
2012-09-25 22:48:17 -04:00
Joey Hess
f0e0d17440 New --time-limit option, makes long git-annex commands stop after a specified amount of time. 2012-09-25 16:48:24 -04:00
Joey Hess
1233417698 move sticky bit code into Utility.FileMode
Simplified it using existing functions.

I doubt setSticky needs to return the FileMode; if it does for some
reason, it can be changed to use modifyFileMode'

Converted isSticky to a pure function for consistency with isSymlink.
Note that the sticky bit of a file can be tested thus:
  isSticky . fileMode <$> getFileStatus file
2012-09-25 13:33:13 -04:00
Joey Hess
c048add74d hooked up git-annex-shell transferinfo
Finally done with progressbars!
2012-09-21 23:25:06 -04:00
Joey Hess
99e62f2bb8 avoid calling the progress callback when the bytes sent have not changed
Does rsync stall and update its progress display? Dunno, but this was an
easy optimisation to throw in.
2012-09-20 17:30:38 -04:00
Joey Hess
68ad7de4d0 watch for changes to transfer info files, to update progress bars on upload
This is handled differently for inotify, which can track modifications of
existing files, and kqueue, which cannot (TTBOMK). On the inotify side,
the TransferWatcher just waits for the file to be updated and reads the new
bytesComplete. On the kqueue side, the TransferPoller has to re-read the
file every update (currently 0.5 seconds, might need to increase that).

I did think about working around kqueue's limitations by somehow creating
a new file each time the size changed. But cleaning up all the files that
would result seemed difficult. And really, this is not a lot worse than
the TransferWatcher's behavior for downloads, which stats a file every 0.5
seconds. As long as the OS has decent file caching behavior..
2012-09-20 17:24:40 -04:00
Joey Hess
a6504e4192 optimised rsync output reader to read whole blocks at a time 2012-09-20 16:01:31 -04:00
Joey Hess
66d092dc7c update 2012-09-20 13:46:07 -04:00
Joey Hess
77938a7d62 better parameter name 2012-09-19 17:10:13 -04:00
Joey Hess
e1037adebc rsync progress interception
Current implementation parses rsync's output a character a time, which
is hardly efficient. It could be sped up a lot by using hGetBufSome,
but that would require going really lowlevel, down to raw C style buffers
(good example of that here: http://users.aber.ac.uk/afc/stricthaskell.html)
But rsync doesn't output very much, so currently it seems ok.
2012-09-19 16:55:08 -04:00
Joey Hess
3c81d70c1b parser for rsync progress output 2012-09-19 15:23:59 -04:00
Joey Hess
45a26175d6 renamed RsyncFile -> Rsync 2012-09-19 14:28:32 -04:00
Joey Hess
467844d7d3 prefer ipv4 localhost when both are available
The webapp can only run on one of ipv4 and ipv6, no both. Some web browsers
may not support ipv6, so ipv4 is the safe choice.

The actual problem I ran into with it only listening to ipv6 was that
Utility.Url.exists was failing to connect to it. I doubt that haskell's
HTTP library is ipv4 only. More likely, it was only trying one address,
and tried ipv4 first.
2012-09-18 17:19:41 -04:00
Joey Hess
e8188ea611 flip catchDefaultIO 2012-09-17 00:18:07 -04:00
Joey Hess
0b63ee6cd5 run git coprocesses with gitEnv 2012-09-15 17:43:37 -04:00
Joey Hess
60c31afc38 add decodeW8 2012-09-13 19:14:29 -04:00
Joey Hess
c20d6f4189 responding to pair requests *almost* works 2012-09-10 17:53:51 -04:00
Joey Hess
f61531a26b add withTempDir 2012-09-10 14:09:13 -04:00
Joey Hess
c6f3c410d4 fix gpg pipeline stall
Bug introduced in d1da9cf221, where
I removed a forkProcess when feeding gpg. Feeding it from a thread
solves the bug.
2012-09-09 13:11:54 -04:00
Joey Hess
0c01348b65 pairing passphrase entry form, validation, etc
Actually 3 forms in one, this handles the initial passphrase entry, and the
confirmation, and also varys wording if the same user or a different user
is confirming.
2012-09-08 02:02:39 -04:00
Joey Hess
92df8250fa broke out Verifiable to a utility library, and added a quickcheck test 2012-09-07 23:23:52 -04:00
Joey Hess
faf3faa79d import yesod qualified
To avoid conflict with different liftIO from MonadIO (in some version of
yesod not the one I have here), and because it's generally clearer, since
this module has both Wai and Yesod stuff, to qualify them both.
2012-08-30 13:05:39 -04:00
Joey Hess
c9b3b8829d thread safe git-annex index file use 2012-08-24 20:50:39 -04:00
Joey Hess
5a68acb521 add NetWatcher thread
This deals with interruptions in network connectevity, by listening
for a new network interface coming up (using dbus to see when
network-manager or wicd do it), and forcing a rescan of
2012-08-21 19:58:53 -04:00
Joey Hess
dcd208513d Merge branch 'master' into assistant
Conflicts:
	debian/changelog
2012-08-17 08:22:43 -07:00
Joey Hess
fe8fee235b Pass --use-agent to gpg when in no tty mode. Thanks, Eskild Hustvedt. 2012-08-17 08:22:11 -07:00
Joey Hess
be310ac4d0 support building with yesod-default 1.1.0
Old 1.0.1 version is still supported as well. Cabal autodetects
which version is available, but in the Makefile, WITH_OLD_YESOD
has to be configured appropriately.

I have not squashed all the $newline warnings with the new Yesod.
They should go away eventually anyway as Yesod moves past that transition.
2012-08-09 13:33:04 -04:00
Joey Hess
e0cd977669 make pid file directory 2012-08-08 14:18:02 -04:00
Joey Hess
7e2d07484f Merge branch 'master' into assistant 2012-08-07 13:31:43 -04:00
Joey Hess
467669f00e update 2012-08-07 13:12:08 -04:00
Joey Hess
96d0a36f85 move comment 2012-08-07 11:10:41 -04:00
Joey Hess
40e9402fa5 add 2012-08-06 14:48:38 -04:00
Joey Hess
ac71ab7bd7 avoid head 2012-08-05 15:10:26 -04:00
Joey Hess
fd61354431 add 2012-08-05 14:50:00 -04:00
Joey Hess
e125ce74b8 work toward adding new repos on removable drives
This actually does add a new repo, but it doesn't yet set up
remotes, or sync to it.
2012-08-04 18:17:16 -04:00
Joey Hess
13a7362a1a fix xdg desktop dir lookup code
had to use xdg-user-dir to query it, since it's in a shell format file.
Fall back to
2012-08-02 23:51:38 -04:00
Joey Hess
9a038b4a9b better ~/ handling 2012-08-02 07:50:13 -04:00
Joey Hess
adf5789c1b fix bugs, add desktop dir 2012-08-02 07:47:20 -04:00
Joey Hess
60da0d6ad2 full autostart support
git annex assistant --autostart will start separate daemons in each
listed autostart repo

running the webapp outside any git-annex repo will open it on the
first listed autostart repo
2012-08-02 00:42:33 -04:00
Joey Hess
23fe661d37 install autostart file too 2012-08-01 23:31:53 -04:00
Joey Hess
9422e27489 installing desktop file working
Not hooked up to either Makefile or cabal yet
2012-08-01 20:49:02 -04:00
Joey Hess
89ec253a6a implement enough of the fdo specs to be able to write desktop menu files
to the appropriate system or local user directory
2012-08-01 20:27:45 -04:00
Joey Hess
8181b38ef6 write pid file even when running in foreground
This prevents multiple runs of the assistant in the foreground, and lets
--stop stop foregrounded runs too.

The webapp firstrun case also now writes a pid file, once it's made the git
repo to put it in.
2012-08-01 16:30:53 -04:00
Joey Hess
40c9973675 fix push status, broken when inParallel was adapted for -threaded
Before pushing ran in its own process, so exitSuccess was the right thing
to do, but with the threaded code, that's caught as an exception.
2012-07-30 11:52:44 -04:00
Joey Hess
d62b157194 better ordering of alerts 2012-07-29 19:05:51 -04:00
Joey Hess
ea05ba893c fix the auto token leak on auth error page issue permanantly 2012-07-29 12:12:14 -04:00
Joey Hess
6a9abf6526 add NotificationID to StatusR, and use it to block 2012-07-28 21:21:22 -04:00
Joey Hess
5be5cb219f add derives needed for use with Yesod, and fix a bug 2012-07-28 21:11:40 -04:00
Joey Hess
109dc122da add a newtype 2012-07-28 20:30:46 -04:00
Joey Hess
a17fde22fa add a NotificationBroadcaster to DaemonStatus
First use of it is to make the status checkpointer thread block until
there is really a change to the status.
2012-07-28 16:09:34 -04:00
Joey Hess
ca478b7bcb Focus today was writing a notification broadcaster.
This is a way to send a notification to a set of clients, any of which can be
blocked waiting for a new notification to arrive. A complication is that any
number of clients may be be dead, and we don't want stale notifications for
those clients to pile up and leak memory.

It took me 3 tries to find the solution, which turns out to be simple: An array
of SampleVars, one per client. Using SampleVars means that clients only see the
most recent notification, but when the notification is just "the assistant's
state changed somehow; display a refreshed rendering of it", that's sufficient.
2012-07-28 15:41:49 -04:00
Joey Hess
02ec8ea012 much better webapp startup of the assistant
This avoids forking another process, avoids polling, fixes a race,
and avoids a rare forkProcess thread hang that I saw once time
when starting the webapp.
2012-07-27 15:33:24 -04:00
Joey Hess
c93b546ebd remove bogus AI_NUMERICSERV
Not needed, and causes a segfault on OSX when it tries to dereference the
NULL servicename. (Linux handles this case better.)
2012-07-27 14:06:06 -04:00
Joey Hess
615dc09ffc use widgetFile 2012-07-26 22:54:31 -04:00
Joey Hess
9fd03c65f9 webapp now does long polling
The webapp is now a constantly updating clock! I accomplished this amazing
feat using "long polling", with some jquery and a little custom java
script.

There are more modern techniques, but this one works everywhere.
2012-07-26 17:56:24 -04:00
Joey Hess
2f775ef3e3 fix OSX open call 2012-07-26 12:59:40 -04:00
Joey Hess
95f4b192f0 on second thought, the session cookie is still useful to support setMessage 2012-07-26 12:41:20 -04:00
Joey Hess
cccdb44874 git annex webapp --force forces a restart of the daemon
Useful for testing..
2012-07-26 11:52:49 -04:00
Joey Hess
6cecc26206 update build deps 2012-07-26 05:13:27 -04:00
Joey Hess
9d6b59d0e2 use the secret token for authentication, and add to all dynamic urls 2012-07-26 04:50:09 -04:00
Joey Hess
b36804d648 generate random token and launch webapp using it 2012-07-26 03:38:20 -04:00
Joey Hess
3ac2cf09e5 added a custom defaultLayout, static site, and favicon
Broke hamlet out into standalone files.

I don't like the favicon display; it should be served from /favicon.ico,
but I could only get the static site to serve /static/favicon.ico, so
I had to use a <link rel=icon> to pull it in. I looked at
Yesod.Default.Handlers.getFaviconR, but it doesn't seem to embed
the favicon into the binary?
2012-07-26 02:45:01 -04:00
Joey Hess
1ffef3ad75 git annex webapp now opens a browser to the webapp
Also, starts the assistant if it wasn't already running.
2012-07-25 23:13:01 -04:00
Joey Hess
32d3cffc4c run yesod, and launch webapp on startup 2012-07-25 21:26:13 -04:00
Joey Hess
4ec9244f1a add a path field to remotes
Also broke out some helper functions around constructing remotes,
to be used later.
2012-07-22 14:30:43 -04:00
Joey Hess
f6d4786b86 left unsafe imports here; added a comment with a rationalle 2012-07-20 15:07:48 -04:00
Joey Hess
9d26b532ab use safe FFI imports for diskfree
There's a minor performance overhead to doing this, but this way I don't
have to worry about a situation where statfs might block for a long time.
For example, when it's on a network filesystem.
2012-07-20 15:03:58 -04:00
Joey Hess
da4c506d61 use safe FFI imports
This avoids blocking all threads when calling waitchange_kqueue,
which blocks.
2012-07-20 15:03:24 -04:00
Joey Hess
0496a3971d store whole Mntents
This way, if a mount point was already mounted, but something else
gets mounted there, it'll be seen as a new mount.
2012-07-19 21:25:26 -04:00
Joey Hess
ac044de486 cleanup 2012-07-19 21:20:38 -04:00
Joey Hess
4bcc92abd7 now working on OSX
While this seems to work fine when used in a simple program,
when I load it in ghci, it segfaults about half the time. Don't know why,
and seems ghci specific, but if I get reports of crashes, I'll need to look
into that.
2012-07-19 21:19:29 -04:00
Joey Hess
f768cddf3a fix build on OSX 2012-07-19 20:44:58 -04:00
Joey Hess
107a7b9388 try to make Utility.Mounts portable
This is an unholy mashup, but it just might work. It works on Linux,
that's all I've tested. :)
2012-07-19 20:38:58 -04:00
Joey Hess
e2c86a4b58 extacted Mounts.hsc from hsshellscript
Converted from using c2hs to using hsc2hs, just because other code
in git-annex uses hsc2hs.

Various cleanups.

This code is LGPLed, so I had to include that licence.
2012-07-19 12:53:39 -04:00
Joey Hess
1e0b7dda8c foo 2012-07-19 01:02:22 -04:00
Joey Hess
9fc94d780b better readProcess 2012-07-19 00:57:40 -04:00
Joey Hess
1db7d27a45 add back debug logging
Make Utility.Process wrap the parts of System.Process that I use,
and add debug logging to them.

Also wrote some higher-level code that allows running an action
with handles to a processes stdin or stdout (or both), and checking
its exit status, all in a single function call.

As a bonus, the debug logging now indicates whether the process
is being run to read from it, feed it data, chat with it (writing and
reading), or just call it for its side effect.
2012-07-19 00:46:52 -04:00
Joey Hess
2edb5d145c rewrote to not use forkProcess
That can make the threaded runtime stall.. But it can use threads now!
2012-07-18 19:25:46 -04:00
Joey Hess
f520a2c103 add missing imports 2012-07-18 18:29:33 -04:00
Joey Hess
f2ed3d6c8e Merge branch 'threaded' into assistant 2012-07-18 18:17:33 -04:00
Joey Hess
d1da9cf221 switch from System.Cmd.Utils to System.Process
Test suite now passes with -threaded!

I traced back all the hangs with -threaded to System.Cmd.Utils. It seems
it's just crappy/unsafe/outdated, and should not be used. System.Process
seems to be the cool new thing, so converted all the code to use it
instead.

In the process, --debug stopped printing commands it runs. I may try to
bring that back later.

Note that even SafeSystem was switched to use System.Process. Since that
was a modified version of code from System.Cmd.Utils, it needed to be
converted too. I also got rid of nearly all calls to forkProcess,
and all calls to executeFile, which I'm also doubtful about working
well with -threaded.
2012-07-18 18:00:24 -04:00
Joey Hess
05310538ef more debugging 2012-07-18 13:31:00 -04:00
Joey Hess
fb85d8e563 cleanup 2012-07-17 18:36:51 -04:00
Joey Hess
62a35162a0 bugfix 2012-07-17 18:35:56 -04:00
Joey Hess
32ac773934 kqueue: properly call delHook for file deletion, not delDirHook 2012-07-17 18:32:55 -04:00
Joey Hess
30ac6d7be0 robustness fix
Don't fall over symlinks, and avoid crashing if the file goes away.
2012-07-17 16:29:49 -04:00
Joey Hess
7d89cf0eb9 cleanup 2012-07-17 16:02:29 -04:00
Joey Hess
e816776a62 add inodes to kqueue's directory cache
This is necessary to generate events when a file is deleted and immediately
replaced. Otherwise, the cache will have the old file, and so no event
would be generated.

Use of getFileStatus is suboptimal, it would be faster to use
the inode returned by readdir -- but getDirectoryContents does not expose
it, so I'd have to copy and modify a lot of low-level code.
2012-07-17 15:57:49 -04:00
Joey Hess
182526ff68 add debugging 2012-07-17 14:40:05 -04:00
Joey Hess
3ea708e03b Merge branch 'master' into assistant 2012-07-02 15:45:20 -04:00
Joey Hess
7daa269853 better pid file locking code 2012-07-02 13:47:32 -04:00
Joey Hess
74f0d67aa3 avoid untrappable exception if dirContentsRecursive is run on a directory
that doesn't exist, or cannot be read

The problem is its use of unsafeInterleaveIO, which causes its IO code
to run when the thunk is forced, outside any exception trapping the caller
may do.
2012-07-02 10:56:26 -04:00
Joey Hess
bea0ac0274 record transfers for git-annex-shell
Not yet tested and places git-annex-shell is run need to be modified to
pass the new field settings.

Note that rsyncServerSend was changed to fork, rather than directly exec
rsync, because it needs to keep the transfer lock held, and clean up the
transfer log when done.
2012-07-02 01:31:10 -04:00
Joey Hess
d1f49b0ad0 add fields to git-annex-shell 2012-07-02 00:53:00 -04:00
Joey Hess
7625319c2c Merge branch 'master' into assistant 2012-07-01 21:00:43 -04:00
Joey Hess
29335bf326 pointlessness 2012-06-29 10:00:05 -04:00
Joey Hess
638a321ca5 typo 2012-06-28 14:15:49 -04:00
Joey Hess
421f9ce0e2 fix kqueue build 2012-06-28 14:13:15 -04:00
Joey Hess
4888c5b042 improve thread termination handling
The reason the DirWatcher had to wait for program termination was because
it used withINotify, so when it finished, its watcher threads were killed.
But since I have two DirWatcher threads now, that was not good, and could
perhaps explain the MVar problem I saw yesterday. In any case, fixed this
part of the code by making the DirWatcher return a handle that can be used
to stop it, and now the main Assistant thread is the only one calling
waitForTermination.
2012-06-28 13:37:03 -04:00
Joey Hess
67c8ef7de2 use a TMVar
SampleMVar won't work; between getting the current value and changing
it, another thread could made a change, which would get lost.

TMVar works well; this update situation is handled by atomic transactions.
2012-06-26 19:21:44 -04:00
Joey Hess
5cfe91f06d add a push retry thread 2012-06-25 16:38:12 -04:00
Joey Hess
a71e7161fc golfing 2012-06-23 01:33:10 -04:00
Joey Hess
e699ce1841 added a merger thread
Wow! I can create a file in repo a, and it instantly* shows up in repo b!

* under 1 second anyway
2012-06-22 17:01:08 -04:00
Joey Hess
e9630e90de the syncer now pushes out changes to remotes, in parallel
Note that, since this always pushes branch synced/master to the remote, it
assumes that master has already gotten all the commits that are on the
remote merged in. Otherwise, fast-forward prevention may prevent the push.

That's probably ok, because the next stage is to automatically detect
incoming pushes and merge.
2012-06-22 15:49:48 -04:00
Joey Hess
28e28bc043 stub syncer thread and commit channel 2012-06-22 14:10:25 -04:00
Joey Hess
ad11de94e5 typo 2012-06-20 15:53:56 -04:00
Joey Hess
483b1b08c6 Merge branch 'master' into watch 2012-06-20 13:15:59 -04:00
Joey Hess
75b6ee81f9 avoid ByteString.Char8 where not needed
Its truncation behavior is a red flag, so avoid using it in these places
where only raw ByteStrings are used, without looking at the data inside.
2012-06-20 13:13:40 -04:00
Joey Hess
ee2acd474f [Word8] to filesystem encoded String
My, GHC makes this hard.
2012-06-20 12:51:25 -04:00
Joey Hess
5580af5789 add closingTracked flag 2012-06-19 10:22:36 -04:00
Joey Hess
e68b3c99f4 kqueue synthetic add events on startup 2012-06-19 10:08:06 -04:00
Joey Hess
2a61df23e7 kqueue recursive directory adding 2012-06-19 09:56:03 -04:00
Joey Hess
4ab9449cee add eventsCoalesce 2012-06-19 02:23:45 -04:00
Joey Hess
fd3e945932 fix prototype 2012-06-19 01:57:19 -04:00
Joey Hess
03b9341356 fix scheduling
Handle kevent interruptions in the haskell code, so it can yield to other threads
2012-06-19 04:52:55 +00:00
Joey Hess
02e9fdb0a5 kqueue build fix
new event dispatch seems a bit broken though
2012-06-19 04:07:48 +00:00
Joey Hess
7a09d74319 lifted out the kqueue and inotify to a generic DirWatcher interface
Kqueue code for dispatching events is not tested and probably doesn't
build.
2012-06-18 23:49:07 -04:00
Joey Hess
e164553272 robustness fixes 2012-06-19 02:13:26 +00:00
Joey Hess
5e9fdac92f update kqueue when new directories are added 2012-06-18 21:46:04 -04:00
Joey Hess
2bfcc0b09c kqueue: add directory content tracking, and change determination
This *may* now return Add or Delete Changes as appropriate. All I know
for sure is that it compiles.

I had hoped to avoid maintaining my own state about the content of the
directory tree, and rely on git to check what was changed. But I can't;
I need to know about new and deleted subdirectories to add them to the
watch list, and git doesn't deal with (empty) directories.

So, wrote all the code to scan directories, remember their past contents,
compare with current contents, generate appropriate Change events, and
update bookkeeping info appropriately.
2012-06-18 21:29:30 -04:00
Joey Hess
ae7d07ddcb close fds 2012-06-18 19:14:58 -04:00
Joey Hess
b141d9bcc8 retry interrupted kevent calls
Many thanks to geekosaur in #haskell for help with this.
2012-06-18 18:03:50 -04:00
Joey Hess
a11825a1f1 add test stub 2012-06-18 16:56:05 -04:00
Joey Hess
d680ff7ef0 kqueue code compiles on debian kfreebsd 2012-06-18 16:34:08 -04:00
Joey Hess
90d565149a flesh out kqueue library
Have not tried to build this yet. But barring minor mistakes, I think it's
good.
2012-06-18 16:18:59 -04:00
Joey Hess
89fcee03d0 add some utility functions for later
Will need to update the DirMap to add or remove subdirs.
2012-06-18 13:22:36 -04:00
Joey Hess
a39b73d118 recurse dirTree and open the directories for kqueue to watch 2012-06-18 13:01:58 -04:00
Joey Hess
dc3d9d1e98 added dirTree 2012-06-18 12:53:57 -04:00
Joey Hess
3c8a9043b6 skeleton C library for calling kqueue 2012-06-18 12:25:20 -04:00
Joey Hess
66344a3613 Enable diskfree on kfreebsd, using statvfs.
Could not reproduce the build failure I had seen related to this,
but the numbers were wrong with statfs64. Probably pulling from the wrong
place in the structure. statvfs seems to work..
2012-06-17 18:10:57 -04:00
Joey Hess
e84b78f40c reorg 2012-06-17 14:02:40 -04:00
Joey Hess
0052cec2b7 add lsof build deps
Check for it in configure; and add a --force option for people without it
who want to live dangerously.
2012-06-15 23:29:39 -04:00
Joey Hess
bb6074dfea work around a wrinkle in how lsof handles hard links to files that are open elsewhere
+d is probably more expensive, but I need it
2012-06-15 22:34:42 -04:00
Joey Hess
d91950ecba cleanup 2012-06-15 22:16:13 -04:00
Joey Hess
96ac25094b fix pid file writing
need to truncate, or part of previous longer pid may be left after writing
2012-06-15 20:42:53 -04:00
Joey Hess
85db1720e9 add lsof interface
Uses lsof -F0 to get machine-readable output
2012-06-15 15:13:31 -04:00
Joey Hess
4b2b5e820e add 2012-06-15 14:11:09 -04:00
Joey Hess
36d73b0017 slightly higher-level thread scheduling code
Including support for unbound thread sleeping. Haskell's max thread sleep
is 37 minutes, due to maxBound Int!
2012-06-13 17:53:19 -04:00
Joey Hess
12dbb9d1d0 plumb file status through to event handlers
The idea, not yet done, is to use this to detect when a file
has an old change time, and avoid expensive restaging of the file.

If git-annex watch keeps track of the last time it finished a full scan,
then any symlink that is older than that time must have been scanned
before, so need not be added. (Relying on moving, copying, etc of a file
all updating its change time.)

Anyway, this info is available for free since inotify already checks it,
so it might as well make it available.
2012-06-13 01:20:37 -04:00
Joey Hess
b240418acc better optimisation of add check
Now really only done in the startup scan.

It turns out to be quite hard for event handlers to know when the startup
scan is complete. I tried to make addWatch pass that info, but found
threading the state very difficult. For now, a quick hack, using the fast
flag.

Note that it's actually possible for inotify events to come in while the
startup scan is still ongoing. Due to my hack, the expensive check will
be done for files added in such inotify events.
2012-06-12 16:24:06 -04:00
Joey Hess
7d2c813396 fix bug that turned files already in git into symlinks
This requires a relatively expensive test at file add time to see if it's
in git already. But it can be optimised to only happen during the startup
scan.
2012-06-12 15:57:24 -04:00
Joey Hess
535d9e4998 add a flag indicating if an event was synthesized during initial dir scan 2012-06-12 14:34:09 -04:00
Joey Hess
942d8f7298 hlint 2012-06-12 11:32:06 -04:00
Joey Hess
433ff41496 bugfix 2012-06-11 02:06:22 -04:00
Joey Hess
d0a0a6ae21 git annex watch --stop 2012-06-11 02:01:20 -04:00
Joey Hess
8539a7bde8 fix pid file locking
Ok, that's odd.. opening it before fork breaks the locking.
I don't understand why.
2012-06-11 01:37:25 -04:00
Joey Hess
0b3e2bed78 add a pid file
Writes pid to a file. Is supposed to take an exclusive lock, but that's not
working, and it's too late for me to understand why.
2012-06-11 01:20:19 -04:00
Joey Hess
d5884388b0 daemonize git annex watch 2012-06-11 00:39:09 -04:00