[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[buster-queue] [PATCH] apt.systemd.daily: check_stamp: check for 'always' before numerical values



Prevents a crash when the configuration actually uses 'always':

apt.systemd.daily: 402: [: Illegal number: always
---
 debian/apt.systemd.daily | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/debian/apt.systemd.daily b/debian/apt.systemd.daily
index 59fe4d8a5..51f2d11d8 100755
--- a/debian/apt.systemd.daily
+++ b/debian/apt.systemd.daily
@@ -78,6 +78,12 @@ check_stamp()
     stamp="$1"
     interval="$2"
 
+    if [ $interval = always ]; then
+	debug_echo "check_stamp: ignoring time stamp file, interval set to always"
+	# treat as enough time has passed
+        return 0
+    fi
+
     if [ $interval -eq 0 ]; then
 	debug_echo "check_stamp: interval=0"
 	# treat as no time has passed
@@ -90,12 +96,6 @@ check_stamp()
         return 0
     fi
 
-    if [ $interval = always ]; then
-	debug_echo "check_stamp: ignoring time stamp file, interval set to always"
-	# treat as enough time has passed
-        return 0
-    fi
-
     # compare midnight today to midnight the day the stamp was updated
     stamp_file="$stamp"
     stamp=$(date --date=$(date -r $stamp_file --iso-8601) +%s 2>/dev/null)
-- 
2.11.0


Reply to: