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 4fWqhr15B2z33gg for ; Thu, 12 Mar 2026 14:27:56 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (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 4fWqhY0PJyz2xP7 for ; Thu, 12 Mar 2026 14:27:41 +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 4fWqhW3cPyz5hG; Thu, 12 Mar 2026 14:27:39 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1773325659; 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=Df8hn7iXqT0eSAz5c2/X1EocbiroHWdSsP8PYy4hclk=; b=qUudfolmIR/v3l/h29tjqZsY24CJO267Y2PMBWDsqtz6HdtckJ/Pd5z1blWbVp/TCTlpfi ZQI3M1w+UwkE7vBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1773325659; 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=Df8hn7iXqT0eSAz5c2/X1EocbiroHWdSsP8PYy4hclk=; b=O7FlomjQ/yWJCl+xeMN1Jcl1aFf43s04isbzagxh+g7synvBoLAhgVQRshlusftHtmet8u Q846QK71xJPMvwf37wVUEVS/zbb1AiiEOZ1aU5WflxM76bOOcSP5oQvuF2VbVOWLintoWD Q22wGI0N+0VBdqY/t+BdJHQincAfy1h1qsnSBHgyf4TS2AKIKP1nHlJKPKCIKT4fET+EzS ZllY6oU22V8q0U0bXeqIeROjv3+H2ZmruIQYWa/W8gWYl7JxnUSsetdPXZkTEbvP1nTPLp /9CrCpQsSDVpS7XLh4m3fLrZWeT3qKPOkuwr7kSPVp3VPjV9P1I8Gwf8f1QxrA== 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: Date: Thu, 12 Mar 2026 14:27:38 +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, It looks like the cleanup function is leaving behind some symlinks which = trip over some other parts of the code. Could you please check? = https://community.ipfire.org/t/url-filter-missing-categories/15593?u=3Dms Best, -Michael > On 23 Feb 2026, at 11:34, Michael Tremer = wrote: >=20 > Hello Stefan, >=20 > Thank you for these patches. >=20 > I added another like so that the custom lists will be kept: >=20 > = https://git.ipfire.org/?p=3Dipfire-2.x.git;a=3Dcommitdiff;h=3D0ba18609bde2= 16ef9ad8c485a8852e5080e32e34 >=20 > All the best, > -Michael >=20 >> 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 >=20