Commit graph

739 commits

Author SHA1 Message Date
Joey Hess
cf384cddfb increase sleep 2014-07-16 16:16:25 -04:00
Joey Hess
aacd5c6994 Windows: fix crash after 10 minutes
getLine in waitForTermination doesn't work when stdin is closed..
Just loop forever, there was no reason to getLine here I think.
2014-07-16 15:42:12 -04:00
Joey Hess
339a3b8ab0 Windows: Fix locking issue that prevented the webapp starting (since 5.20140707).
Reversion introduced in 9fb8038166.
The locking code was wrong; the webapp re-ran itself, saw pid was locked,
and so didn't start!
2014-07-14 15:52:00 -04:00
Joey Hess
e36439d4fe deal with process-1.2.0.0 throwing an exception when program DNE (may only fix the tip of the iceberg)
Configure crashed on systems with that process and without eg, sha256sum.

The rest of the code in configure looks to work ok, since it uses sh -c to
probe for commands, and sh is always in path so it works.

Dunno about all the rest of git-annex. Not a huge amount of external
program use, other than git, so perhaps this won't be a large pain.

Note that boolSystem can throw an exception now if the program doesn't
exist. Could easily be changed back to False.
2014-07-13 22:33:28 -04:00
Joey Hess
e5b88713a1 refactor 2014-07-10 00:16:53 -04:00
Joey Hess
d9d76cf98b Fix minor FD leak in journal code.
Minor because normally only 1 FD is leaked per git-annex run. However,
the test suite leaks a few hundred FDs, and this broke it on the Debian
autobuilders, which seem to have a tigher than usual ulimit.

The leak was introduced by the lazy getDirectoryContents' that was
introduced in e6330988dd in order to scale to
millions of journal files -- if the lazy list was never fully consumed, the
directory handle did not get closed.

Instead, pull in openDirectory/readDirectory/closeDirectory code that I
already developed and submitted in a patch to the haskell directory library
earlier. Using this in journalDirty avoids the place that the lazy list
caused a problem. And using it in stageJournal eliminates the need for
getDirectoryContents'.

The getJournalFiles* functions are switched back to using the regular
strict getDirectoryContents. I'm not sure if those always consume the whole
list, so this avoids any leak. And the things that call those are things
like git annex unused, which also look at every file committed to the
git-annex branch, so would need more work to scale to insane numbers of
files anyway.
2014-07-09 23:36:53 -04:00
Joey Hess
33ad8beabb Support building with bloomfilter 2.0.0. 2014-07-07 12:24:12 -04:00
Joey Hess
c5c4fd76ec fix windows build 2014-07-05 11:18:59 -04:00
Joey Hess
c90e4e8778
work around getDirectoryContents not streaming lazily 2014-07-04 17:59:26 -04:00
Joey Hess
9fb8038166 Windows: Assistant now logs to daemon.log.
Yes, this means that git annex webapp on windows execs git-annex, which
execs itself to set env, and the execs itself again to redirect logs.

This is disgusting. This is Windows(TM).
2014-06-17 19:27:54 -04:00
Joey Hess
4fe2e53f5b finish fixing windows timezone madness
Rather than calculating the TSDelta once, and caching it, this now
reads the inode sential file's InodeCache file once, and then each time a
new InodeCache is generated, looks at the sentinal file to get the current
delta.

This way, if the time zone changes while git-annex is running, it will
adapt.

This adds some inneffiency, but only on Windows, and only 1 stat per new
file added. The worst innefficiency is that `git annex status` and
`git annex sync` will now (on Windows) stat the inode sentinal file once per
file in the repo.

It would be more efficient to use getCurrentTimeZone, rather than needing
to stat the sentinal file. This should be easy to do, once the time
package gets my bugfix patch.

This commit was sponsored by Jürgen Lüters.
2014-06-12 13:54:08 -04:00
Joey Hess
e4d7e2ebde fix for Windows file timestamp timezone madness
On Windows, changing the time zone causes the apparent mtime of files to
change. This confuses git-annex, which natually thinks this means the files
have actually been modified (since THAT'S WHAT A MTIME IS FOR, BILL <sheesh>).

Work around this stupidity, by using the inode sentinal file to detect if
the timezone has changed, and calculate a TSDelta, which will be applied
when generating InodeCaches.

This should add no overhead at all on unix. Indeed, I sped up a few
things slightly in the refactoring.

Seems to basically work! But it has a big known problem:
If the timezone changes while the assistant (or a long-running command)
runs, it won't notice, since it only checks the inode cache once, and
so will use the old delta for all new inode caches it generates for new
files it's added. Which will result in them seeming changed the next time
it runs.

This commit was sponsored by Vincent Demeester.
2014-06-12 13:42:21 -04:00
Joey Hess
db8982c45b minimal exports 2014-06-11 16:17:01 -04:00
Joey Hess
1c18056e15 deal with FAT on Linux timestamp issue
Deal with FAT's low resolution timestamps, which in combination with
Linux's caching of higher res timestamps while a FAT is mounted, caused
direct mode repositories on FAT to seem to have modified files after they
were unmounted and remounted.

This commit was sponsored by Fabrice Rossi.
2014-06-11 14:46:03 -04:00
Joey Hess
8ff9938d97 Fix build with wai 0.3.0.
This version of wai changed the type of Middleware, so I cannot seem
to liftIO inside it. So, got rid of a lot of not really needed
complexity to use System.Log.Logger's logging stuff, and just use
the standard wai stdout logger when debug logging is enabled.

Format may change some, and it logs http to stdout instead of stderr
now. Doesn't matter for the webapp since both go to the same log anyway.
2014-06-11 01:29:00 -04:00
Joey Hess
a44fd2c019 export CreateProcess fields from Utility.Process
update code to avoid cwd and env redefinition warnings
2014-06-10 19:20:14 -04:00
Joey Hess
6eb5e6c135 Windows: Fix opening webapp when repository is in a directory with spaces in the path. 2014-06-10 18:37:33 -04:00
Joey Hess
7671d228af Avoid leaving behind .tmp files when failing in some cases, including importing files to a disk that is full. 2014-06-09 15:24:05 -04:00
Joey Hess
787d9e27ba Ignore setsid failures. 2014-06-09 14:44:18 -04:00
Joey Hess
a59ac68c22 qualify comment 2014-06-09 13:48:44 -04:00
Joey Hess
b7560e660e
fix build with old versions of warp 2014-06-04 14:37:08 -04:00
Joey Hess
0eb6576455 lazy bytestring fromStrict is not available in stable; use fromChunks instead 2014-05-29 20:25:01 -04:00
Joey Hess
450eecaa76 fix warning message
This should work even back in debian stable's warp
2014-05-29 13:49:45 -04:00
Joey Hess
b197ec8917 get rid of (completely safe) uses of Char8
Char8 often indicates an encoding bug. It didn't here, but I can avoid it
and not worry about it.
2014-05-27 20:26:10 -04:00
Joey Hess
a66c942645 refactor 2014-05-14 17:31:20 -04:00
Joey Hess
740de08461 fix windows build 2014-05-14 15:54:41 -04:00
Joey Hess
e391224516 setsid when running webapp in foreground too
This avoids ssh prompting for passwords on stdin, ever.

It may also change other behavior of other programs, as there is no
controlling terminal now. However, setsid was already done when running the
assistant in daemon mode, so any behavior changes should not be really new.
2014-05-14 14:26:28 -04:00
Joey Hess
2427832bed relicense general utility library code to BSD
Omitted a couple of files what have had significant contributions from
others.
2014-05-10 11:01:27 -03:00
Joey Hess
2aed2d8510 Merge branch 'master' into bootstrap3
Conflicts:
	debian/changelog
2014-05-02 15:32:49 -03:00
Joey Hess
72ec0ab736 hlint 2014-04-26 19:25:05 -04:00
Sören Brunk
54fe9af0bb create a local copy of Yesod.Form.Bootstrap3 2014-04-25 12:26:33 +02:00
Sören Brunk
00c1cd0db1 bootstrap3 forms 2014-04-21 19:47:05 +02:00
Joey Hess
515d251127
better approach for building distributionupdate
Use cabal include file
2014-04-21 10:57:01 -04:00
Joey Hess
a10d3731b8 fix distributionupdate build
Including avoiding needing cabal's defines for Utility.URI
2014-04-21 10:47:26 -04:00
Joey Hess
138d25518d Merge branch 'master' into remotecontrol
Conflicts:
	doc/devblog/day_152__more_ssh_connection_caching.mdwn
2014-04-14 13:38:35 -04:00
Joey Hess
e53a85743e
adjust to not use cpp in modules used by configure 2014-04-14 13:37:12 -04:00
Joey Hess
2ff9ba9f74
add missing Network.URI Ord instance for Debian stable 2014-04-14 13:25:49 -04:00
Joey Hess
15917ec1a8 sync, assistant, remotedaemon: Use ssh connection caching for git pushes and pulls.
For sync, saves 1 ssh connection per remote. For remotedaemon, the same
ssh connection that is already open to run git-annex-shell notifychanges
is reused to pull from the remote.

Only potential problem is that this also enables connection caching
when the assistant syncs with a ssh remote. Including the sync it does
when a network connection has just come up. In that case, cached ssh
connections are likely to be stale, and so using them would hang.
Until I'm sure such problems have been dealt with, this commit needs to
stay on the remotecontrol branch, and not be merged to master.

This commit was sponsored by Alexandre Dupas.
2014-04-12 15:59:34 -04:00
Joey Hess
9fff243ff2
wrote test case; found bugs in date math; fixed and simplified using Data.Time.Calendar 2014-04-12 13:29:35 -04:00
Joey Hess
b815988d16
Improve handling on monthly/yearly scheduling.
Avoid back-to-back runs.
2014-04-12 12:58:32 -04:00
Joey Hess
d955cfe78a Improve handling on monthly/yearly scheduling.
Code was still buggy, it turns out (though the recursion checker caught
it). In the case of (Schedule (Monthly Nothing) AnyTime), where the last
run was on yyyy-12-31, it looped forever.

Also, the handling of (Schedule (Yearly Nothing) AnyTime) was wacky where
the last run was yyyy-12-31. It would suggest a window starting on the 3rd
for the next run (because 31 mod 28 is 3).

I think that originally I was wanted to avoid running on 01-01 if it had
just run on 12-31. But the code didn't accomplish this, and it's not
necessary anyway. This is supposed to calculate the next window meeting the
schedule, and for (Schedule (Monthly Nothing), the window starts at 01-01
and runs through 01-31. If that causes two back-to-back runs, well the next
one will not be until 02-01 at the earliest.

Also, back-to-back runs can be avoided, if desired, by using Divisible 2.
2014-04-11 21:42:43 -04:00
Joey Hess
e26dead493 guard against any remaining infinite recursion bugs; throw error if no candidate cn be found in next hundred years
Note that the exception thrown is not visible in the webapp currently
because it crashes one of Cronner's 2 worker threads, which is never
checked.
2014-04-11 18:08:46 -04:00
Joey Hess
9e16171c7f Last release didn't quite fix the high cpu issue in all cases, this should.
This is supposed to look for a day past the last day it ran, not a month
past.

Seems to work, at least in anarcat's test case.
2014-04-11 17:14:19 -04:00
Joey Hess
e0ca99b480
rename confusingly named "day" 2014-04-11 14:38:23 -04:00
Joey Hess
c678798a5c assistant: Fix high CPU usage triggered when a monthly fsck is scheduled, and the last time the job ran was a day of the month > 12. This caused a runaway loop. Thanks to Anarcat for his assistance, and to Maximiliano Curia for identifying the cause of this bug. 2014-04-11 14:34:09 -04:00
Joey Hess
a6df4698a3 Fix rsync progress parsing in locales that use comma in number display. Closes: #744148 2014-04-10 15:36:51 -04:00
Joey Hess
38862bf65d merge from propellor 2014-04-09 01:15:24 -04:00
Joey Hess
cbcb7f50d8 remotedaemon: avoid extraneous stdout output 2014-04-08 14:02:25 -04:00
Joey Hess
5af30678c7 factored out Utility.SimpleProtocol from the external special remote implementation 2014-04-05 13:29:28 -04:00
Joey Hess
611e060385 factor out library code (also used by propellor) 2014-04-03 21:25:59 -04:00