* [PATCH 1/2] urlfiler: Cleanup list directory during update
@ 2026-02-22 19:07 Stefan Schantl
2026-02-22 19:07 ` [PATCH 2/2] urlfilter: Fix syntax when calling chown Stefan Schantl
2026-02-23 11:34 ` [PATCH 1/2] urlfiler: Cleanup list directory during update Michael Tremer
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Schantl @ 2026-02-22 19:07 UTC (permalink / raw)
To: development; +Cc: Stefan Schantl
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.
Fixes #13820.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
config/urlfilter/autoupdate.pl | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
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;
require "/var/ipfire/general-functions.pl";
@@ -115,6 +116,7 @@ unless ($blacklist_url eq '')
system("/usr/bin/squidGuard -d -c $target/update.conf -C all");
+ &cleanupdbdir();
system("cp -r $target/blacklists/* $dbdir");
system("chown -R nobody.nobody $dbdir");
@@ -214,3 +216,27 @@ sub setpermissions
}
# -------------------------------------------------------------------
+
+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 = readdir(DIR)) {
+ # Skip . and ..
+ next if ($item eq ".");
+ next if ($item eq "..");
+
+ # Generate absolute path.
+ my $abs_path = "$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);
+}
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] urlfilter: Fix syntax when calling chown
2026-02-22 19:07 [PATCH 1/2] urlfiler: Cleanup list directory during update Stefan Schantl
@ 2026-02-22 19:07 ` Stefan Schantl
2026-02-23 11:34 ` [PATCH 1/2] urlfiler: Cleanup list directory during update Michael Tremer
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Schantl @ 2026-02-22 19:07 UTC (permalink / raw)
To: development; +Cc: Stefan Schantl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
config/urlfilter/autoupdate.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/urlfilter/autoupdate.pl b/config/urlfilter/autoupdate.pl
index 05db6e339..f051fec42 100644
--- a/config/urlfilter/autoupdate.pl
+++ b/config/urlfilter/autoupdate.pl
@@ -119,12 +119,12 @@ unless ($blacklist_url eq '')
&cleanupdbdir();
system("cp -r $target/blacklists/* $dbdir");
- system("chown -R nobody.nobody $dbdir");
+ system("chown -R nobody:nobody $dbdir");
&setpermissions ($dbdir);
system("touch $updflagfile");
- system("chown nobody.nobody $updflagfile");
+ system("chown nobody:nobody $updflagfile");
system("/etc/init.d/squid restart");
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] urlfiler: Cleanup list directory during update
2026-02-22 19:07 [PATCH 1/2] urlfiler: Cleanup list directory during update Stefan Schantl
2026-02-22 19:07 ` [PATCH 2/2] urlfilter: Fix syntax when calling chown Stefan Schantl
@ 2026-02-23 11:34 ` Michael Tremer
2026-03-12 14:27 ` Michael Tremer
1 sibling, 1 reply; 4+ messages in thread
From: Michael Tremer @ 2026-02-23 11:34 UTC (permalink / raw)
To: Stefan Schantl; +Cc: development
Hello Stefan,
Thank you for these patches.
I added another like so that the custom lists will be kept:
https://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff;h=0ba18609bde216ef9ad8c485a8852e5080e32e34
All the best,
-Michael
> On 22 Feb 2026, at 19:07, Stefan Schantl <stefan.schantl@ipfire.org> wrote:
>
> 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.
>
> Fixes #13820.
>
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
> config/urlfilter/autoupdate.pl | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> 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;
>
> require "/var/ipfire/general-functions.pl";
>
> @@ -115,6 +116,7 @@ unless ($blacklist_url eq '')
>
> system("/usr/bin/squidGuard -d -c $target/update.conf -C all");
>
> + &cleanupdbdir();
> system("cp -r $target/blacklists/* $dbdir");
>
> system("chown -R nobody.nobody $dbdir");
> @@ -214,3 +216,27 @@ sub setpermissions
> }
>
> # -------------------------------------------------------------------
> +
> +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 = readdir(DIR)) {
> + # Skip . and ..
> + next if ($item eq ".");
> + next if ($item eq "..");
> +
> + # Generate absolute path.
> + my $abs_path = "$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);
> +}
> --
> 2.47.3
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] urlfiler: Cleanup list directory during update
2026-02-23 11:34 ` [PATCH 1/2] urlfiler: Cleanup list directory during update Michael Tremer
@ 2026-03-12 14:27 ` Michael Tremer
0 siblings, 0 replies; 4+ messages in thread
From: Michael Tremer @ 2026-03-12 14:27 UTC (permalink / raw)
To: Stefan Schantl; +Cc: development
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=ms
Best,
-Michael
> On 23 Feb 2026, at 11:34, Michael Tremer <michael.tremer@ipfire.org> wrote:
>
> Hello Stefan,
>
> Thank you for these patches.
>
> I added another like so that the custom lists will be kept:
>
> https://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff;h=0ba18609bde216ef9ad8c485a8852e5080e32e34
>
> All the best,
> -Michael
>
>> On 22 Feb 2026, at 19:07, Stefan Schantl <stefan.schantl@ipfire.org> wrote:
>>
>> 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.
>>
>> Fixes #13820.
>>
>> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
>> ---
>> config/urlfilter/autoupdate.pl | 26 ++++++++++++++++++++++++++
>> 1 file changed, 26 insertions(+)
>>
>> 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;
>>
>> require "/var/ipfire/general-functions.pl";
>>
>> @@ -115,6 +116,7 @@ unless ($blacklist_url eq '')
>>
>> system("/usr/bin/squidGuard -d -c $target/update.conf -C all");
>>
>> + &cleanupdbdir();
>> system("cp -r $target/blacklists/* $dbdir");
>>
>> system("chown -R nobody.nobody $dbdir");
>> @@ -214,3 +216,27 @@ sub setpermissions
>> }
>>
>> # -------------------------------------------------------------------
>> +
>> +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 = readdir(DIR)) {
>> + # Skip . and ..
>> + next if ($item eq ".");
>> + next if ($item eq "..");
>> +
>> + # Generate absolute path.
>> + my $abs_path = "$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);
>> +}
>> --
>> 2.47.3
>>
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-12 14:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-22 19:07 [PATCH 1/2] urlfiler: Cleanup list directory during update Stefan Schantl
2026-02-22 19:07 ` [PATCH 2/2] urlfilter: Fix syntax when calling chown Stefan Schantl
2026-02-23 11:34 ` [PATCH 1/2] urlfiler: Cleanup list directory during update Michael Tremer
2026-03-12 14:27 ` Michael Tremer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox