-
Notifications
You must be signed in to change notification settings - Fork 30k
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
a fresh node startup has populated RegExp statics #43740
Comments
cc @aduh95 |
I would like to work on the fix for this. Looks like it is a side of this. |
ah, maybe the statics are populated by the same realm then :-/ that would be great for the repl, but wouldn't address node itself. |
Duplicate of #18931? |
The repl part, yes - but not the |
Before user code is executed, @hemanth if you want to work on the REPL side, that'd be great, I have a fix ready for the other problem. |
@aduh95 Trying to understand the intent behind this.
[
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
'',
'',
'',
'',
'',
'',
'',
'',
'',
index: 0,
input: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
groups: undefined
] |
My understanding is it's trying to clear up whatever RegEx node internals may have run between two REPL entries if that makes sense.
I think that works for |
If we use primordial |
Using |
From my point of view #20549 (comment) and #20549 (comment) is a good TL;DR for this thread. I'd say let's try this approach and run benchmark to see how it performs. IMO it would be worth creating a I wonder if ShadowRealms integration gives a new solution to this problem, allowing us to run REPL code on another Realm sounds like something that should also fix the issue. Should we move this discussion to #18931 since only the REPL is at stake now? |
Isn't |
It's implemented by V8, I'm sure we can easily disable it – but yes, as far as ECMAScript is concerned, it doesn't exist. |
@aduh95 what about https://github.com/tc39/proposal-regexp-legacy-features/#additional-properties-of-the-regexp-constructor ? I thought there was a proposal to make it standard but it looks abandoned? Anyway - no strong feelings from me, I figured it's one of these things like |
Fixes: #43740 PR-URL: #43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: nodejs#43740 PR-URL: nodejs#43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: nodejs#43740 PR-URL: nodejs#43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: nodejs#43740 PR-URL: nodejs#43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: #43740 Backport-PR-URL: #43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]> PR-URL: #44247 Reviewed-By: Rafael Gonzaga <[email protected]>
Fixes: #43740 Backport-PR-URL: #43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]> PR-URL: #44247 Reviewed-By: Rafael Gonzaga <[email protected]>
Fixes: #43740 PR-URL: #43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: #43740 PR-URL: #43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: #43740 PR-URL: #43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: #43740 PR-URL: #43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: #43740 PR-URL: #43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: nodejs/node#43740 PR-URL: nodejs/node#43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: nodejs/node#43740 PR-URL: nodejs/node#43741 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Version
v18.5.0
Platform
n/a
Subsystem
No response
What steps will reproduce the bug?
node -pe 'RegExp.$_'
will print outWeakRef
.node
, and thenRegExp.$_
, will print out'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
.This also applies to
$&
.How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No response
What do you see instead?
I expect the empty string for all RegExp statics.
This is a problem for a few reasons:
If there's a point, right before node starts running user code, and right before the repl becomes available, then we could execute a trivial regular expression operation to clear all the statics.
Alternatively, this may be exposing non-primordial regex usage, and it's likely that switching to primordials (since I believe they'd update the statics on the primordial RegExp instead of the global RegExp) would solve this as well.
Additional information
No response
The text was updated successfully, but these errors were encountered: