Commit graph

334 commits

Author SHA1 Message Date
Joey Hess
19e35f7f0d upload progress bar for git remote on same filesystem
cp is used here, but we can just watch the size of the destination file

This commit made from within the ruins of an old mill, overlooking a
beautiful waterfall.
2012-09-20 13:35:53 -04:00
Joey Hess
45a26175d6 renamed RsyncFile -> Rsync 2012-09-19 14:28:32 -04:00
Joey Hess
355ef8f3ea add annex.delayadd configuration 2012-09-19 13:30:25 -04:00
Joey Hess
d50d89eb6f support old versions of git that do not have --allow-empty-message 2012-09-19 12:58:53 -04:00
Joey Hess
c4e8591351 add missing --no-verify to prevent the pre-commit hook's git annex fix 2012-09-19 12:48:32 -04:00
Joey Hess
18bae020ed make other repositories list list all autostarted repos
And add a form to add another, unrelated repository
2012-09-18 17:50:07 -04:00
Joey Hess
ba27483c6a avoid making empty commits
This doesn't avoid it sometimes attempting to commit when there are no
changes. Typically that happens when a change is pushed in from another
repo; the watcher sees the file and tries to stage it, resulting in an
empty commit. Really fixing that would probably use more CPU than
occasionally trying to make an empty commit.

However, this does save a lot of unnecessary work, as those empty commits
had to be synced out, which no longer happens.
2012-09-18 14:43:56 -04:00
Joey Hess
9f05d19108 avoid sending uploads right back to where the download came from
Just an optimisation.
2012-09-18 14:24:51 -04:00
Joey Hess
3a0cffcfed when a Download finishes, queue Uploads
This ensures file propigate takes place in situations such as: Usb drive A
is connected to B. A's master branch is already in sync with B, but it is
being used to sneakernet some files around, so B downloads those. There is no
master branch change, so C does not request these files. B needs to upload
the files it just downloaded on to C, etc.

My first try at this, I saw loops happen. B uploaded to C, which then
tried to upload back to B (because it had not received the updated
git-annex branch from B yet). B already had the file, but it still created
a transfer info file from the incoming transfer, and its watcher saw
that be removed, and tried to upload back to C.

These loops should have been fixed by my previous commit. (They never
affected ssh remotes, only local ones, it seemed.) While C might still try
to upload to B, or to some other remote that already has the file, the
extra work dies out there.
2012-09-18 14:10:33 -04:00
Joey Hess
adf5195082 run current branch merge in annex monad
I was seeing some interesting crashes after the previous commit,
when making file changes slightly faster than the assistant could keep up.

error: Ref refs/heads/master is at 7074f8e0a11110c532d06746e334f2fec6af6ab4 but expected 95ea86008d72a40d97a81cfc8fb47a0da92166bd
fatal: cannot lock HEAD ref
Committer crashed: git commit [Param "--allow-empty-message",Param "-m",Param "",Param "--allow-empty",Param "--quiet"] failed
Pusher crashed: thread blocked indefinitely in an STM transaction

Clearly the the merger ended up running at the same time as the committer,
and with both modifying HEAD the committer crashed. I fixed that by
making the Merger run its merge inside the annex monad, which avoids
it running concurrently with other git operations. Also by making
the committer not crash if git fails.

What I don't understand is why the pusher then crashed with a STM deadlock.
That must be in either the DaemonStatusHandle or the FailedPushMap,
and the latter is only used by the pusher. Did the committer's crash somehow
break STM?

The BlockedIndefinitelyOnSTM exception is described as:

-- |The thread is waiting to retry an STM transaction, but there are no
-- other references to any @TVar@s involved, so it can't ever continue.

If the Committer had a reference to a TVar and crashed, I can sort of see
this leading to that exception..

The crash was quite easy to reproduce after the previous commit, but
after making the above change, I have yet to see it again. Here's hoping.
2012-09-17 22:04:43 -04:00
Joey Hess
3c22977e44 deferred downloads
Now when a download is queued and there's no known remote to get it from,
it's added to a deferred download list, which will be retried later.

The Merger thread tries to queue any deferred downloads when it receives
a push to the git-annex branch.

Note that the Merger thread now also forces an update of the git-annex
branch. The assistant was not updating this branch before, and it saw a
(mostly) correct view of state, but now that incoming pushes go to
synced/git-annex, it needs to be merged in.
2012-09-17 21:05:50 -04:00
Joey Hess
7a86dc9443 cleanup 2012-09-17 14:58:43 -04:00
Joey Hess
70cf66fded simplify 2012-09-17 13:41:13 -04:00
Joey Hess
e8188ea611 flip catchDefaultIO 2012-09-17 00:18:07 -04:00
Joey Hess
ba744c84a4 better name for fallback sync refs
Don't expose these as branches in refs/heads/. Instead hide them away in
refs/synced/ where only show-ref will find them.

Make unused only look at branches and tags, not these other things,
so it won't care if some stale sync ref used to use a file.

This means they don't need to be deleted, which could have
led to an incoming sync being missed.
2012-09-16 23:09:08 -04:00
Joey Hess
ddacbbe798 ensure outgoing sync pushes always succeed when repo is accessible
The fallback branches pushed to contain the uuid of the pusher, which is
ugly. That's why syncing doesn't normally use this method.

The merger deletes fallback branches after merging them, to contain the
ugliness, and so unused doesn't look at data from these branches.
(The fallback git-annex branch is left behind for now.)
2012-09-16 19:57:13 -04:00
Joey Hess
6cddda4143 make the merger merge any equivilant sync branch into the current branch
Not just synced/master, but synced/UUID/master, for example
2012-09-16 19:41:26 -04:00
Joey Hess
74906ed13f UI for enabling special remotes
Now other repositories can configure special remotes, and when their
configuration has propigated out, they'll appear in the webapp's list of
repositories, with a link to enable them.

Added support for enabling rsync special remotes, and directory special
remotes that are on removable drives. However, encrypted directory special
remotes are not supported yet. The removable drive configuator doesn't
support them yet anyway.
2012-09-13 16:50:02 -04:00
Joey Hess
df337bb63b hlint 2012-09-13 00:57:52 -04:00
Joey Hess
a3913f52e5 change to newtype 2012-09-13 00:29:25 -04:00
Joey Hess
4e48f5e6d6 fixed the multicast socket fd leak
Turns out sClose was working fine.. but it was not being run on every
opened socket. The upstream bug is that multicastSender can crash
on an invalid (or ipv6) address and when this happens it's already
opened a socket, which just goes missing with no way to close it.
A simple fix to the library can avoid this, as I describe here:
https://github.com/audreyt/network-multicast/issues/2

In the meantime, just skipping ipv6 addresses will fix the fd leak.
2012-09-12 01:18:52 -04:00
Richard Hartmann
af657b10fd Remove trailing whitespace 2012-09-11 16:17:26 -04:00
Joey Hess
4d592aaec2 fixed all pairing alert issues 2012-09-11 16:11:28 -04:00
Joey Hess
ade511f6e3 keep webapp snappy by generating ssh keypair in the background 2012-09-11 15:51:27 -04:00
Joey Hess
99d52f26bc fix combining of pairing alerts 2012-09-11 15:43:33 -04:00
Joey Hess
2c1ceeeaf9 pairing works!!
Finally.

Last bug fixes here: Send PairResp with same UUID in the PairReq.
Fix off-by-one in code that filters out our own pairing messages.

Also reworked the pairing alerts, which are still slightly buggy.
2012-09-11 15:09:00 -04:00
Joey Hess
aace44454a keep track of the stage we're at in pairing
This avoids us responding to our own pairing messages, as well
as ignoring any out of order messages that might be received somehow.
2012-09-11 12:58:00 -04:00
Joey Hess
16d27e9c02 work around a bug in Yesod
The PathPiece instance for Text results in a 404 for T.empty.
2012-09-11 12:26:42 -04:00
Joey Hess
084dc188c7 additional security sanity checks on pairing messages 2012-09-11 11:48:50 -04:00
Joey Hess
0208d6aa82 add a UUID to pair requests
Pair requests the the same UUID are part of the same pairing session,
which allows us to detect attempts to brute force the shared secret,
as that will result in pair requests with the same UUID that are
not verified with the right secret.
2012-09-11 03:16:00 -04:00
Joey Hess
9ace0afdfe handle stale PairAcks 2012-09-11 01:00:42 -04:00
Joey Hess
675621d903 clean up authorized_keys handling
Including rollback of adding the key when a pairing response
gets canceled by the user.
2012-09-11 00:23:34 -04:00
Joey Hess
d19bbd29d8 pairing probably works now (untested) 2012-09-10 21:55:59 -04:00
Joey Hess
a41255723c check that ssh public key received over the wire is sane 2012-09-10 18:18:55 -04:00
Joey Hess
c20d6f4189 responding to pair requests *almost* works 2012-09-10 17:53:51 -04:00
Joey Hess
b573d91aa2 broke out fairly generic ssh stuff to Assistant.Ssh so pairing can use it too
I'd rather Utility.Ssh, but the SshData type is not sufficiently clean and
generic for Utility.
2012-09-10 15:21:34 -04:00
Joey Hess
34a0e09d4b split up ssh key generation and setup steps 2012-09-10 14:55:15 -04:00
Joey Hess
16cefae7f2 add an alert while a locally initiated pairing request is in progress
Has a button to cancel the request.
2012-09-09 16:24:34 -04:00
Joey Hess
ded8517545 pair request alert tweaks 2012-09-09 15:16:17 -04:00
Joey Hess
690b424cad unify bootstrap icon names in a data type 2012-09-09 15:09:22 -04:00
Joey Hess
1e41c0d85e update pair request alert when button is pressed 2012-09-09 01:02:44 -04:00
Joey Hess
f62cc48482 reorg templates 2012-09-08 23:32:08 -04:00
Joey Hess
6e60b08060 moved the PairStage inside the Verifiable data 2012-09-08 21:06:10 -04:00
Joey Hess
1ab3ce352b add a PairDone message 2012-09-08 20:44:54 -04:00
Joey Hess
7c70c89ee7 render webapp staitc file url using yesod 2012-09-08 20:04:44 -04:00
Joey Hess
e59b0a1c88 first pass at alert buttons
They work fine. But I had to go to a lot of trouble to get Yesod to render
routes in a pure function. It may instead make more sense to have each
alert have an assocated IO action, and a single route that runs the IO
action of a given alert id. I just wish I'd realized that before the past
several hours of struggling with something Yesod really doesn't want to
allow.
2012-09-08 19:57:15 -04:00
Joey Hess
317ab14da2 add remote directory to pair request 2012-09-08 15:40:47 -04:00
Joey Hess
5401b9f249 filter out our own pairing requests
Due to being multicast, requests sent by one thread are received by the
listener in another thread.
2012-09-08 15:30:04 -04:00
Joey Hess
61ee1e1660 fix build without pairing support 2012-09-08 15:21:34 -04:00
Joey Hess
0f0c7f8d70 added pair listener thread 2012-09-08 15:07:44 -04:00