From 19c08f05a23ae19e9f279f9402ebef3785dcfdbd Mon Sep 17 00:00:00 2001 From: Roland Rosenfeld Date: Sun, 24 Apr 2022 15:39:41 +0200 Subject: [PATCH] Merge Debian 3.0.33-2 (UNRELEASED) changes. --- debian/changelog | 10 ++++ debian/maintscript | 1 + debian/rules | 3 +- debian/tests/conditional-defines | 41 ++++++++++++++++ debian/tests/conditional-defines.pl | 70 ++++++++++++++++++++++++++++ debian/tests/control | 3 ++ debian/tests/privoxy-regression-test | 50 ++++++++++++++------ 7 files changed, 162 insertions(+), 16 deletions(-) create mode 100644 debian/tests/conditional-defines create mode 100755 debian/tests/conditional-defines.pl diff --git a/debian/changelog b/debian/changelog index 022e2d0b..b18610bd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,16 @@ privoxy (3.0.34~gitsnapshot-1) UNRELEASED; urgency=medium -- Roland Rosenfeld Thu, 09 Dec 2021 16:35:46 +0100 +privoxy (3.0.33-2) UNRELEASED; 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. + + -- Roland Rosenfeld Sat, 11 Dec 2021 10:36:30 +0100 + privoxy (3.0.33-1) unstable; urgency=medium * New upstream version 3.0.33. diff --git a/debian/maintscript b/debian/maintscript index 77e4ed98..d48b0975 100644 --- a/debian/maintscript +++ b/debian/maintscript @@ -1,3 +1,4 @@ rm_conffile /etc/privoxy/global.action 3.0.11-1~ privoxy rm_conffile /etc/privoxy/standard.action 3.0.11-1~ privoxy rm_conffile /etc/privoxy/templates/show-version 3.0.28-2~ privoxy +rm_conffile /etc/privoxy/templates/edit-actions-for-url-string-filter 3.0.33-2~ privoxy diff --git a/debian/rules b/debian/rules index d6c23b39..87c8cf44 100755 --- a/debian/rules +++ b/debian/rules @@ -1,6 +1,6 @@ #!/usr/bin/make -f # -# (c) 2002-2021 Roland Rosenfeld +# (c) 2002-2022 Roland Rosenfeld # # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -25,6 +25,7 @@ override_dh_auto_configure: --enable-external-filters \ --enable-extended-statistics \ --enable-pcre-host-patterns \ + --enable-compression \ --with-mbedtls \ --with-brotli \ --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular diff --git a/debian/tests/conditional-defines b/debian/tests/conditional-defines new file mode 100644 index 00000000..0f00d33f --- /dev/null +++ b/debian/tests/conditional-defines @@ -0,0 +1,41 @@ +#!/bin/sh +# +# Check http://config.privoxy.org/show-status for Conditional #defines enabled +# This wrapper starts privoxy on port 8119 and runs conditional-defines.pl +# +# (c) 2022 Roland Rosenfeld + +PORT=8119 + +TESTSDIR=$(dirname "$0") + +if [ -z "$AUTOPKGTEST_TMP" ]; then + AUTOPKGTEST_TMP=$(mktemp -d) +fi + +trap 'rm -rf "$AUTOPKGTEST_TMP"' EXIT + +CONFIG=$AUTOPKGTEST_TMP/config +PIDFILE=$AUTOPKGTEST_TMP/privoxy.pid +PRIVOXY=$AUTOPKGTEST_TMP/privoxy + +sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \ + -e "s%^logdir.*%logdir $AUTOPKGTEST_TMP%" \ + < /usr/share/privoxy/config > "$CONFIG" + +cp /usr/sbin/privoxy "$PRIVOXY" + +echo "Starting privoxy on port $PORT" +$PRIVOXY --pidfile "$PIDFILE" "$CONFIG" + +http_proxy=http://127.0.0.1:$PORT/ +export http_proxy + +"$TESTSDIR"/conditional-defines.pl +EXITVAL=$? + +echo "Stopping privoxy on port $PORT" +# shellcheck disable=SC2046 +kill $(cat "$PIDFILE") + +exit $EXITVAL diff --git a/debian/tests/conditional-defines.pl b/debian/tests/conditional-defines.pl new file mode 100755 index 00000000..d1554a3c --- /dev/null +++ b/debian/tests/conditional-defines.pl @@ -0,0 +1,70 @@ +#!/usr/bin/perl +# +# Check http://config.privoxy.org/show-status for Conditional #defines enabled +# +# (c) 2022 Roland Rosenfeld + +use strict; +use warnings; +use LWP::UserAgent (); +use HTML::TreeBuilder 5 -weak; + +my $exitcode = 0; + +my $ua = LWP::UserAgent->new(timeout => 10); +$ua->env_proxy; +my $response = $ua->get('http://config.privoxy.org/show-status'); +if (!$response->is_success) { + die $response->status_line; +} +my $tree = HTML::TreeBuilder->new; +$tree->parse($response->decoded_content); + +# Search for "Conditional #defines:" table: +my $summary = 'The state of some ./configure options and what they do.'; +my $table = $tree->look_down('_tag' => 'table', + 'summary' => $summary); +unless (defined $table) { + die "summary '$summary' not found in tables"; +} + +# These features are intentionaly disabled, all others should be enabled: +my %disabled_features = ('FEATURE_ACCEPT_FILTER' => 1, # BSD only + 'FEATURE_STRPTIME_SANITY_CHECKS' =>1, # BSD libc only + 'FEATURE_GRACEFUL_TERMINATION' =>1, # devel only + ); + +my $enabled = 0; +my $disabled_ok = 0; +my $disabled_nok = 0; +foreach my $tr ($table->look_down('_tag' => 'tr')) { + my $td2 = ($tr->look_down('_tag' => 'td')) [1]; + next unless defined $td2; + my $code = $tr->look_down('_tag' => 'code'); + my $feature = $code->detach_content; + 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; + $exitcode = 1; + $disabled_nok++; + } else { + $disabled_ok++; + } + } else { + $enabled++; + } +} + +printf "%d features enabled\n", $enabled; +printf "%d features intentionally disabled\n", $disabled_ok; +printf "%d features unintentionally disabled\n", $disabled_nok; + +if ($enabled < 10) { + printf STDERR "Found only %d Conditional #defines, seems test ist broken\n", + $enabled; + $exitcode = 1; +} + +exit $exitcode; diff --git a/debian/tests/control b/debian/tests/control index 1566c8fe..6ff73cfe 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,2 +1,5 @@ Tests: privoxy-regression-test Depends: curl, @ + +Tests: conditional-defines +Depends: privoxy, libwww-perl, libhtml-tree-perl diff --git a/debian/tests/privoxy-regression-test b/debian/tests/privoxy-regression-test index 1c29fa06..e8fdd9d9 100755 --- a/debian/tests/privoxy-regression-test +++ b/debian/tests/privoxy-regression-test @@ -3,7 +3,7 @@ # Run privoxy-regression-test.pl on a configuration extended by # regression-tests.action. # -# (c) 2018-2021 Roland Rosenfeld +# (c) 2018-2022 Roland Rosenfeld PORT=8119 @@ -11,37 +11,57 @@ if [ -z "$AUTOPKGTEST_TMP" ]; then AUTOPKGTEST_TMP=$(mktemp -d) fi -trap "rm -rf $AUTOPKGTEST_TMP" EXIT +trap 'rm -rf "$AUTOPKGTEST_TMP"' EXIT CONFIG=$AUTOPKGTEST_TMP/config PIDFILE=$AUTOPKGTEST_TMP/privoxy.pid PRIVOXY=$AUTOPKGTEST_TMP/privoxy +cp /usr/sbin/privoxy "$PRIVOXY" + +http_proxy=http://127.0.0.1:$PORT/ +export http_proxy + +OUTFILE=$AUTOPKGTEST_TMP/output + + +echo "#### pass 1: some optiones disabled" + sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \ -e "s%^logdir.*%logdir $AUTOPKGTEST_TMP%" \ - -e "s/^enable-edit-actions.*/enable-edit-actions 1/" \ -e "s/^keep-alive-timeout.*/keep-alive-timeout 21/" \ - -e "s/^#connection-sharing.*/connection-sharing 1/" \ - < /usr/share/privoxy/config > $CONFIG -echo "actionsfile regression-tests.action" >> $CONFIG - -cp /usr/sbin/privoxy $PRIVOXY + -e "s/^#connection-sharing.*/connection-sharing 0/" \ + < /usr/share/privoxy/config > "$CONFIG" +echo "actionsfile regression-tests.action" >> "$CONFIG" echo "Starting privoxy on port $PORT" -$PRIVOXY --pidfile $PIDFILE $CONFIG +$PRIVOXY --pidfile "$PIDFILE" "$CONFIG" -http_proxy=http://127.0.0.1:$PORT/ -export http_proxy +/usr/bin/privoxy-regression-test --max-level 200 --show-skipped-tests \ + | tee "$OUTFILE" 2>&1 -OUTFILE=$AUTOPKGTEST_TMP/output + +echo "#### pass 2 with some more options enabled" + +sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \ + -e "s%^logdir.*%logdir $AUTOPKGTEST_TMP%" \ + -e "s/^enable-remote-toggle.*/enable-remote-toggle 1/" \ + -e "s/^enable-edit-actions.*/enable-edit-actions 1/" \ + -e "s/^enable-proxy-authentication-forwarding.*/enable-proxy-authentication-forwarding 1/" \ + -e "s/^keep-alive-timeout.*/keep-alive-timeout 21/" \ + -e "s/^#connection-sharing.*/connection-sharing 1/" \ + < /usr/share/privoxy/config > "$CONFIG" +echo "actionsfile regression-tests.action" >> "$CONFIG" /usr/bin/privoxy-regression-test --max-level 200 --show-skipped-tests \ - | tee $OUTFILE 2>&1 + | tee -a "$OUTFILE" 2>&1 + echo "Stopping privoxy on port $PORT" -kill $(cat $PIDFILE) +kill "$(cat "$PIDFILE")" -if grep -q 'Executed.*, 0 failures.' $OUTFILE +# Check that 2 passes have both 0 failures: +if [ "$(grep -c 'Executed.*, 0 failures' "$OUTFILE")" = 2 ] then exit 0 else -- 2.39.2