summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-11-03 17:41:22 +0100
committerAlejandro Colomar <alx@kernel.org>2023-11-03 23:05:48 +0100
commit2be04e240deaac14500e079c956611e2c1d0c6f3 (patch)
tree7eaaff79a06151fa6d3cb90aebe413a8862ce49a /share
parent55dd5d7255c85c3229efb42cdedfef496d983c76 (diff)
bin/grepc: Optimize
Call pcre2grep(1) only once, which allows removing named pipes. This is an important optimization, and will also allow accepting several file names in the command line (in a future commit). The source code is also significantly simplified. It has a caveat: this single call to pcre2grep(1) will consume more resources, and will crash on certain input files. The workaround is to restrict the search to just one or a few types of code. Document this in the manual page. This caveat only applies to very specific files, which so far I've only found in the Linux kernel source tree.
Diffstat (limited to 'share')
-rw-r--r--share/man/man1/grepc.17
1 files changed, 7 insertions, 0 deletions
diff --git a/share/man/man1/grepc.1 b/share/man/man1/grepc.1
index 2d9cde5..e80c648 100644
--- a/share/man/man1/grepc.1
+++ b/share/man/man1/grepc.1
@@ -151,6 +151,13 @@ This option can be passed multiple times
to search for various types of code.
Default:
.BR "e f m t" .
+.SH CAVEATS
+In some cases,
+internal calls to
+.MR pcre2grep 1
+may fail after consuming too much resources.
+To solve that,
+restrict the "types of code" of your search.
.SH EXAMPLES
.EX
.RB \(ti/src/nginx/unit$ " grepc nxt_sprintf;"