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

Add a note of caution about using shared regex in provideTerminalLinks #101458

Closed
eamodio opened this issue Jun 30, 2020 · 0 comments
Closed

Add a note of caution about using shared regex in provideTerminalLinks #101458

eamodio opened this issue Jun 30, 2020 · 0 comments
Assignees
Labels
insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue terminal General terminal issues that don't fall under another label
Milestone

Comments

@eamodio
Copy link
Contributor

eamodio commented Jun 30, 2020

Testing #101300

If an extension uses a shared RegExp instance with the global flag in provideTerminalLinks with await calls , it could lead to unexpected results. This is because a RegExp object with global flag maintains state as you loop over the matches, and if there are any await calls inside that loop, another call to provideTerminalLinks could be executed, re-using that same RegExp instance -- effectively mixing/corrupting the results.

Since IMO, RegExp parsing (especially with the global flag) will likely be common within this API, I think it is worth a note of caution.

@Tyriar Tyriar added this to the June 2020 milestone Jul 1, 2020
@Tyriar Tyriar added terminal General terminal issues that don't fall under another label polish Cleanup and polish issue labels Jul 1, 2020
@Tyriar Tyriar closed this as completed in 0fe3b64 Jul 1, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Aug 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue terminal General terminal issues that don't fall under another label
Projects
None yet
Development

No branches or pull requests

3 participants
@eamodio @Tyriar and others