From 59efc757f67fd2689be150f6537fa55e6f003d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20=C3=89LIE?= Date: Wed, 27 Dec 2023 13:32:18 +0100 Subject: [PATCH] scanspool: Detect empty files see #288 --- doc/pod/news.pod | 4 ++++ frontends/scanspool.in | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/pod/news.pod b/doc/pod/news.pod index bcfe362ca..0994acb52 100644 --- a/doc/pod/news.pod +++ b/doc/pod/news.pod @@ -124,6 +124,10 @@ Jesse Rehmer for the bug report and Bo Lindbergh for the fix. =item * +B now detects empty files in a tradspool news spool. + +=item * + B no longer malfunctions nor throttles when the maximum number of file descriptors supported by the system is reached. If needing to use more file descriptors than the default system limit, a new C option diff --git a/frontends/scanspool.in b/frontends/scanspool.in index 52166688d..5709aabc4 100644 --- a/frontends/scanspool.in +++ b/frontends/scanspool.in @@ -415,10 +415,11 @@ sub check_spool { next; } + @group = (); + # read until the Newsgroups header field is found AREADLINE: while ($aline = <$ARTICLE>) { - # catch the Newsgroups header field if ($aline =~ /^Newsgroups:\w*\W/io) { # convert $aline into a comma separated list of groups @@ -460,6 +461,11 @@ sub check_spool { } } + if (scalar(@group) == 0) { + problem("WARNING: $filename: no Newsgroups header field " + . "(empty file)"); + } + # close the article close $ARTICLE; }