[pmg-devel] [PATCH pmg-log-tracker 1/3] fix before-queue filter string_match check

Mira Limbeck m.limbeck at proxmox.com
Tue May 19 15:31:05 CEST 2020


In before-queue filtering a filter can be set on the SEntry. When a
search-string is set, we have to check both the SEntry and the attached
filter for a match, not just the SEntry. Otherwise some entries are not shown.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
 src/main.rs | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 24e21c3..394d8ac 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -953,9 +953,18 @@ impl SEntry {
         }
 
         // don't print if there's a string match specified, but none of the
-        // log entries matches
-        if !parser.options.string_match.is_empty() && !self.string_match {
-            return;
+        // log entries matches. in the before-queue case we also have to check
+        // the attached filter for a match
+        if !parser.options.string_match.is_empty() {
+            if let Some(fe) = &self.filter() {
+                if !self.string_match && !fe.borrow().string_match {
+                    return;
+                }
+            } else {
+                if !self.string_match {
+                    return;
+                }
+            }
         }
 
         if parser.options.verbose > 0 {
-- 
2.20.1




More information about the pmg-devel mailing list