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

Add tests for binary file detection when using memory maps #3002

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Erio-Harrison
Copy link

The original code contained a TODO comment to add tests for binary file detection
when using memory maps. This PR implements those tests, noting the differences
between mmap and no-mmap behavior regarding binary detection.

The tests show that with memory maps:

  • NUL bytes are only searched for in the first few KB and in matches
  • Explicit file paths behave differently than glob patterns
  • Matches can appear both before and after NUL bytes
  • Binary detection is more permissive with memory maps

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

Successfully merging this pull request may close these issues.

1 participant