Stuck on implementing and integrating VRE_encode/decode function

Thibaut Artis artous at uplex.de
Fri Jun 13 09:59:21 UTC 2025


Hi everyone,


I'm currently working on implementing and integrating VRE_encode/decode 
functions as evoked here 
https://github.com/varnishcache/varnish-cache/issues/4334

The goal here is to properly de/serialize bans using 
pcre2_serialize_encode/decode functions

What is currently done is that the ban spec is simply written to a VSB, 
so what I attempted is to iterate over the ban spec, write the non-regex 
parts to the VSB just as it is done now, but when I encounter then I 
de/serialize it and then write it to the VSB.

Here is my WIP 
https://github.com/varnishcache/varnish-cache/compare/master...cartoush:varnish-cache:pcre_serialize_bans

But what I'm stuck with is that simply iterating over a ban spec causes 
crashes like so:

```

***  v1    debug|Assert error in ban_get_lump(), cache/cache_ban.c line 212:
***  v1    debug|  Condition(PAOK(*bs)) not true.
```

even though I took example from other places in VC where ban_iter is 
used and seems to work correctly.

Here is a minimal demonstration of how to reproduce that: 
https://github.com/varnishcache/varnish-cache/compare/master...cartoush:varnish-cache:test_iter_cache_ban

So my question here is: Is ban_iter simply not the tool I should be 
using to iterate over bans here and if not what could I use ? And if yes 
what am I doing wrong here ?


Best regards,




More information about the varnish-misc mailing list