Crash in the grep feature

Aiden Woodruff aiden at aidenw.net
Fri Mar 6 02:22:34 UTC 2026


It looks like this failure is caused because it's not possible to 
directly check errors from the compile_grep_patterns [1] git function 
called in cgit_print_log [2]. The compile_grep_patterns function calls 
compile_regexp [3] which can call exit. See the following relevant lines 
from compile_regexp:

```
     err = regcomp(&p->regexp, p->pattern, regflags);
     if (err) {
         char errbuf[1024];
         regerror(err, &p->regexp, errbuf, 1024);
         compile_regexp_failed(p, errbuf);
     }
```

I think getting cgit to return an informational page here would require 
launching a separate process or changing the upstream git function to 
allow non-fatal failures.

1. https://gitlab.com/git-scm/git/-/blob/HEAD/grep.c#L770
2. https://git.zx2c4.com/cgit/tree/ui-log.c#n454
3. https://gitlab.com/git-scm/git/-/blob/HEAD/grep.c#L492

-- 
Aiden Woodruff


-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20260305/3f23939d/attachment.sig>


More information about the CGit mailing list