-
Notifications
You must be signed in to change notification settings - Fork 49
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
Magic module #12
Magic module #12
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This looks good to me. The cache system is important but I'm not sure how to implement, maybe we need to provide a mechanism so that modules can store arbitrary data in the |
I am bad at computer
RFDHaving been stymied in my previous testing file layout by module scope problems, I have resolved to move this module into a directory with tests alongside, as we do with the If we're OK with requiring tests for modules, we could probably enforce this when writing The caching system remains #todo at this time.
|
I think that having the module's test within the module's itself is ok, as this is a well-known Rust pattern. For small modules having a single file is also ok, while larger ones can have its own directory, like in this case. |
Mostly a copy of #12. After too many changes since the PR, it's easier to commit the code again than resolving the merge conflicts.
Already merged in #91. |
Module main arg redo
Port of the magic module. Note that building this feature requires
libmagic
in your Rust library path.I've implemented both
magic.type()
andmagic.mime_type()
, no rule changes should be needed. After chatting with @wxsBSD, we decided it was best to add a minimal protobuf specification rather than hack the build scripts to account for modules that only have exported functions and return no data, like this one.Right now, I'm mostly asking for feedback. A notable omission from this implementation is the cache design present in the C version. I imagine adding this would still be a net performance gain, but I want to make sure this design seems reasonable first.
cargo test --package yara-x --lib --features magic-module -- modules::tests::magic::e2e_test --exact --nocapture