all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] utils: custom check: fix error in spamscore regex
Date: Tue, 18 Jun 2024 17:30:15 +0200	[thread overview]
Message-ID: <20240618153015.51851-1-s.ivanov@proxmox.com> (raw)

Currently a reply with a negative spam-score with fractional part like:
v1
SCORE: -1.52
yields an error (as the optional '-' is only accepted as part of the
first alternative.

quickly tested with a very minimal custom-checkscript (that returns
the output above).

reported in our community forum:
https://forum.proxmox.com/threads/.148927/#post-675209

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/Utils.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index 5d9ded4..b91d697 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -383,7 +383,7 @@ sub analyze_custom_check {
 		$customcheck_output_apiver = $line;
 		die "api version mismatch - expected $customcheck_apiver, got $customcheck_output_apiver !\n"
 		    if ($customcheck_output_apiver ne $customcheck_apiver);
-	    } elsif ($line =~ /^SCORE: (-?[0-9]+|.[0-9]+|[0-9]+.[0-9]+)$/) {
+	    } elsif ($line =~ /^SCORE: (-?(?:[0-9]+|.[0-9]+|[0-9]+.[0-9]+))$/) {
 		$spam_score = $1;
 		$result_flag = 1;
 	    } elsif ($line =~ /^VIRUS: (.+)$/) {
-- 
2.39.2



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


             reply	other threads:[~2024-06-18 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 15:30 Stoiko Ivanov [this message]
2024-11-11 23:03 ` [pmg-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240618153015.51851-1-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal