From: Roland Rosenfeld <roland@debian.org>
Date: Sun, 25 Sep 2022 18:02:44 +0000 (+0200)
Subject: Merge Debian 3.0.33-2 and 3.0.33-3 changes.
X-Git-Tag: v_3_0_34~72
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/user-manual/static/gitweb.js?a=commitdiff_plain;h=134ce0ea6735f83f4876a2b2ff1499abb04340a8;p=privoxy.git

Merge Debian 3.0.33-2 and 3.0.33-3 changes.
---

diff --git a/debian/changelog b/debian/changelog
index b18610bd..e9cd823a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,17 +2,25 @@ privoxy (3.0.34~gitsnapshot-1) UNRELEASED; urgency=medium
 
   * Unreleased GIT snapshot.
 
- -- Roland Rosenfeld <roland@debian.org>  Thu, 09 Dec 2021 16:35:46 +0100
+ -- Roland Rosenfeld <roland@debian.org>  Sun, 25 Sep 2022 20:01:09 +0200
 
-privoxy (3.0.33-2) UNRELEASED; urgency=medium
+privoxy (3.0.33-3) unstable; urgency=medium
+
+  * d/tests/conditional-defines: ignore 32-bit time_t on 32bit systems.
+
+ -- Roland Rosenfeld <roland@debian.org>  Sun, 25 Sep 2022 19:49:17 +0200
+
+privoxy (3.0.33-2) unstable; urgency=medium
 
   * d/maintscript: Remove orphaned
     templates/edit-actions-for-url-string-filter (Closes: #1001501).
   * d/tests/conditional-defines: Check that expected #defines are enabled.
   * d/rules: --enable-compression at build time (still disabled in config).
   * d/tests/privoxy-regression-tests: 2 pass check with different options.
+  * Update to Standards-Version 4.6.1 (no changes).
+  * Add systemd timer support for cert cleanup.
 
- -- Roland Rosenfeld <roland@debian.org>  Sat, 11 Dec 2021 10:36:30 +0100
+ -- Roland Rosenfeld <roland@debian.org>  Sun, 25 Sep 2022 11:52:25 +0200
 
 privoxy (3.0.33-1) unstable; urgency=medium
 
diff --git a/debian/control b/debian/control
index 9e7bde5e..43186955 100644
--- a/debian/control
+++ b/debian/control
@@ -18,7 +18,7 @@ Build-Depends: autoconf,
                sgmlspl <!nodoc>,
                w3m <!nodoc>,
                zlib1g-dev
-Standards-Version: 4.6.0
+Standards-Version: 4.6.1
 Homepage: https://www.privoxy.org/
 Vcs-Git: https://salsa.debian.org/debian/privoxy.git
 Vcs-Browser: https://salsa.debian.org/debian/privoxy
diff --git a/debian/privoxy-cleanup.service b/debian/privoxy-cleanup.service
new file mode 100644
index 00000000..88871817
--- /dev/null
+++ b/debian/privoxy-cleanup.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=privoxy certificate cleanup
+Documentation=man:privoxy(8) https://www.privoxy.org/user-manual/
+ConditionACPower=true
+
+[Service]
+Type=oneshot
+ExecStart=/etc/cron.daily/privoxy systemd-timer
+
+# performance options
+Nice=19
+IOSchedulingClass=best-effort
+IOSchedulingPriority=7
+
diff --git a/debian/privoxy-cleanup.timer b/debian/privoxy-cleanup.timer
new file mode 100644
index 00000000..28b254fd
--- /dev/null
+++ b/debian/privoxy-cleanup.timer
@@ -0,0 +1,12 @@
+[Unit]
+Description=privoxy certificate cleanup
+Documentation=man:privoxy(8) https://www.privoxy.org/user-manual/
+Before=logrotate.timer
+
+[Timer]
+OnCalendar=daily
+AccuracySec=12h
+Persistent=true
+
+[Install]
+WantedBy=timers.target
diff --git a/debian/privoxy.cron.daily b/debian/privoxy.cron.daily
index 114fd412..97eff8a7 100644
--- a/debian/privoxy.cron.daily
+++ b/debian/privoxy.cron.daily
@@ -4,9 +4,15 @@
 
 set -e
 
+# skip in favour of systemd timer if called from cron.daily
+if [ -d /run/systemd/system ] && [ "$1" != "systemd-timer" ]; then
+    exit 0
+fi
+
+
 CERTDIR=/var/lib/privoxy/certs
 EXPIREDAYS=90
 
 if [ -d $CERTDIR ]; then
-    find $CERTDIR -type f -mtime +$EXPIREDAYS | xargs -r rm -f
+    find $CERTDIR -type f -mtime +$EXPIREDAYS -print0 | xargs -0 -r rm -f
 fi
diff --git a/debian/rules b/debian/rules
index 87c8cf44..5b49300f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -117,3 +117,7 @@ endif
 override_dh_perl:
 #	We only need perl-base:
 	dh_perl -d
+
+override_dh_installsystemd:
+	dh_installsystemd
+	dh_installsystemd --name privoxy-cleanup
diff --git a/debian/tests/conditional-defines b/debian/tests/conditional-defines
old mode 100644
new mode 100755
diff --git a/debian/tests/conditional-defines.pl b/debian/tests/conditional-defines.pl
index d1554a3c..693f4fbd 100755
--- a/debian/tests/conditional-defines.pl
+++ b/debian/tests/conditional-defines.pl
@@ -45,8 +45,13 @@ foreach my $tr ($table->look_down('_tag' => 'tr')) {
    my $value = $td2->detach_content;
    if ($value !~ /Yes/) {
       # feature disabled, check whitelist
-      if (! defined $disabled_features{$feature}) {
-         printf STDERR "%s is disabled, but should be enabled\n", $feature;
+      if ($feature eq 'FEATURE_64_BIT_TIME_T') {
+         # See https://en.wikipedia.org/wiki/Year_2038_problem
+         # On Linux >= 5.6 time_t should be 64bit, too.
+         printf "%s is disabled, which is ok on 32bit systems", $feature;
+         $disabled_ok++;
+      } elsif (! defined $disabled_features{$feature}) {
+         printf "%s is disabled, but should be enabled\n", $feature;
          $exitcode = 1;
          $disabled_nok++;
       } else {