-
Notifications
You must be signed in to change notification settings - Fork 138
Support per-project config file and fix backtrace filtering #643
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
Conversation
@peterzhu2118 Could I have some look on this too? Thx |
5a0acbb
to
96c6edf
Compare
@st0012 This looks like it's pretty consistently failing on CI. I've retried it and it's still failing. |
Yeah I changed something for testing and it didn't work. |
753e45f
to
344d6fc
Compare
Each project may have its own project-specific debugger configuration, like different paths to skip. So the debugger should also read rdbgrc files at the project root, similar to what irb does with irbrc.
2548e92
to
629773f
Compare
Frame paths are usually presented unexpanded: ``` ~/.rbenv/versions/3.1.0/lib/ruby/3.1.0/irb/workspace.rb ``` But important Ruby/Rubygem paths are all stored expanded: ``` RbConfig::CONFIG["rubylibdir"] #=> "/Users/st0012/.rbenv/versions/3.1.0/lib/ruby/3.1.0" Gem.path #=> ["/Users/st0012/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0", "/Users/st0012/.gem/ruby/3.1.0"] ``` So expanding frame paths before matching is necessary. And on the otherhand, users may also provide unexpanded skip_path. Therefore we should expand it too.
FrameInfo#location_str uses #pretty_path underneath, which's value can change when use_short_path is enabled. This makes frame filtering unreliable and we should avoid it by using a more static attribute instead.
629773f
to
5fdf866
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.
Looks good, thanks!
At least 1 is not acceptable. |
@peterzhu2118 please ask my review for such architecture level change. |
@st0012 1 has security risk so it is not acceptable. Please check other debuggers. |
AFAIK, the major concern is that user may run malicious code by loading the config from a malicious codebase. If that's true, then here are what I found by checking other debuggers:
And in Ruby's case, even if we rule out non-official tools like
I think for |
Background
I want to add recommend configs like this to Rails projects:
Ideally, it'll reduce the full backtrace output from
To just app related backtrace
But there are some blockers and I need to make some changes for them.
Changes
Support project-based
.rdbgrc(.rb)
files. Currently the debugger only reads~/.rdbgrc(.rb)
files but we'll need the flexibility for per-project configurations. Sinceirb
also supports/.irbrc
, I think this also fits our tooling convention.When comparing paths, we need to expand the values for accurate result. This is because frame paths are usually presented unexpanded:
But important Ruby/Rubygem paths are all stored expanded:
We shouldn't use
FrameInfo#location_str
for frame filtering because it's mainly for displaying and its value can be changed by theuse_short_path
config. As an alternative, I addedFrameInfo#real_location
for that purpose.The
pty_home_dir
should be just the originalHOME
on CI because~/.rdbgrc
pollution on CIHOME
path is usually not assignable on CIs