Commit graph

660 commits

Author SHA1 Message Date
Joey Hess
1b79d18a40 data types and serialization for metadata
A very haskell commit! Just data types, instances to serialize the metadata
to a nice format, and QuickCheck tests.

This commit was sponsored by Andreas Leha.
2014-02-12 17:57:32 -04:00
Joey Hess
7b19c7d25b cleanup thanks to Utility.PID 2014-02-11 15:39:51 -04:00
Joey Hess
c390e896d1 fix windows build (and make --stop work on windows, incidentially)
The Utility.PID will clean up other code soon.
2014-02-11 15:25:59 -04:00
Joey Hess
b2fae4b78f
remove unimplemented windows stubs 2014-02-11 13:18:59 -04:00
Joey Hess
ae2bc90a1d eliminating absNormPath
git-annex has been using MissingH's `abdNormPath` forever, but that's
unmaintained and possibly buggy, and doesn't work on Windows. I've been
wanting to get rid of it for some time, and finally did today, writing a
`simplifyPath` that does the things git-annex needs and will work with all
the Windows filename craziness, and takes advantage of the more modern
System.FilePath to be quite a simple peice of code. A QuickCheck test found
no important divergences from absNormPath. A good first step to making
git-annex not depend on MissingH at all.

And it fixed some weird behaviors on Windows like
`git annex add ..\subdir\file` not working.

Note that absNormPathUnix has been left alone for now.
2014-02-07 17:15:18 -04:00
Joey Hess
3cbaa68be8 Android: Avoid crashing when unable to set file mode for ssh config file due to Android filesystem horribleness. 2014-02-07 14:57:23 -04:00
Joey Hess
dc3b7effd2 add regression test for symlink calculation
Note: Test reordered because running git-annex sync early broke the
environment for some other tests.
2014-02-06 20:57:58 -04:00
Joey Hess
f404379716 wiiindddoowws 2014-02-06 20:05:27 -04:00
Joey Hess
810b26e1d9 fix windows code again (argh) 2014-02-06 17:58:43 -04:00
Joey Hess
897d877472 work around absNormPath not working on Windows
When making git-annex links, we want unix-style paths in the link targets.
2014-02-06 17:17:35 -04:00
Joey Hess
28cabd9909 Revert "work around absNormPath not working on Windows"
This reverts commit 0fc3ad82c5.

That caused 2 other test cases to fail. Windows path slash issues are
horrible.
2014-02-06 16:59:39 -04:00
Joey Hess
0fc3ad82c5 work around absNormPath not working on Windows
Seems I punted on this while porting before. This hack relies on DOS not
using / in filenames, it's effectively an alternate path separatr in at
least current versions of windows..
2014-02-06 15:06:45 -04:00
Joey Hess
1572c460e8 avoid using openFile when withFile can be used
Potentially fixes some FD leak if an action on an opened file handle fails
for some reason. There have been some hard to reproduce reports of
git-annex leaking FDs, and this may solve them.
2014-02-03 10:19:06 -04:00
Joey Hess
fd1382f96f factor out utility function 2014-02-03 10:08:28 -04:00
Joey Hess
fd7e9431ff comment spelling 2014-02-03 10:01:49 -04:00
Joey Hess
e40a119e74 tell moveFile to overwrite existing files 2014-01-29 17:19:46 -04:00
Joey Hess
1ad3c1b2b3 fix windows build 2014-01-29 15:24:22 -04:00
Joey Hess
070ed4a766 change a few renameFile's to rename
AFAIK, none of these ever operate on directories, but nor do I want to
explicitly check if they're files and fail if not.
2014-01-29 15:21:02 -04:00
Joey Hess
1669e80e85 Windows: Avoid using unix-compat's rename, which refuses to rename directories.
Opened a bug about this: https://github.com/jystic/unix-compat/issues/10
2014-01-29 15:19:03 -04:00
Joey Hess
891c85cd88 use locking on Windows
This is all the easy cases, where there was already a separate lock file.
2014-01-28 14:42:03 -04:00
Joey Hess
8de4db664d Windows file locking (atrociously horrible) 2014-01-28 13:43:43 -04:00
Joey Hess
e0bd088f08 add webapp UI to manage unused files 2014-01-23 15:09:43 -04:00
Joey Hess
85aae97b63 add getDiskSize
Couldn't find anything that exposed this for Windows.
2014-01-22 22:19:52 -04:00
Joey Hess
207ac67aaa avoid needing a build-dep on hxt for Data.AssocList 2014-01-14 16:42:10 -04:00
Joey Hess
0cac4402ac Android: Avoid passing --clobber to busybox wget. 2014-01-13 14:52:49 -04:00
Joey Hess
7aec957c5b comment 2014-01-07 17:33:38 -04:00
Joey Hess
d8e8128b50 work around a strance change in gpg behavior; needs a trustdb to exist even when using --trust-model=always 2014-01-07 13:20:07 -04:00
Joey Hess
e5b4d447b6 assistant: Start a new git-annex transferkeys process after a network connection change
So that remotes that use a persistent network connection are restarted.

A remote might keep open a long duration network connection, and could
fail to deal well with losing the connection. This is particularly a
concern now that we have external special reotes. An external
special remote that is implemented naively might open the connection only
when PREPARE is sent, and if it loses connection, throw errors on each
request that is made.

(Note that the ssh connection caching should not have this problem; if the
long-duration ssh process loses connection, the named pipe is disconnected
and the next ssh attempt will reconnect. Also, XMPP already deals with
disconnection robustly in its own way.)

There's no way for git-annex to know if a lost network connection actually
affects a given remote, which might have a transfer in process. It does not
make sense to force kill the transferkeys process every time the NetWatcher
detects a change. (Especially because the NetWatcher sometimes polls 1
change per hour.)

In any case, the NetWatcher only detects connection to a network, not
disconnection. So if a transfer is in progress over the network, and the
network goes down, that will need to time out on its own.

An alternate approch that was considered is to use a separate transferkeys
process for each remote, and detect when a request fails, and assume that
means that process is in a failing state and restart it. The problem with
that approach is that if a resource is not available and a remote fails
every time, it degrades to starting a new transferkeys process for every
file transfer, which is too expensive.

Instead, this commit only handles the network reconnection case, and restarts
transferkeys only once the network has reconnected and another transfer needs
to be made. So, a transferkeys process will be reused for 1 hour, or until the
next network connection.

----

The NotificationBroadcaster was rewritten to use TMVars rather than MSampleVars,
to allow checking without blocking if a notification has been received.

----

This commit was sponsored by Tobias Brunner.
2014-01-06 16:03:39 -04:00
Joey Hess
fdcc04096c assistant: Ensure that .ssh/config and .ssh/authorized_keys are not group or world writable when writing to those files, as that can make ssh refuse to use them, if it allows another user to write to them. 2014-01-03 17:44:12 -04:00
Joey Hess
858eb26303 Avoid looping if long-running git cat-file or git hash-object crashes and keeps crashing when restarted. 2014-01-01 21:42:25 -04:00
Joey Hess
b6379bc101 fix 2013-12-30 14:05:07 -04:00
Joey Hess
0cb1a0a605 fix 2013-12-30 13:41:11 -04:00
Joey Hess
52a46585b9 fix build failure in windows code 2013-12-30 13:18:40 -04:00
Joey Hess
3b858ece45 typo 2013-12-29 22:40:23 -04:00
Joey Hess
d6d5b0a6d8 Android: Avoid trying to use Android's own ionice, which does not allow specifying a command to run. Fixes transferring files to/from android and probably a few other things. 2013-12-29 17:32:08 -04:00
Joey Hess
a96118ec55 work around windows insanity that is 97.61% more brain-damaged than normal 2013-12-29 16:25:12 -04:00
Joey Hess
7f6685c16e addurl, importfeed: Sanitize | and some other symbols and special characters. 2013-12-27 17:52:20 -04:00
Joey Hess
6c565ec905 external special remotes mostly implemented (untested)
This has not been tested at all. It compiles!

The only known missing things are support for encryption, and for get/set
of special remote configuration, and of key state. (The latter needs
separate work to add a new per-key log file to store that state.)

Only thing I don't much like is that initremote needs to be passed both
type=external and externaltype=foo. It would be better to have just
type=foo

Most of this is quite straightforward code, that largely wrote itself given
the types. The only tricky parts were:

* Need to lock the remote when using it to eg make a request, because
  in theory git-annex could have multiple threads that each try to use
  a remote at the same time. I don't think that git-annex ever does
  that currently, but better safe than sorry.

* Rather than starting up every external special remote program when
  git-annex starts, they are started only on demand, when first used.
  This will avoid slowdown, especially when running fast git-annex query
  commands. Once started, they keep running until git-annex stops, currently,
  which may not be ideal, but it's hard to know a better time to stop them.

* Bit of a chicken and egg problem with caching the cost of the remote,
  because setting annex-cost in the git config needs the remote to already
  be set up. Managed to finesse that.

This commit was sponsored by Lukas Anzinger.
2013-12-26 18:23:13 -04:00
Joey Hess
5897fb4a86 convert hacky shell linux mklibs code to haskell ; fixing symlink bug
The shell code was nasty, and buggy. New haskell code is much nicer,
and it's easy to do complicated calculations to properly convert possibly
absolute symlinks between libraries into relative links using it.
2013-12-24 13:13:17 -04:00
Joey Hess
3a6e0d1215 assistant: Set StrictHostKeyChecking yes when creating ssh remotes, and add it to the configuration for any ssh remotes previously created by the assistant. This avoids repeated prompts by ssh if the host key changes, instead syncing with such a remote will fail. Closes: #732602 2013-12-20 20:58:36 -04:00
Joey Hess
6e3cc0a228 need to stat symlink 2013-12-18 15:20:26 -04:00
Joey Hess
c99d6a8151 assistant: Fix OSX-specific bug that caused the startup scan to try to follow symlinks to other directories, and add their contents to the annex. 2013-12-18 15:05:29 -04:00
Joey Hess
a168b8de12 switch define used, not android specific 2013-12-18 02:06:15 -04:00
Joey Hess
2fd63f3cfa port transferkeys to windows; make stopping in progress transfers work too (probably)
transferkeys had used special FDs for communication, but that would be
quite annoying to do in Windows.

Instead, use stdin and stdout. But, to avoid commands like rsync stomping
on them and messing up the communications channel, they're duplicated to a
different handle; stdin is replaced with a null handle, and stdout is
replaced with a copy of stderr. This should all work in windows too.

Stopping in progress transfers may work on windows.. if the types unify
anyway. ;) May need some more porting.
2013-12-10 23:19:18 -04:00
Joey Hess
5b0cb642c9 warning 2013-12-10 01:35:27 -04:00
Joey Hess
89b5256f09 missing include 2013-12-10 01:21:39 -04:00
Joey Hess
063a183a61 windows disk free space checking 2013-12-10 01:18:04 -04:00
Joey Hess
0544818e59 squash warning 2013-12-09 17:24:32 -04:00
Joey Hess
472e0e97fe whups 2013-12-06 22:57:54 -04:00
Joey Hess
67df015767 didn't seem to help 2013-12-06 22:53:36 -04:00