Robert Högberg
2018-10-29 22:26:19 UTC
Hi,
I've noticed that the musl regex implementation behaves slightly
differently than the glibc implementation. I'm attaching a short program
showing the behaviour.
The difference makes yate (http://yate.null.ro) misbehave when running with
musl (reported here: https://github.com/openwrt/telephony/issues/378).
Yate uses a regexp like this:
"^\\([[:alpha:]][[:alnum:]]\\+:\\)\\?/\\?/\\?\\([^[:space:][:cntrl:]@]\\+@\\)\\?\\([[:alnum:]._+-]\\+\\|[[][[:xdigit:].:]\\+[]]\\)\\(:[0-9]\\+\\)\\?"
.. to parse strings like:
"sip:***@11.111.11.111:5060;user=phone"
.. and the matches produced by musl are:
Match 0: 0 - 32 sip:***@11.111.11.111:5060
Match 1: -1 - -1
Match 2: 0 - 14 sip:012345678@
Match 3: 14 - 27 11.111.11.111
Match 4: 27 - 32 :5060
.. while glibc produces:
Match 0: 0 - 32 sip:***@11.111.11.111:5060
Match 1: 0 - 4 sip:
Match 2: 4 - 14 012345678@
Match 3: 14 - 27 11.111.11.111
Match 4: 27 - 32 :5060
What do you think?
I've only tested musl 1.1.19. Sorry if this is not valid for later
releases. I skimmed the 1.1.20 release notes and didn't find anything regex
related.
Regards
Robert
I've noticed that the musl regex implementation behaves slightly
differently than the glibc implementation. I'm attaching a short program
showing the behaviour.
The difference makes yate (http://yate.null.ro) misbehave when running with
musl (reported here: https://github.com/openwrt/telephony/issues/378).
Yate uses a regexp like this:
"^\\([[:alpha:]][[:alnum:]]\\+:\\)\\?/\\?/\\?\\([^[:space:][:cntrl:]@]\\+@\\)\\?\\([[:alnum:]._+-]\\+\\|[[][[:xdigit:].:]\\+[]]\\)\\(:[0-9]\\+\\)\\?"
.. to parse strings like:
"sip:***@11.111.11.111:5060;user=phone"
.. and the matches produced by musl are:
Match 0: 0 - 32 sip:***@11.111.11.111:5060
Match 1: -1 - -1
Match 2: 0 - 14 sip:012345678@
Match 3: 14 - 27 11.111.11.111
Match 4: 27 - 32 :5060
.. while glibc produces:
Match 0: 0 - 32 sip:***@11.111.11.111:5060
Match 1: 0 - 4 sip:
Match 2: 4 - 14 012345678@
Match 3: 14 - 27 11.111.11.111
Match 4: 27 - 32 :5060
What do you think?
I've only tested musl 1.1.19. Sorry if this is not valid for later
releases. I skimmed the 1.1.20 release notes and didn't find anything regex
related.
Regards
Robert