-
Notifications
You must be signed in to change notification settings - Fork 296
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
[c2cpg] Fixed logging via CCorePlugin #5175
Conversation
This PR adds a stripped-down version of the original `org.eclipse.cdt.core.CCorePlugin` shadowing it and providing only the functionality to get it running without all the Eclipse OSGI context. Sadly, some parser internal components (e.g., the ambiguity resolving) log via this class. Without a proper OSGI instantiation (which we do not have/want in Joern) we are running into all kind of exceptions due to non-initialized entities (e.g., the said logging utils). Discovered during testing c2cpg on https://github.com/chromium/chromium where we have a lot of ambiguous nodes during parsing that can't be resolved and are logged causing the said exceptions.
I have some doubts about the shadowing... with the proposed setup we get two versions of Not sure if this works with cdt, but have you considered shading instead of shadowing? I.e., copy the source to our repo and put it into a different namespace, similar to what I did in the repl: https://github.com/mpollmeier/scala-repl-pp/tree/main/shaded-libs/src/main/scala/replpp/shaded Another option: given that we already ship a redeployed version of cdt, we could also fiddle with the jar before publishing it, i.e. remove the original .class file. Doesn't sound very nice though. |
Hm, might be true. I was hoping the class files from c2cpg always take precedence.
Yes, but I wasn't able to get it running. If you want to try it feel free to alter this PR here directly. Note: |
No, there's nothing special about the project's sources once it's all packaged up...
|
In that case shading doesn't seem to be a good option either. We'd need to build the entire cdt project and publish it separately. Another option would be to remove the class from the original jar on Sounds like there's no good solution here, and out of the bad solutions I lean towards removing the class from the jar when we republish it... thoughts? |
I was thinking about this in first place, yes. Only downside: without a custom CCorePlugin like we do in c2cpg this republished jar is useless. |
Adapted from #5175 This PR adds a stripped-down version of the original `org.eclipse.cdt.core.CCorePlugin` and providing only the functionality to get it running without all the Eclipse OSGI context. To avoid classpath issues we removes the original class when we repulish the jar... Sadly, some parser internal components (e.g., the ambiguity resolving) log via this class. Without a proper OSGI instantiation (which we do not have/want in Joern) we are running into all kind of exceptions due to non-initialized entities (e.g., the said logging utils). Discovered during testing c2cpg on https://github.com/chromium/chromium where we have a lot of ambiguous nodes during parsing that can't be resolved and are logged causing the said exceptions.
That's true, although maybe not the end of the world. That being said, we could move the simplified CCorePlugin into the custom build that we create anyway for republishing. Like so: #5178 |
Ok, let's do it that way. |
* [c2cpg] Fixed logging via CCorePlugin This PR adds a stripped-down version of the original `org.eclipse.cdt.core.CCorePlugin` shadowing it and providing only the functionality to get it running without all the Eclipse OSGI context. Sadly, some parser internal components (e.g., the ambiguity resolving) log via this class. Without a proper OSGI instantiation (which we do not have/want in Joern) we are running into all kind of exceptions due to non-initialized entities (e.g., the said logging utils). Discovered during testing c2cpg on https://github.com/chromium/chromium where we have a lot of ambiguous nodes during parsing that can't be resolved and are logged causing the said exceptions. * [c2cpg] Fixed logging via CCorePlugin Adapted from #5175 This PR adds a stripped-down version of the original `org.eclipse.cdt.core.CCorePlugin` and providing only the functionality to get it running without all the Eclipse OSGI context. To avoid classpath issues we removes the original class when we repulish the jar... Sadly, some parser internal components (e.g., the ambiguity resolving) log via this class. Without a proper OSGI instantiation (which we do not have/want in Joern) we are running into all kind of exceptions due to non-initialized entities (e.g., the said logging utils). Discovered during testing c2cpg on https://github.com/chromium/chromium where we have a lot of ambiguous nodes during parsing that can't be resolved and are logged causing the said exceptions. * upgrade eclipse cdt (release pending) * works now apparently --------- Co-authored-by: Max Leuthäuser <[email protected]>
This PR adds a stripped-down version of the original
org.eclipse.cdt.core.CCorePlugin
shadowing it and providing only the functionality to get it running without all the Eclipse OSGI context.Sadly, some parser internal components (e.g., the ambiguity resolving) log via this class. Without a proper OSGI instantiation (which we do not have/want in Joern) we are running into all kind of exceptions due to non-initialized entities (e.g., the said logging utils).
Discovered during testing c2cpg on https://github.com/chromium/chromium where we have a lot of ambiguous nodes during parsing that can't be resolved and are logged causing the said exceptions.