-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portably escape pipe characters in diff --ignore-matching-lines
regexes
#111171
Conversation
This snapshot fell out of sync while the `diff --ignore-matching-lines` regexes were silently broken on Linux.
(rustbot has picked a reviewer for you, use r? to override) |
Over in Zulip I mentioned that I was going to add some extra checks as well, to ensure that I did try writing some checks, but they ended up being so complex and fragile that they ultimately didn't seem to be a net improvement, so I've left them out for now. |
I might have a go at implementing instantiation-sorting by piping the output through a Python script, so I can get rid of all this |
Closing this in favour of the Python-based sort filter that I've written. |
…acrum Fix instrument-coverage tests by using Python to sort instantiation groups rust-lang#110942 was intended to fix a set of `-Cinstrument-coverage` tests, but it ended up silently *breaking* those tests on Linux, for annoying reasons detailed at rust-lang#111171. Dealing with `diff --ignore-matching-lines` across multiple platforms has been such a hassle that I've instead written a simple Python script that can detect instantiation groups in the output of `llvm-cov show`, and sort them in a predictable order so that they can be used as snapshots for an ordinary invocation of `diff`. This approach should be much less error-prone, because it can't accidentally ignore the wrong lines, and any unforeseen problems will tend to result in a Python exception or a failing diff.
…acrum Fix instrument-coverage tests by using Python to sort instantiation groups rust-lang#110942 was intended to fix a set of `-Cinstrument-coverage` tests, but it ended up silently *breaking* those tests on Linux, for annoying reasons detailed at rust-lang#111171. Dealing with `diff --ignore-matching-lines` across multiple platforms has been such a hassle that I've instead written a simple Python script that can detect instantiation groups in the output of `llvm-cov show`, and sort them in a predictable order so that they can be used as snapshots for an ordinary invocation of `diff`. This approach should be much less error-prone, because it can't accidentally ignore the wrong lines, and any unforeseen problems will tend to result in a Python exception or a failing diff.
…acrum Fix instrument-coverage tests by using Python to sort instantiation groups rust-lang#110942 was intended to fix a set of `-Cinstrument-coverage` tests, but it ended up silently *breaking* those tests on Linux, for annoying reasons detailed at rust-lang#111171. Dealing with `diff --ignore-matching-lines` across multiple platforms has been such a hassle that I've instead written a simple Python script that can detect instantiation groups in the output of `llvm-cov show`, and sort them in a predictable order so that they can be used as snapshots for an ordinary invocation of `diff`. This approach should be much less error-prone, because it can't accidentally ignore the wrong lines, and any unforeseen problems will tend to result in a Python exception or a failing diff.
#110942 was supposed to fix the regexes used by
diff --ignore-matching-lines
in the instrument-coverage tests.But based on my investigations in #111116, it turns out that that change successfully fixed the tests on Mac, while silently breaking them on Linux (which is where they actually get run in CI).
The underlying cause is that GNU
diff
and Apple/FreeBSDdiff
use slightly different regex dialects, with a crucial difference:|
as a literal pipe character, and treats\|
as a regex OR operator|
as a regex OR operator, and treats\|
as a literal pipe character.This is very frustrating, and ideally I would rip out all of this code and replace it with something written in Rust or Python. But for now, my focus is on making a small fix that will restore the tests to proper working order on both Linux and Mac.
Fortunately, there is a way to portably match a literal pipe character in both
diff
implementations: wrap it in a character class[|]
. So that's what this PR does.