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

Fix scan find #442

Merged
merged 28 commits into from
Jan 18, 2024
Merged

Fix scan find #442

merged 28 commits into from
Jan 18, 2024

Conversation

simsong
Copy link
Owner

@simsong simsong commented Jan 17, 2024

No description provided.

Copy link
Collaborator

@jonstewart jonstewart left a comment

Choose a reason for hiding this comment

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

is usage of re2 actually in be20_api?

@@ -22,7 +22,7 @@ read

# Note: openssl no longer required
# Apple's provided flex is 2.6.4, which is the same that is provided by brew
PKGS+="wget libtool autoconf automake libtool libxml2 libewf json-c"
PKGS+="wget libtool autoconf automake libtool libxml2 libewf json-c re2 abseil pkg-config"
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you're requiring pkg-config, you can add ax_pkg_check_modules.m4 to your m4 directory and then use PKG_CHECK_MODULES() in configure.ac to check on the existence/presence of pkg-config-managed packages and gather up their different CFLAGS and LIBS directives into namespaced variables, so you can incorporate those into Makefile.am.

See https://autotools.info/pkgconfig/pkg_check_modules.html

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes. I'm in fact using this now. See
https://github.com/simsong/be20_api/blob/0bd6a2a8a72dffcc867cef478a3f84cf306f131f/be20_configure.m4#L31-L40

And you know what? I just spent 8 hours trying to debug this.

feature_recorder &f = sp.named_feature_recorder("find");

auto *tbuf = sbuf_t::sbuf_malloc(sp.sbuf->pos0, sp.sbuf->bufsize+1, sp.sbuf->bufsize+1);
memcpy(tbuf->malloc_buf(), sp.sbuf->get_buf(), sp.sbuf->bufsize);
Copy link
Collaborator

Choose a reason for hiding this comment

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

are you doing the memcpy solely so you can null-terminate it?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes.

@@ -79,33 +117,16 @@ void scan_find(scanner_params &sp)
/* The current regex library treats \0 as the end of a string.
* So we make a copy of the current buffer to search that's one bigger, and the copy has a \0 at the end.
* This is super-wasteful. Does Lightgrep have this problem?
Copy link
Collaborator

Choose a reason for hiding this comment

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

to answer definitively: no

Copy link

codecov bot commented Jan 17, 2024

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (59b412f) 47.96% compared to head (e1c156b) 48.48%.
Report is 37 commits behind head on main.

❗ Current head e1c156b differs from pull request most recent head 3f630a0. Consider uploading reports for the commit 3f630a0 to get more accurate results

Files Patch % Lines
src/test_be2.cpp 65.00% 7 Missing ⚠️
src/bulk_extractor.cpp 40.00% 6 Missing ⚠️
src/scan_find.cpp 91.67% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #442      +/-   ##
==========================================
+ Coverage   47.96%   48.48%   +0.52%     
==========================================
  Files         112      112              
  Lines       13390    13167     -223     
==========================================
- Hits         6422     6383      -39     
+ Misses       6968     6784     -184     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@simsong simsong merged commit 9a617a6 into main Jan 18, 2024
1 check passed
@simsong simsong deleted the fix-scan_find branch January 18, 2024 01:34
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.

2 participants