[amavisd-new PATCH] Improve toc parsing for cabextract
Thomas Jarosch
thomas.jarosch at intra2net.com
Wed Jul 2 12:29:45 CEST 2014
These errors were logged by amavisd-new:
---snip-------------------------
amavis[2643]: (02643-05) (!)do_cabextract: can't parse toc line: File size | Date Time | Name
amavis[2643]: (02643-05) (!)do_cabextract: can't parse toc line: All done, no errors.
---snap-------------------------
Testing cabextract manually showed this output:
---snip-------------------------
Viewing cabinet: 12132.cab
File size | Date Time | Name
-----------+---------------------+-------------
122880 | 01.07.2014 15:15:52 | gasetz_01_07_2014_F8484273.exe
All done, no errors
---snap-------------------------
Fix it by making the regex more relaxed for cabextract version 1.2.
Also ignore the "All done, no errors" final output, so warnings would still be logged.
diff -u -r -p amavisd-new-2.9.1/amavisd amavisd-new.cabextract/amavisd
--- amavisd-new-2.9.1/amavisd 2014-06-27 19:46:02.000000000 +0200
+++ amavisd-new.cabextract/amavisd 2014-07-02 09:30:42.431978269 +0200
@@ -30989,7 +30989,7 @@ sub do_cabextract($$$) {
local($1,$2); my $bytes = 0; my $ln; my $entries_cnt = 0;
for ($! = 0; defined($ln=$proc_fh->getline); $! = 0) {
chomp($ln);
- next if $ln =~ /^(File size|----|Viewing cabinet:|\z)/;
+ next if $ln =~ /^( ?File size|----|Viewing cabinet:|All done, no errors|\z)/;
if ($entries_cnt++, $MAXFILES && $entries_cnt > $MAXFILES)
{ die "Maximum number of files ($MAXFILES) exceeded" }
if ($ln !~ /^\s* (\d+) \s* \| [^|]* \| \s (.*) \z/x) {
More information about the amavis-users
mailing list