Skip to content

ABI breakage without soname update #266

@Arfrever

Description

@Arfrever

re2 2020-07-01, in comparison to re2 2020-06-01, introduced ABI breakage without update of soname of shared library.
In commit e6613e9, new members of public enums were introduced, not at the end of these enums, so values of subsequent members were changed.
Executables/libraries compiled with older re2 would misbehave after update to newer re2 without recompilation.

Example showing problem:

$ cat test.cpp
#include <iostream>
#include <re2/re2.h>
int main(){
  re2::RE2 re("(?P<>)");
  if (re.error_code() == re2::RE2::ErrorBadNamedCapture) {
    std::cout << "CODE FOR INVALID NAMED CAPTURE GROUP" << std::endl;
  } else {
    std::cout << "CODE FOR OTHER" << std::endl;
  }
}
$ tar -xzf .../re2-2020-06-01.tar.gz
$ tar -xzf .../re2-2020-07-01.tar.gz
$ make -C re2-2020-06-01 shared
...
$ make -C re2-2020-07-01 shared
...
$ g++ -o test test.cpp -Ire2-2020-06-01 -Lre2-2020-06-01/obj/so -lre2
$ LD_LIBRARY_PATH="re2-2020-06-01/obj/so" ./test
re2/re2.cc:203: Error parsing '(?P<>)': invalid named capture group: (?P<>
CODE FOR INVALID NAMED CAPTURE GROUP
$ LD_LIBRARY_PATH="re2-2020-07-01/obj/so" ./test
re2/re2.cc:205: Error parsing '(?P<>)': invalid named capture group: (?P<>
CODE FOR OTHER

Grepping in Chromium 85.0.4181.8 shows that one of affected members of these enums is used there:

$ grep -Er "(ErrorTrailingBackslash|ErrorRepeatArgument|ErrorRepeatSize|ErrorRepeatOp|ErrorBadPerlOp|ErrorBadUTF8|ErrorBadNamedCapture|ErrorPatternTooLarge|kRegexpTrailingBackslash|kRegexpRepeatArgument|kRegexpRepeatSize|kRegexpRepeatOp|kRegexpBadPerlOp|kRegexpBadUTF8|kRegexpBadNamedCapture)" *
extensions/browser/api/declarative_net_request/indexed_rule.cc:    if (regex.error_code() == re2::RE2::ErrorPatternTooLarge) {

I suggest that SONAME=8 be set in Makefile:

re2/Makefile

Line 47 in 9a3bd16

SONAME=7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions