Louis-Philippe Véronneau pushed to branch master at lintian / lintian
Commits:
00a495d8 by Timo Paulssen at 2026-01-14T22:40:39+00:00
Files/Generated: Use SlidingWindow instead of getline
Going over the file with a smaller regex first and skipping
the relatively slower getline loop if there's no matches at
all in the file.
- - - - -
4b69faf9 by Nilesh Patra at 2026-01-14T22:40:39+00:00
Run Generated file check on regular files
- - - - -
1 changed file:
- lib/Lintian/Check/Files/Generated.pm
Changes:
=====================================
lib/Lintian/Check/Files/Generated.pm
=====================================
@@ -34,6 +34,9 @@ const my $DOUBLE_QUOTE => q{"};
with 'Lintian::Check';
+use constant BLOCKSIZE => 16_384;
+use Lintian::SlidingWindow;
+
sub visit_patched_files {
my ($self, $item) = @_;
@@ -44,9 +47,33 @@ sub visit_patched_files {
return
unless $item->is_open_ok;
+ return
+ unless $item->is_regular_file;
+
open(my $fd, '<', $item->unpacked_path)
or die encode_utf8('Cannot open ' . $item->unpacked_path);
+ my $sfd = Lintian::SlidingWindow->new;
+ $sfd->handle($fd);
+ $sfd->blocksize(BLOCKSIZE);
+ $sfd->blocksub(sub { $_ = lc; });
+
+ my $found_one = 0;
+
+ while (my $lowercase = $sfd->readwindow()) {
+ if ($lowercase =~ / autogenerated | do [ ] not [ ] edit /msx) {
+ $found_one = 1;
+ last;
+ }
+ }
+
+ if ($found_one == 0) {
+ close $fd;
+ return;
+ }
+
+ seek $fd, 0, 0;
+
my $position = 1;
while (my $line = <$fd>) {
View it on GitLab:
https://salsa.debian.org/lintian/lintian/-/compare/691c0989f24c17a8362b4c04992f1ae57c4de6da...4b69faf937d2f9a1d63b5815ac847bb27f311f6b
--
View it on GitLab:
https://salsa.debian.org/lintian/lintian/-/compare/691c0989f24c17a8362b4c04992f1ae57c4de6da...4b69faf937d2f9a1d63b5815ac847bb27f311f6b
You're receiving this email because of your account on salsa.debian.org.