summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-04-08 22:43:37 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-04-08 22:43:37 +0200
commit9c2d35fa4715db757b728458cfdce5d748ae1476 (patch)
tree65bb3019ef92a63d83b1dd112b5c273f850b3512 /debian
parentc2d0fdd1abffa6701422f4b722b994ab3c43262b (diff)
apt.cron.daily: catch invalid dates due to DST time changes
in the stamp files
Diffstat (limited to 'debian')
-rw-r--r--debian/apt.cron.daily21
-rw-r--r--debian/changelog8
2 files changed, 27 insertions, 2 deletions
diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily
index 954f0bfc9..7f2978568 100644
--- a/debian/apt.cron.daily
+++ b/debian/apt.cron.daily
@@ -50,8 +50,25 @@ check_stamp()
fi
# compare midnight today to midnight the day the stamp was updated
- stamp=$(date --date=$(date -r $stamp --iso-8601) +%s)
- now=$(date --date=$(date --iso-8601) +%s)
+ stamp_file="$stamp"
+ stamp=$(date --date=$(date -r $stamp_file --iso-8601) +%s 2>/dev/null)
+ if [ "$?" != "0" ]; then
+ # Due to some timezones returning 'invalid date' for midnight on
+ # certain dates (eg America/Sao_Paulo), if date returns with error
+ # remove the stamp file and return 0. See coreutils bug:
+ # http://lists.gnu.org/archive/html/bug-coreutils/2007-09/msg00176.html
+ rm -f "$stamp_file"
+ return 0
+ fi
+
+ now=$(date --date=$(date --iso-8601) +%s 2>/dev/null)
+ if [ "$?" != "0" ]; then
+ # As above, due to some timezones returning 'invalid date' for midnight
+ # on certain dates (eg America/Sao_Paulo), if date returns with error
+ # return 0.
+ return 0
+ fi
+
delta=$(($now-$stamp))
# intervall is in days,
diff --git a/debian/changelog b/debian/changelog
index 6a3d14ddc..43827dada 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+apt (0.7.20.2ubuntu6) jaunty; urgency=low
+
+ [ Jamie Strandboge ]
+ * apt.cron.daily: catch invalid dates due to DST time changes
+ in the stamp files
+
+ -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 08 Apr 2009 22:39:50 +0200
+
apt (0.7.20.2ubuntu5) jaunty; urgency=low
[ Colin Watson ]