Merge branch 'master' of ssh://git-annex.branchable.com

This commit is contained in:
Joey Hess 2014-04-11 15:31:02 -04:00
commit 9d8e15bd37
6 changed files with 42 additions and 28 deletions

View file

@ -108,65 +108,65 @@ calcNextTime (Schedule recurrance scheduledtime) lasttime currenttime
window startd endd = NextTimeWindow window startd endd = NextTimeWindow
(LocalTime startd nexttime) (LocalTime startd nexttime)
(LocalTime endd (TimeOfDay 23 59 0)) (LocalTime endd (TimeOfDay 23 59 0))
findfrom r afterday day = case r of findfrom r afterday candidate = case r of
Daily Daily
| afterday -> Just $ exactly $ addDays 1 day | afterday -> Just $ exactly $ addDays 1 candidate
| otherwise -> Just $ exactly day | otherwise -> Just $ exactly candidate
Weekly Nothing Weekly Nothing
| afterday -> skip 1 | afterday -> skip 1
| otherwise -> case (wday <$> lastday, wday day) of | otherwise -> case (wday <$> lastday, wday candidate) of
(Nothing, _) -> Just $ window day (addDays 6 day) (Nothing, _) -> Just $ window candidate (addDays 6 candidate)
(Just old, curr) (Just old, curr)
| old == curr -> Just $ window day (addDays 6 day) | old == curr -> Just $ window candidate (addDays 6 candidate)
| otherwise -> skip 1 | otherwise -> skip 1
Monthly Nothing Monthly Nothing
| afterday -> skip 1 | afterday -> skip 1
| maybe True (\old -> mnum day > mday old && mday day >= (mday old `mod` minmday)) lastday -> | maybe True (\old -> mnum candidate > mnum old && mday candidate >= (mday old `mod` minmday)) lastday ->
-- Window only covers current month, -- Window only covers current month,
-- in case there is a Divisible requirement. -- in case there is a Divisible requirement.
Just $ window day (endOfMonth day) Just $ window candidate (endOfMonth candidate)
| otherwise -> skip 1 | otherwise -> skip 1
Yearly Nothing Yearly Nothing
| afterday -> skip 1 | afterday -> skip 1
| maybe True (\old -> ynum day > ynum old && yday day >= (yday old `mod` minyday)) lastday -> | maybe True (\old -> ynum candidate > ynum old && yday candidate >= (yday old `mod` minyday)) lastday ->
Just $ window day (endOfYear day) Just $ window candidate (endOfYear candidate)
| otherwise -> skip 1 | otherwise -> skip 1
Weekly (Just w) Weekly (Just w)
| w < 0 || w > maxwday -> Nothing | w < 0 || w > maxwday -> Nothing
| w == wday day -> if afterday | w == wday candidate -> if afterday
then Just $ exactly $ addDays 7 day then Just $ exactly $ addDays 7 candidate
else Just $ exactly day else Just $ exactly candidate
| otherwise -> Just $ exactly $ | otherwise -> Just $ exactly $
addDays (fromIntegral $ (w - wday day) `mod` 7) day addDays (fromIntegral $ (w - wday candidate) `mod` 7) candidate
Monthly (Just m) Monthly (Just m)
| m < 0 || m > maxmday -> Nothing | m < 0 || m > maxmday -> Nothing
-- TODO can be done more efficiently than recursing -- TODO can be done more efficiently than recursing
| m == mday day -> if afterday | m == mday candidate -> if afterday
then skip 1 then skip 1
else Just $ exactly day else Just $ exactly candidate
| otherwise -> skip 1 | otherwise -> skip 1
Yearly (Just y) Yearly (Just y)
| y < 0 || y > maxyday -> Nothing | y < 0 || y > maxyday -> Nothing
| y == yday day -> if afterday | y == yday candidate -> if afterday
then skip 365 then skip 365
else Just $ exactly day else Just $ exactly candidate
| otherwise -> skip 1 | otherwise -> skip 1
Divisible n r'@Daily -> handlediv n r' yday (Just maxyday) Divisible n r'@Daily -> handlediv n r' yday (Just maxyday)
Divisible n r'@(Weekly _) -> handlediv n r' wnum (Just maxwnum) Divisible n r'@(Weekly _) -> handlediv n r' wnum (Just maxwnum)
Divisible n r'@(Monthly _) -> handlediv n r' mnum (Just maxmnum) Divisible n r'@(Monthly _) -> handlediv n r' mnum (Just maxmnum)
Divisible n r'@(Yearly _) -> handlediv n r' ynum Nothing Divisible n r'@(Yearly _) -> handlediv n r' ynum Nothing
Divisible _ r'@(Divisible _ _) -> findfrom r' afterday day Divisible _ r'@(Divisible _ _) -> findfrom r' afterday candidate
where where
skip n = findfrom r False (addDays n day) skip n = findfrom r False (addDays n candidate)
handlediv n r' getval mmax handlediv n r' getval mmax
| n > 0 && maybe True (n <=) mmax = | n > 0 && maybe True (n <=) mmax =
findfromwhere r' (divisible n . getval) afterday day findfromwhere r' (divisible n . getval) afterday candidate
| otherwise = Nothing | otherwise = Nothing
findfromwhere r p afterday day findfromwhere r p afterday candidate
| maybe True (p . getday) next = next | maybe True (p . getday) next = next
| otherwise = maybe Nothing (findfromwhere r p True . getday) next | otherwise = maybe Nothing (findfromwhere r p True . getday) next
where where
next = findfrom r afterday day next = findfrom r afterday candidate
getday = localDay . startTime getday = localDay . startTime
divisible n v = v `rem` n == 0 divisible n v = v `rem` n == 0

8
debian/changelog vendored
View file

@ -1,4 +1,4 @@
git-annex (5.20140406) UNRELEASED; urgency=medium git-annex (5.20140411) unstable; urgency=medium
* importfeed: Filename template can now contain an itempubdate variable. * importfeed: Filename template can now contain an itempubdate variable.
Needs feed 0.3.9.2. Needs feed 0.3.9.2.
@ -7,8 +7,12 @@ git-annex (5.20140406) UNRELEASED; urgency=medium
OSX system has wget installed, which will then be used. OSX system has wget installed, which will then be used.
* Fix rsync progress parsing in locales that use comma in number display. * Fix rsync progress parsing in locales that use comma in number display.
Closes: #744148 Closes: #744148
* 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.
-- Joey Hess <joeyh@debian.org> Mon, 07 Apr 2014 16:22:02 -0400 -- Joey Hess <joeyh@debian.org> Fri, 11 Apr 2014 14:59:49 -0400
git-annex (5.20140405) unstable; urgency=medium git-annex (5.20140405) unstable; urgency=medium

View file

@ -1,4 +1,7 @@
## version 5.20140406 ## version 5.20140411
This release fixes a bug that could cause the assistant to use a *lot* of
CPU, when monthly fscking was set up.
Automatic upgrading was broken on OSX for previous versions. This has been Automatic upgrading was broken on OSX for previous versions. This has been
fixed, but you'll need to manually upgrade to this version to get it going fixed, but you'll need to manually upgrade to this version to get it going

View file

@ -520,3 +520,10 @@ $ ps -O start xf | grep git-annex
13761 23:56:38 Z ? 00:00:00 \_ [git] <defunct> 13761 23:56:38 Z ? 00:00:00 \_ [git] <defunct>
6252 12:56:59 S ? 00:01:09 /usr/bin/emacs23 6252 12:56:59 S ? 00:01:09 /usr/bin/emacs23
"""]] """]]
#### This bug is fixed
> [[fixed|done]]. This was a Cronner bug, triggered when you had a
> scheduled fsck job that runs monthly at any time, and the last time it ran was on a day of a
> month > 12. Workaround: Disable scheduled fsck jobs, or change them to
> run on a specific day of the month. Or upgrade. --[[Joey]]

View file

@ -67,7 +67,7 @@ first "/~/" or "/~user/" is expanded to the specified home directory.
* notifychanges * notifychanges
This is used by `git-annex remote-daemon` to be notified when This is used by `git-annex remotedaemon` to be notified when
refs in the remote repository are changed. refs in the remote repository are changed.
* gcryptsetup gcryptid * gcryptsetup gcryptid

View file

@ -1,5 +1,5 @@
Name: git-annex Name: git-annex
Version: 5.20140405 Version: 5.20140411
Cabal-Version: >= 1.8 Cabal-Version: >= 1.8
License: GPL-3 License: GPL-3
Maintainer: Joey Hess <joey@kitenet.net> Maintainer: Joey Hess <joey@kitenet.net>