Conversation
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.
|
I'm not really in favor of this. BTW what string sizes are we talking about here? |
|
Depends on the platform's default stacksize limit but on x86_64-linux this leads to reliable crashes: #3804 |
|
Looks like this may get fixed upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86164#c8 |
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. |
Not really the commenter gave up. |
28k in my case. |
|
Note that libboost_regex.so is about 1.3 MB, but worse, it pulls in libicu4c which is 34 MB. |
|
I think it used 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... |
|
+1 for PCRE, oniguruma or any other regexp engine that has a consistent evaluation across platforms. |
|
@zimbatm While I would absolutely love PCRE the problem is that Nix is already using POSIX ERE and migrating to something else would break |
This avoids C++'s standard library regexes, which aren't the same across platforms, and have many other issues, like using stack so much that they stack overflow when processing a lot of data. To avoid backwards and forward compatibility issues, regexes are processed using a function converting libstdc++ regexes into Boost regexes, escaping characters that Boost needs to have escaped, and rejecting features that Boost has and libstdc++ doesn't. Related context: - Original failed attempt to use `boost::regex` in CppNix, failed due to boost icu dependency being large (disabling ICU is no longer necessary because linking ICU requires using a different header file, `boost/regex/icu.hpp`): NixOS/nix#3826 - An attempt to use PCRE, rejected due to providing less backwards compatibility with `std::regex` than `boost::regex`: NixOS/nix#7336 - Second attempt to use `boost::regex`, failed due to `}` regex failing to compile (dealt with by writing a wrapper that parses a regular expression and escapes `}` characters): NixOS/nix#7762 Closes #34. Closes #476. Change-Id: Ieb0eb9e270a93e4c7eed412ba4f9f96cb00a5fa4
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.