Stuck on implementing and integrating VRE_encode/decode function
Dridi Boukelmoune
dridi at varni.sh
Wed Jun 18 10:13:43 UTC 2025
On Fri, Jun 13, 2025 at 10:00 AM Thibaut Artis <artous at uplex.de> wrote:
>
> 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
This would normally be a topic for the varnish-dev list, or the github
issue itself.
> 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
Looking at the pcre2 API, there are so many constraints with the
encoding and decoding that it would probably be much simpler to to
serialize the regular expression as a string.
> 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 ?
This is an alignment problem, so there may be a missing padding to
preserve pointer alignment.
Dridi
More information about the varnish-misc
mailing list