From: Dodji Seketeli <dodji@seketeli.org>
To: Giuliano Procida <gprocida@google.com>
Cc: libabigail@sourceware.org, kernel-team@android.com,
maennich@google.com
Subject: Re: [PATCH 1/3] test-diff-suppr: Improve regexes in tests.
Date: Wed, 22 Apr 2020 15:48:21 +0200 [thread overview]
Message-ID: <87a733d42i.fsf@seketeli.org> (raw)
In-Reply-To: <20200420164153.5213-1-gprocida@google.com> (Giuliano Procida's message of "Mon, 20 Apr 2020 17:41:50 +0100")
Hello Giuliano,
Giuliano Procida <gprocida@google.com> a écrit:
> The are some (mostly inconsequential) issues with regexes:
>
> - Leading and trailing .* are redundant and can be removed.
They are redundant I agree, but that redundancy can be useful, I think.
The reason why I have put them in the test is that in the past, I have
tried different regular expression engines. Some of them would
implement the quantifier in a greedy manner, rather than in a lazy
manner. Whereas, what I find more useful is the lazy variant. So that
writing ".*blah" would do what you would expect (rather than having to
write .*?blah)
So putting that in those tests explicitly will hopefully help us catch
potential issues if we are to switch to a different engine tomorrow. So
I'd prefer keeping that redundancy in those tests.
[...]
> - File name matches are full path
Are they?
It seems to me file_suppression::suppress_file() acts on the base name
of the file, rather than on its full path.
I might be missing something here, please tell me.
> so should start with (^|/) if trying to match a base name, assuming a
> Unix-like filesystem.
I'd need the above to be clarified to say for sure.
> Given these are just tests, it's not that important, but they
> still serve as examples.
> - In cases where the ^ anchor was used, full paths would usually
> fail to match. In such cases, the regex was being ignored for
> other reasons (see later patch) or is expected not to match
> anyway.
> - In many cases, the $ anchor could be considered to be missing.
> - The .ini parser unescapes string values, so escaping regex
> metacharacters requires a double backslash. Single backslashes
> are pointless.
> - The dot metacharacter is used unescaped in a few places where a
> literal was likely intended, so should be escaped.
> - The characters [ and ] don't need to be (.ini) escaped.
They don't *need* to (in a string) I agree. But it they are escaped,
that should work. It's a way to test the init parser as well. So I'd
keep the redundancy there as well.
[...]
Cheers,
--
Dodji
next prev parent reply other threads:[~2020-04-22 13:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 16:41 Giuliano Procida
2020-04-20 16:41 ` [PATCH 2/3] test35-leaf.suppr: fix regex typo Giuliano Procida
2020-04-21 10:20 ` Matthias Maennich
2020-04-22 13:56 ` Dodji Seketeli
2020-04-20 16:41 ` [PATCH 3/3] test24-soname-suppr*txt: Fix suppression syntax Giuliano Procida
2020-04-20 17:20 ` Giuliano Procida
2020-04-20 17:23 ` [PATCH 3/3 v2] " Giuliano Procida
2020-04-21 10:24 ` Matthias Maennich
2020-04-22 15:05 ` Dodji Seketeli
2020-04-21 10:19 ` [PATCH 1/3] test-diff-suppr: Improve regexes in tests Matthias Maennich
2020-04-21 10:57 ` Giuliano Procida
2020-04-22 13:48 ` Dodji Seketeli [this message]
2020-04-22 19:11 ` Giuliano Procida
2020-05-01 15:56 ` Giuliano Procida
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=87a733d42i.fsf@seketeli.org \
--to=dodji@seketeli.org \
--cc=gprocida@google.com \
--cc=kernel-team@android.com \
--cc=libabigail@sourceware.org \
--cc=maennich@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).