-
Notifications
You must be signed in to change notification settings - Fork 608
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
Add missing escapeForDot()
to labels for function names
#564
Conversation
In some programming languages, e.g. JuliaLang, function names can contain arbitrary characters. These are represented via the string macro `var"..."`, which allows constructing identifiers that wouldn't otherwise parse. These names are handled correctly by `pprof` in the FlameGraph view, but before this commit, they would produce an invalid dot file. This fixes the dot graph export for names that contain `"`.
Hello! 👋 I believe this is my first contribution to I am one of the maintainers of PProf.jl, the However, as described above, julia function names can be quite messy, and I encountered a case where I've tested the above fix locally, and the tests pass, but it appears that some of the build tests have failed. Help here would be very much appreciated. Thanks much! |
…otentially harmful string labels. Remove mistaken `escapeStringForDot()` around tag names
78c9e82
to
5d0860e
Compare
Based on the ci output, it looks like the Otherwise, I think the tests should be passing now. :) Please take a look when you're available. Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #564 +/- ##
==========================================
- Coverage 68.46% 67.15% -1.31%
==========================================
Files 78 78
Lines 16108 14076 -2032
==========================================
- Hits 11028 9453 -1575
+ Misses 4225 3788 -437
+ Partials 855 835 -20
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am curious on what the code coverage dropped so substantially.
Yeah, it's really weird, right? I saw that too, and it led me to believe the coverage tool must be flaky. Do you find it to be usually quite reliable? I added a test case that I believe covers the cases I've modified the code for. But maybe I messed something else up somehow? I would appreciate guidance here since I'm not a regular go programmer. 🙈 Thanks for your help so far! :) |
1be6a7b
to
dff1afc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL. This is again ready for review.
I have applied the renaming we suggested.
Also, as long as I was looking at this, I've also added escaping for Tags, which actually proved to be a bit more difficult, since graph.go
was already doing some manual escaping of \n
, which wound up double escaped.
I've sorted that all out, but since it's a fairly sizeable PR as well, I've opened it as a separate PR against this branch, here:
NHDaly#1
Please take a look at that PR as well if you get a chance, and we can either merge it directly into this branch first if you prefer merging a single PR, or we can take them one at a time. It's up to you. Thanks!
(I tried opening it directly against this repo, but then i couldn't base it on top of this PR. GitHub still has some rough edges...)
Two Windows tests are failing. |
Codecov Report
@@ Coverage Diff @@
## master #564 +/- ##
=======================================
Coverage 67.14% 67.14%
=======================================
Files 78 78
Lines 14078 14082 +4
=======================================
+ Hits 9452 9455 +3
- Misses 3791 3792 +1
Partials 835 835
Continue to review full report at Codecov.
|
Ugh, thanks. It appears that the failure is because now we're escaping the backslashes in windows paths, e.g. from I'm very unsure what to do about this. If so, I guess we can just fix the test to expect the new behavior instead of finding some way to disable it on windows. Also, it looks like the coverage report is back to normal, so that's good! :) |
I would expect that double slashes should be escaped in the *.dot file strings, yes. |
I had unwittingly copied a test that was _specifically tesing_ Residual edges (the name of the test set I copied was `TestComposeWithTagsAndResidualEdge`). In my test, I'm simply testing the printing of the _names_ of the edges, and it's not relevant whether the edges are residual or not, so I've removed it just to simplify the test.
Awesome, thanks! |
4beaf0b
to
28a8f81
Compare
… in paths This PR adds proper escaping to dot strings, so that the backslash (`\`) in windows paths will now print correctly in dot output. Previously, the tests were incorreclty checking for an unescaped single `\` in the output, which isn't a valid `dot` string, so this commit updates the dot tests to expect the newly correct output. Updates the path testing assertions in various test files
28a8f81
to
9061b08
Compare
@aalexand - I have (finally) fixed all the remaining windows test failures! :) If you could, would you please take another look when you get the chance? Thanks very much! |
Friendly ping: this is now ready for final review :) Thanks again for all the help so far! |
@NHDaly I'll take a look at it by EOW, sorry for the delay. |
:) Thanks, no worries at all! :) I just wanted to be sure this stays on your radar 👍 |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to determine that you authored the commits in this PR. Maybe you used a different email address in the git commits than was used to sign the CLA? If someone else authored these commits, then please add them to this pull request and have them confirm that they're okay with them being contributed to Google. If there are co-authors, make sure they're formatted properly. In order to pass this check, please resolve this problem and then comment ℹ️ Googlers: Go here for more info. |
fc32837
to
064b590
Compare
@googlebot I fixed it. |
(oh, whoops, sorry, I hadn't re-requested a Review from you through the GitHub UI. I've done that now! 👍) i've also updated the top-level comment with Review Guidelines that explain the changes in this PR and will hopefully make it easier to review. Thanks!! :) |
Awesome. Thank you very much for your help and your time! :) |
Bump from 20191205061153 => 20201109224723 My personal interest is to pull in google/pprof#564, which adds support for displaying names with `"` in them, which julia functions sometimes have (e.g. `var"#foo#23"`) Includes: - google/pprof#564 - google/pprof#575 - google/pprof#574 - google/pprof#571 - google/pprof#572 - google/pprof#570 - google/pprof#562 - google/pprof#561 - google/pprof#565 - google/pprof#560 - google/pprof#563 - google/pprof#557 - google/pprof#554 - google/pprof#552 - google/pprof#545 - google/pprof#549 - google/pprof#547 - google/pprof#541 - google/pprof#534 - google/pprof#542 - google/pprof#535 - google/pprof#531 - google/pprof#530 - google/pprof#528 - google/pprof#522 - google/pprof#525 - google/pprof#527 - google/pprof#519 - google/pprof#520 - google/pprof#517 - google/pprof#518 - google/pprof#514 - google/pprof#513 - google/pprof#510 - google/pprof#508 - google/pprof#506 - google/pprof#509 - google/pprof#504
* Update pprof to latest revision Bump from 20191205061153 => 20201109224723 My personal interest is to pull in google/pprof#564, which adds support for displaying names with `"` in them, which julia functions sometimes have (e.g. `var"#foo#23"`) Includes: - google/pprof#564 - google/pprof#575 - google/pprof#574 - google/pprof#571 - google/pprof#572 - google/pprof#570 - google/pprof#562 - google/pprof#561 - google/pprof#565 - google/pprof#560 - google/pprof#563 - google/pprof#557 - google/pprof#554 - google/pprof#552 - google/pprof#545 - google/pprof#549 - google/pprof#547 - google/pprof#541 - google/pprof#534 - google/pprof#542 - google/pprof#535 - google/pprof#531 - google/pprof#530 - google/pprof#528 - google/pprof#522 - google/pprof#525 - google/pprof#527 - google/pprof#519 - google/pprof#520 - google/pprof#517 - google/pprof#518 - google/pprof#514 - google/pprof#513 - google/pprof#510 - google/pprof#508 - google/pprof#506 - google/pprof#509 - google/pprof#504 * Update P/pprof/build_tarballs.jl - use a real version number Co-authored-by: Mosè Giordano <[email protected]> * Remove now unused `timestamp` * [pprof] Use `GitSource` Co-authored-by: Mosè Giordano <[email protected]>
* Add missing `escapeForDot()` to labels for function names In some programming languages, e.g. JuliaLang, function names can contain arbitrary characters. These are represented via the string macro `var"..."`, which allows constructing identifiers that wouldn't otherwise parse. These names are handled correctly by `pprof` in the FlameGraph view, but before this commit, they would produce an invalid dot file. This fixes the dot graph export for names that contain `"`. * Add separate test for name escaping * Apply `escapeStringForDot()` in more places, to cover more cases of potentially harmful string labels. Remove mistaken `escapeStringForDot()` around tag names * gofmt cleanups * Cleanup: Remove commented out line * Rename escapeForDot => escapeAllForDot; escapeStringForDot => escapeForDot * Apply formatting suggestions from code review * Remove unneeded `Residual` from dotgraph test I had unwittingly copied a test that was _specifically tesing_ Residual edges (the name of the test set I copied was `TestComposeWithTagsAndResidualEdge`). In my test, I'm simply testing the printing of the _names_ of the edges, and it's not relevant whether the edges are residual or not, so I've removed it just to simplify the test. * Fix Windows test (after fixing Windows printing): properly escape `\` in paths This PR adds proper escaping to dot strings, so that the backslash (`\`) in windows paths will now print correctly in dot output. Previously, the tests were incorreclty checking for an unescaped single `\` in the output, which isn't a valid `dot` string, so this commit updates the dot tests to expect the newly correct output. Updates the path testing assertions in various test files * Fix unexported comment in internal/graph/dotgraph.go Co-authored-by: Alexey Alexandrov <[email protected]>
In some programming languages, e.g. JuliaLang, function names can contain arbitrary characters. For example, in julia, functions with non-identifier characters are represented via the string macro
var"..."
, which allows constructing identifiers that wouldn't otherwise parse.These names are handled correctly by
pprof
in the FlameGraph view, but before this commit, they would produce an invalid dot file.This fixes the dot graph export for names that contain
"
.Review Guidelines
internal/graph/dotgraph.go
file, and consist of escaping a few more callsites that produce text that will go in a string in the.dot
file..dot
file.\
, and had to be updated once we started correctly escaping"...\..."
to"...\\..."
on Windows.Fixes JuliaPerf/PProf.jl#30.