Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from std::regex to boost::regex #3826

Closed
wants to merge 1 commit into from
Closed

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Jul 17, 2020

  1. std::regex is not consistent across different platforms (libcxx vs libstdc++)
  2. libstdc++ implementation is braindead:
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93502
    and overflows the stack if the input string gets too long.

If this change is accepted I will also replace all other instances.

1. std::regex is not consistent across different platforms (libcxx vs libstdc++)
2. libstdc++ implementation is braindead:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93502
   and overflows the stack if the input string gets too long.

If this change is accepted I will also replace all other instances.
@edolstra
Copy link
Member

I'm not really in favor of this. boost::regex is just the predecessor of std::regex so going back to boost::regex seems like a step back. We'd be pulling in an external dependency for something that's already provided by the standard library.

BTW what string sizes are we talking about here?

@Mic92
Copy link
Member Author

Mic92 commented Jul 17, 2020

Depends on the platform's default stacksize limit but on x86_64-linux this leads to reliable crashes: #3804

@edolstra
Copy link
Member

Looks like this may get fixed upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86164#c8

@Mic92
Copy link
Member Author

Mic92 commented Jul 17, 2020

I'm not really in favor of this. boost::regex is just the predecessor of std::regex so going back to boost::regex seems like a step back. We'd be pulling in an external dependency for something that's already provided by the standard library.

BTW what string sizes are we talking about here?

It does not really increase the closure size though in Nix. There might be some distributions such as Debian that package liboost_regex separately: https://packages.debian.org/sid/amd64/libboost-regex1.71-dev/filelist

What is your proposed fix instead? fixing libstdc++'s regex is beyond my capabilities.

@Mic92
Copy link
Member Author

Mic92 commented Jul 17, 2020

Looks like this may get fixed upstream: gcc.gnu.org/bugzilla/show_bug.cgi?id=86164#c8

Not really the commenter gave up.

@Mic92
Copy link
Member Author

Mic92 commented Jul 17, 2020

I'm not really in favor of this. boost::regex is just the predecessor of std::regex so going back to boost::regex seems like a step back. We'd be pulling in an external dependency for something that's already provided by the standard library.

BTW what string sizes are we talking about here?

28k in my case.

@edolstra
Copy link
Member

Note that libboost_regex.so is about 1.3 MB, but worse, it pulls in libicu4c which is 34 MB.

@Mic92 Mic92 closed this Jul 17, 2020
@Mic92
Copy link
Member Author

Mic92 commented Jul 19, 2020

I think it used regcomp before: b05b98d#diff-52d20285486e90d564ca2535d4d0fe55L11

It could be reverted to that. However its too much guessing from my side what the maintainers actually want as a acceptable solution so I just leave it as it is given that the one bug in nixpkgs itself is fixed...

@Mic92 Mic92 deleted the fix-match branch July 19, 2020 07:28
@zimbatm
Copy link
Member

zimbatm commented Jul 20, 2020

+1 for PCRE, oniguruma or any other regexp engine that has a consistent evaluation across platforms.

@adisbladis
Copy link
Member

@zimbatm While I would absolutely love PCRE the problem is that Nix is already using POSIX ERE and migrating to something else would break builtins.match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants