From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.haj.ipfire.org (localhost [IPv6:::1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4fKJgM4bljz33m2 for ; Mon, 23 Feb 2026 11:35:11 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [IPv6:2001:678:b28::25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (Client CN "mail01.haj.ipfire.org", Issuer "R12" (not verified)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4fKJg04DLQz2xLw for ; Mon, 23 Feb 2026 11:34:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4fKJfx4mNMz3mF; Mon, 23 Feb 2026 11:34:49 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1771846489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pzngDydtIIbMWlmH0NJFq/A9dMm6TSsBOCd/7EntO+U=; b=HBXZQXwUHLOW79XRTg5WQdoy2TMiDKcdildnYLGwddbc+rBkra9VqIUMGv9B+oV8NLtjDj 5ZsXuEcyR0YxTYBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1771846489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pzngDydtIIbMWlmH0NJFq/A9dMm6TSsBOCd/7EntO+U=; b=ops6CUmF7sdkcLLqt/8KybcetlUDElqkur8Z2ySMlketXmQj5tGrLYORSZx3k9Np4SUOSU PCONEBv0Yq9JhtyDPmTv2Qa+RyPQYEPdEsMKyfG7flEIeNeSP4AcAla/l9gO6SuhBsDSqD 8fFtnjDcpNxFZ/lFzpG9YZsl6VCXiZEILvqSw73DI4dDOckSEt2P1tPNPuUb7pJmgNntcn D/8SQ5jciyRMDMsLiwsreTgAMcfsEWcMZNVzpa+NB7Pmcsb6udqtNhpabIU/L27gokQRtG Y0jafjfJ91d5TxatMusiDF/exf11VOCdJ0T54Z4OuQMl9H40liA47O6vmQtIKg== Content-Type: text/plain; charset=us-ascii Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: Mime-Version: 1.0 Subject: Re: [PATCH 1/2] urlfiler: Cleanup list directory during update From: Michael Tremer In-Reply-To: <20260222190753.10632-1-stefan.schantl@ipfire.org> Date: Mon, 23 Feb 2026 11:34:49 +0000 Cc: development@lists.ipfire.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20260222190753.10632-1-stefan.schantl@ipfire.org> To: Stefan Schantl Hello Stefan, Thank you for these patches. I added another like so that the custom lists will be kept: = https://git.ipfire.org/?p=3Dipfire-2.x.git;a=3Dcommitdiff;h=3D0ba18609bde2= 16ef9ad8c485a8852e5080e32e34 All the best, -Michael > On 22 Feb 2026, at 19:07, Stefan Schantl = wrote: >=20 > Cleanup the directory which contains the downloaded blocklists during > the update process. As the same code is used for sheduled and manual > updates/list installs this also cleans up old lists when switching the > lists provider. >=20 > Fixes #13820. >=20 > Signed-off-by: Stefan Schantl > --- > config/urlfilter/autoupdate.pl | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) >=20 > diff --git a/config/urlfilter/autoupdate.pl = b/config/urlfilter/autoupdate.pl > index 39b9b4f0b..05db6e339 100644 > --- a/config/urlfilter/autoupdate.pl > +++ b/config/urlfilter/autoupdate.pl > @@ -7,6 +7,7 @@ > # $Id: autoupdate.pl,v 1.1 2007/03/14 00:00:00 marco.s Exp $ > # > use strict; > +use File::Path; >=20 > require "/var/ipfire/general-functions.pl"; >=20 > @@ -115,6 +116,7 @@ unless ($blacklist_url eq '') >=20 > system("/usr/bin/squidGuard -d -c $target/update.conf -C all"); >=20 > + &cleanupdbdir(); > system("cp -r $target/blacklists/* $dbdir"); >=20 > system("chown -R nobody.nobody $dbdir"); > @@ -214,3 +216,27 @@ sub setpermissions > } >=20 > # ------------------------------------------------------------------- > + > +sub cleanupdbdir { > + # Open the database directory and do a directory listing. > + opendir(DIR, "$dbdir") or die "Cannot open $dbdir. $!\n"; > + > + # Loop through the directory. > + while (my $item =3D readdir(DIR)) { > + # Skip . and .. > + next if ($item eq "."); > + next if ($item eq ".."); > + > + # Generate absolute path. > + my $abs_path =3D "$dbdir/$item"; > + > + # Skip anything which is not a directory. > + next unless (-d "$abs_path"); > + > + # Remove the directory and the content. > + &File::Path::remove_tree($abs_path); > + } > + > + # Close directory handle. > + closedir(DIR); > +} > --=20 > 2.47.3 >=20 >=20