From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: Mira Limbeck <m.limbeck@proxmox.com>
Cc: pmg-devel@lists.proxmox.com
Subject: Re: [pmg-devel] [PATCH pmg-log-tracker] change case sensitive string match to case insensitive
Date: Wed, 11 Nov 2020 18:50:42 +0100 [thread overview]
Message-ID: <20201111185042.3fef1e7b@rosa.proxmox.com> (raw)
In-Reply-To: <20201109141846.24669-1-m.limbeck@proxmox.com>
Thanks for addressing this so quickly!
applied the patch and tested it on my setup - works as expected:
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
On Mon, 9 Nov 2020 15:18:46 +0100
Mira Limbeck <m.limbeck@proxmox.com> wrote:
> With the rewrite from C to Rust the search string match was changed to
> be case sensitive by accident. Fix this by comparing the lowercase values
> of both the input and the search string.
>
> Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
> ---
> src/main.rs | 2 +-
> tests/tests_after_queue.rs | 23 +++++++++++++++++++++++
> tests/tests_before_queue.rs | 23 +++++++++++++++++++++++
> 3 files changed, 47 insertions(+), 1 deletion(-)
>
> diff --git a/src/main.rs b/src/main.rs
> index ce09f14..3495269 100644
> --- a/src/main.rs
> +++ b/src/main.rs
> @@ -1842,7 +1842,7 @@ impl Parser {
>
> self.string_match = false;
> if !self.options.string_match.is_empty()
> - && find(complete_line, self.options.string_match.as_bytes()).is_some()
> + && find_lowercase(complete_line, self.options.string_match.as_bytes()).is_some()
> {
> self.string_match = true;
> }
> diff --git a/tests/tests_after_queue.rs b/tests/tests_after_queue.rs
> index 42d0f6b..f6441fa 100644
> --- a/tests/tests_after_queue.rs
> +++ b/tests/tests_after_queue.rs
> @@ -114,3 +114,26 @@ fn after_queue_search_string() {
> let output_reader = BufReader::new(&output.stdout[..]);
> utils::compare_output(output_reader, expected_output);
> }
> +
> +#[test]
> +fn after_queue_search_string_case_insensitive() {
> + let output = Command::new(utils::log_tracker_path())
> + .arg("-vv")
> + .arg("-s")
> + .arg("1608302400")
> + .arg("-e")
> + .arg("1608303600")
> + .arg("-i")
> + .arg("tests/test_input_mixed")
> + .arg("-x")
> + .arg("reJECT")
> + .output()
> + .expect("failed to execute pmg-log-tracker");
> +
> + let expected_file = File::open("tests/test_output_after_queue_search_string")
> + .expect("failed to open test_output");
> +
> + let expected_output = BufReader::new(&expected_file);
> + let output_reader = BufReader::new(&output.stdout[..]);
> + utils::compare_output(output_reader, expected_output);
> +}
> diff --git a/tests/tests_before_queue.rs b/tests/tests_before_queue.rs
> index bd46e53..fb7a149 100644
> --- a/tests/tests_before_queue.rs
> +++ b/tests/tests_before_queue.rs
> @@ -114,6 +114,29 @@ fn before_queue_search_string() {
> utils::compare_output(output_reader, expected_output);
> }
>
> +#[test]
> +fn before_queue_search_string_case_insensitive() {
> + let output = Command::new(utils::log_tracker_path())
> + .arg("-vv")
> + .arg("-s")
> + .arg("1608300000")
> + .arg("-e")
> + .arg("1608302400")
> + .arg("-i")
> + .arg("tests/test_input_mixed")
> + .arg("-x")
> + .arg("reJECT")
> + .output()
> + .expect("failed to execute pmg-log-tracker");
> +
> + let expected_file = File::open("tests/test_output_before_queue_search_string")
> + .expect("failed to open test_output");
> +
> + let expected_output = BufReader::new(&expected_file);
> + let output_reader = BufReader::new(&output.stdout[..]);
> + utils::compare_output(output_reader, expected_output);
> +}
> +
> #[test]
> fn before_queue_exclude_greylist_ndr() {
> let output = Command::new(utils::log_tracker_path())
next prev parent reply other threads:[~2020-11-11 17:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-09 14:18 Mira Limbeck
2020-11-11 17:50 ` Stoiko Ivanov [this message]
2020-11-17 7:45 ` [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=20201111185042.3fef1e7b@rosa.proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=m.limbeck@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.