Skip to content
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

[proguard] Change proguard warnings to TRACE statements #516

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danzimm
Copy link
Contributor

@danzimm danzimm commented Jul 28, 2020

If a user has a proguard file which uses a lot of unimplemented features in redex then there's a lot of stderr spew. This PR changes those stderr logs to TRACE logs so we can hide that output.

Additionally this PR changes the TRACE system to allow a user to specify 0 for a given subsystem. E.g. now one can run redex with TRACE=1;PROGUARD:0 to enable all traces at level 1, but disabling proguard traces. I can put this in another PR, but it seems so small and tangentially relevant to this PR that I put it in here (also I figured 3 PRs is enough for today)

@facebook-github-bot
Copy link
Contributor

Hi @danzimm!

Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but we do not have a signature on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@danzimm
Copy link
Contributor Author

danzimm commented Jul 28, 2020

Here's proof I signed the CLA:

Screen Shot 2020-07-28 at 7 50 31 PM

Also I fixed the build failures I had & clang-formatd them :D

@agampe
Copy link
Contributor

agampe commented Jul 29, 2020

IMO this is not the right approach. Hiding "incompatibilities" behind non-default-on flags is usually not intuitive behavior. If we were failing for those, and then could say "re-run with TRACE to see failures" I'd say that makes sense. At least initialize the trace level to 1 so only daredevils will reset it?

libredex/Trace.h Outdated
@@ -133,7 +134,7 @@
TM(VERIFY) \
TM(VIRT) \
TM(VM) \
TM(VMERGE) \
TM(VMERGE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment didn't make your linter ignore the "trailing" \? It's there intentionally to keep changes smaller in case there's an addition at the end :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that makes sense! I think I might've mistakenly removed this after I rebased... sorry about that 😅

@@ -129,7 +129,7 @@ struct Tracer {
for (const char* tok = strtok(tracespec, sep); tok != nullptr;
tok = strtok(nullptr, sep)) {
auto level = strtol(tok, nullptr, 10);
if (level) {
if (level || *tok == '0') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this rather be strcmp? This is somewhat hackish. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, this should be strcmp!

On another note, hackish code from @danzimm ? Who would've expected that! (cc @wsanville )

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@danzimm
Copy link
Contributor Author

danzimm commented Jul 29, 2020

Ahh, that's a good point @agampe ! Thanks for giving this a thoughtful review. I'll go ahead and default the PROGUARD trace to 1 so that by default users see proguard errors (and I can continue to be a daredevil 😎)

@@ -91,6 +91,7 @@
TM(PGR) \
TM(PM) \
TM(POST_LOWERING) \
TM(PROGUARD) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the existing code uses PGR to denote ProGuard trace statement, probably makes sense to reuse that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa didn't realize that's what that stood for! Thanks for pointing that out! I'll get a new rev up soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants