Workaround for map_regm bug?

Hi there,

just tried to upgrade from 1.7.5 to 1.8.12, but was then bitten by a bug. My config has a map_regm directive to set a header, using a back reference; this doesn’t work any more, since the first character is being replaced by “00%”. A quick research seems to imply that it is a known problem, see

https://www.mail-archive.com/haproxy@formilux.org/msg30565.html

My map file looks lke

(.*)-somehost[1-9]\.domain\.com    \1                                                                                                                                                     
(.*)-otherhost[1-9]\.domain\.com    \1

Interestingly, I have another map file with backreference, and this seem not to have the “%00” problem:

.*-(somehost[1-9])\.domain\.com    \1
.*-(otherhost[1-9])\.domain\.com    \1

I’m using both for statements similar to

http-request set-var(txn.varname) var(txn.host_header),map_regm(/etc/haproxy/hostname.map)

obviously to extract parts of the FQDN. Not sure if it’s true, but it seems as if the bug only hits if the backrefence is about the beginning of the string to matched against.

I’m wondering how I could work around that bug. And, where would I report the bug, I couldn’t find a bug tracker for haproxy.

Thanks in advance

Sascha

The mailing list, where you found this, is the correct place already. The bug has already been analyzed well by Jarno, but in this case, activity then ceased. I’ve now forwarded the report to the developer that authored the change.

There is the intention to use github issue as bug tracker for haproxy, but we are not quite there yet.

great, thanks a lot. How would I notice if it has been fixed? I suppose keeping an eye on changes to map.c?

There would be a answer in the mailing list thread that you found and unless I overlook it, I’d post an update in this discourse thread here as well.

just a little hint that apparently a patch has been implemented,

https://www.mail-archive.com/haproxy@formilux.org/msg30694.html

but it seem not yet make it into to the git repo, not visibly at

http://git.haproxy.org/?p=haproxy.git;a=blob_plain;f=src/map.c;hb=HEAD

Thanks

Sascha

Right, the patch has been confirmed to fix the problem, I’m sure it will be committed shortly.

This has been committed in a1110e24: BUG/MINOR: map: fix map_regm with backref, which will be in v1.8.14 or any 1.8-snapshots starting with August 25h.