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

repl: no RegExp side effects #18931

Open
bnoordhuis opened this issue Feb 22, 2018 · 3 comments
Open

repl: no RegExp side effects #18931

bnoordhuis opened this issue Feb 22, 2018 · 3 comments
Assignees
Labels
help wanted Issues that need assistance from volunteers or PRs that need help to proceed. repl Issues and PRs related to the REPL subsystem.

Comments

@bnoordhuis
Copy link
Member

$ ./out/Release/node 
> RegExp.$_
'\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000'

Caused by the repl trying to fix up the side effects to RegExp.$1 toRegExp.$9. :-)

@bnoordhuis bnoordhuis added the repl Issues and PRs related to the REPL subsystem. label Feb 22, 2018
@princejwesley
Copy link
Contributor

@bnoordhuis When we run from the file, the output should be empty, right?

Source: /Users/princejohnwesley/Desktop/RegExpInput.js

console.log(RegExp.$_)
output (< v8.0.0)
/Users/princejohnwesley/Desktop/RegExpInput.js
output (>= v8.0.0)
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'asan': 0,
                 'coverage': 'false',
                 'debug_devtools': 'node',
                 'force_dynamic_crt': 0,
                 'host_arch': 'x64',
                 'icu_data_file': 'icudt59l.dat',
                 'icu_data_in': '../../deps/icu-small/source/data/in/icudt59l.dat',
                 'icu_endianness': 'l',
                 'icu_gyp_path': 'tools/icu/icu-generic.gyp',
                 'icu_locales': 'en,root',
                 'icu_path': 'deps/icu-small',
                 'icu_small': 'true',
                 'icu_ver_major': '59',
                 'llvm_version': 0,
                 'node_byteorder': 'little',
                 'node_enable_d8': 'false',
                 'node_enable_v8_vtunejit': 'false',
                 'node_install_npm': 'true',
                 'node_module_version': 57,
                 'node_no_browser_globals': 'false',
                 'node_prefix': '/',
                 'node_release_urlbase': 'https://nodejs.org/download/release/',
                 'node_shared': 'false',
                 'node_shared_cares': 'false',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_use_bundled_v8': 'true',
                 'node_use_dtrace': 'true',
                 'node_use_etw': 'false',
                 'node_use_lttng': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'node_use_v8_platform': 'true',
                 'node_without_node_options': 'false',
                 'openssl_fips': '',
                 'openssl_no_asm': 0,
                 'shlib_suffix': '57.dylib',
                 'target_arch': 'x64',
                 'uv_parent_path': '/deps/uv/',
                 'uv_use_dtrace': 'true',
                 'v8_enable_gdbjit': 0,
                 'v8_enable_i18n_support': 1,
                 'v8_enable_inspector': 1,
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_promise_internal_field_count': 1,
                 'v8_random_seed': 0,
                 'v8_use_snapshot': 'true',
                 'want_separate_host_toolset': 0,
                 'want_separate_host_toolset_mkpeephole': 0,
                 'xcode_version': '7.0'}}

@bnoordhuis
Copy link
Member Author

@princejwesley That's right,

@princejwesley princejwesley self-assigned this Feb 22, 2018
princejwesley added a commit to princejwesley/node that referenced this issue Feb 22, 2018
Preserve all RegExp static properties
  - RegExp.$1 to RegExp.9
  - input, lastMatch, lastParen
  - leftContext and rightContext

Fixes: nodejs#18931
princejwesley added a commit to princejwesley/node that referenced this issue May 5, 2018
Disallow global RegExp object usage inside repl.js,
readline.js and tty.js. Use RegExp from internal context
to prevent updating global.RegExp static properties

tools/eslint-rules/no-regex-literal-for-repl.js linter is added
to prevent regex literal usage in repl code path

Fixes: nodejs#18931
@BridgeAR
Copy link
Member

BridgeAR commented Apr 4, 2019

I had a look at this and it seems the only way to really solve this is the solution suggested by @princejwesley in #20549.

We should either accept this as a side effect that we do not want to fix or we should revive that PR. I personally suggest we go for the latter.

@jasnell jasnell added the help wanted Issues that need assistance from volunteers or PRs that need help to proceed. label Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues that need assistance from volunteers or PRs that need help to proceed. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
4 participants