From 24dd67fe8fbfbe754d8ddf652ed8790e59d1542f Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Tue, 16 Oct 2018 18:25:44 -0400 Subject: [PATCH 01/61] build: configure default v8_optimized_debug Under the assumption that debugging is more often focused on node core source. This setting compiles V8 with only partial optimizations, DCHECKS, and debug symbols, so it is still very much debuggable, but it is much faster. It does disable SLOW_DCHECKS, but at the advice of the V8 team, those are more important for deep V8 debugging. Override is configurable with `./configure --v8-non-optimized-debug`. PR-URL: https://github.com/nodejs/node/pull/23704 Reviewed-By: Joyee Cheung Reviewed-By: Ujjwal Sharma --- common.gypi | 3 --- configure.py | 8 +++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common.gypi b/common.gypi index f0315b198a85a0..b07b854be6217f 100644 --- a/common.gypi +++ b/common.gypi @@ -28,9 +28,6 @@ 'openssl_fips%': '', - # Default to -O0 for debug builds. - 'v8_optimized_debug%': 0, - # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. 'v8_embedder_string': '-node.44', diff --git a/configure.py b/configure.py index a5075bd9d8a60b..bf9a10d6474805 100755 --- a/configure.py +++ b/configure.py @@ -576,6 +576,12 @@ default=True, help='get more output from this script') +parser.add_option('--v8-non-optimized-debug', + action='store_true', + dest='v8_non_optimized_debug', + default=False, + help='compile V8 with minimal optimizations and with runtime checks') + # Create compile_commands.json in out/Debug and out/Release. parser.add_option('-C', action='store_true', @@ -1156,7 +1162,7 @@ def configure_library(lib, output): def configure_v8(o): o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0 o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs. - o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds. + o['variables']['v8_optimized_debug'] = 0 if options.v8_non_optimized_debug else 1 o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables. o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks. o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true' From c9ecaefb88aee98cc988ea19ea298f7d4203631a Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Mon, 15 Oct 2018 18:32:11 -0400 Subject: [PATCH 02/61] deps,v8: fix gypfile bug PR-URL: https://github.com/nodejs/node/pull/23704 Reviewed-By: Joyee Cheung Reviewed-By: Ujjwal Sharma --- common.gypi | 2 +- deps/v8/gypfiles/toolchain.gypi | 258 ++++++++++++++------------------ deps/v8/gypfiles/v8.gyp | 21 +-- 3 files changed, 115 insertions(+), 166 deletions(-) diff --git a/common.gypi b/common.gypi index b07b854be6217f..e73d215a982f72 100644 --- a/common.gypi +++ b/common.gypi @@ -30,7 +30,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.44', + 'v8_embedder_string': '-node.45', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/gypfiles/toolchain.gypi b/deps/v8/gypfiles/toolchain.gypi index ea8f1c2f00da56..4860c5b7724e20 100644 --- a/deps/v8/gypfiles/toolchain.gypi +++ b/deps/v8/gypfiles/toolchain.gypi @@ -1134,121 +1134,7 @@ }], ], # conditions 'configurations': { - # Abstract configuration for v8_optimized_debug == 0. - 'DebugBase0': { - 'abstract': 1, - 'msvs_settings': { - 'VCCLCompilerTool': { - 'Optimization': '0', - 'conditions': [ - ['component=="shared_library" or force_dynamic_crt==1', { - 'RuntimeLibrary': '3', # /MDd - }, { - 'RuntimeLibrary': '1', # /MTd - }], - ], - }, - 'VCLinkerTool': { - 'LinkIncremental': '2', - }, - }, - 'variables': { - 'v8_enable_slow_dchecks%': 1, - }, - 'conditions': [ - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \ - OS=="qnx" or OS=="aix"', { - 'cflags!': [ - '-O3', - '-O2', - '-O1', - '-Os', - ], - 'cflags': [ - '-fdata-sections', - '-ffunction-sections', - ], - }], - ['OS=="mac"', { - 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': '0', # -O0 - }, - }], - ['v8_enable_slow_dchecks==1', { - 'defines': [ - 'ENABLE_SLOW_DCHECKS', - ], - }], - ], - }, # DebugBase0 - # Abstract configuration for v8_optimized_debug == 1. - 'DebugBase1': { - 'abstract': 1, - 'msvs_settings': { - 'VCCLCompilerTool': { - 'Optimization': '2', - 'InlineFunctionExpansion': '2', - 'EnableIntrinsicFunctions': 'true', - 'FavorSizeOrSpeed': '0', - 'StringPooling': 'true', - 'BasicRuntimeChecks': '0', - 'conditions': [ - ['component=="shared_library" or force_dynamic_crt==1', { - 'RuntimeLibrary': '3', #/MDd - }, { - 'RuntimeLibrary': '1', #/MTd - }], - ], - }, - 'VCLinkerTool': { - 'LinkIncremental': '1', - 'OptimizeReferences': '2', - 'EnableCOMDATFolding': '2', - }, - }, - 'variables': { - 'v8_enable_slow_dchecks%': 0, - }, - 'conditions': [ - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \ - OS=="qnx" or OS=="aix"', { - 'cflags!': [ - '-O0', - '-O1', - '-Os', - ], - 'cflags': [ - '-fdata-sections', - '-ffunction-sections', - ], - 'conditions': [ - # Don't use -O3 with sanitizers. - ['asan==0 and msan==0 and lsan==0 \ - and tsan==0 and ubsan==0 and ubsan_vptr==0', { - 'cflags': ['-O3'], - 'cflags!': ['-O2'], - }, { - 'cflags': ['-O2'], - 'cflags!': ['-O3'], - }], - ], - }], - ['OS=="mac"', { - 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': '3', # -O3 - 'GCC_STRICT_ALIASING': 'YES', - }, - }], - ['v8_enable_slow_dchecks==1', { - 'defines': [ - 'ENABLE_SLOW_DCHECKS', - ], - }], - ], - }, # DebugBase1 - # Common settings for the Debug configuration. - 'DebugBaseCommon': { - 'abstract': 1, + 'Debug': { 'defines': [ 'ENABLE_DISASSEMBLER', 'V8_ENABLE_CHECKS', @@ -1311,27 +1197,126 @@ }], ], }], - ], - }, # DebugBaseCommon - 'Debug': { - 'inherit_from': ['DebugBaseCommon'], - 'conditions': [ ['v8_optimized_debug==0', { - 'inherit_from': ['DebugBase0'], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '0', + 'conditions': [ + ['component=="shared_library" or force_dynamic_crt==1', { + 'RuntimeLibrary': '3', # /MDd + }, { + 'RuntimeLibrary': '1', # /MTd + }], + ], + }, + 'VCLinkerTool': { + 'LinkIncremental': '2', + }, + }, + 'variables': { + 'v8_enable_slow_dchecks%': 1, + }, + 'conditions': [ + ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \ + OS=="qnx" or OS=="aix"', { + 'cflags!': [ + '-O3', + '-O2', + '-O1', + '-Os', + ], + 'cflags': [ + '-fdata-sections', + '-ffunction-sections', + ], + }], + ['OS=="mac"', { + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': '0', # -O0 + }, + }], + ['v8_enable_slow_dchecks==1', { + 'defines': [ + 'ENABLE_SLOW_DCHECKS', + ], + }], + ], }, { - 'inherit_from': ['DebugBase1'], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '2', + 'InlineFunctionExpansion': '2', + 'EnableIntrinsicFunctions': 'true', + 'FavorSizeOrSpeed': '0', + 'StringPooling': 'true', + 'BasicRuntimeChecks': '0', + 'conditions': [ + ['component=="shared_library" or force_dynamic_crt==1', { + 'RuntimeLibrary': '3', #/MDd + }, { + 'RuntimeLibrary': '1', #/MTd + }], + ], + }, + 'VCLinkerTool': { + 'LinkIncremental': '1', + 'OptimizeReferences': '2', + 'EnableCOMDATFolding': '2', + }, + }, + 'variables': { + 'v8_enable_slow_dchecks%': 0, + }, + 'conditions': [ + ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \ + OS=="qnx" or OS=="aix"', { + 'cflags!': [ + '-O0', + '-O1', + '-Os', + ], + 'cflags': [ + '-fdata-sections', + '-ffunction-sections', + ], + 'conditions': [ + # Don't use -O3 with sanitizers. + ['asan==0 and msan==0 and lsan==0 \ + and tsan==0 and ubsan==0 and ubsan_vptr==0', { + 'cflags': ['-O3'], + 'cflags!': ['-O2'], + }, { + 'cflags': ['-O2'], + 'cflags!': ['-O3'], + }], + ], + }], + ['OS=="mac"', { + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': '3', # -O3 + 'GCC_STRICT_ALIASING': 'YES', + }, + }], + ['v8_enable_slow_dchecks==1', { + 'defines': [ + 'ENABLE_SLOW_DCHECKS', + ], + }], + ], }], # Temporary refs: https://github.com/nodejs/node/pull/23801 ['v8_enable_handle_zapping==1', { 'defines': ['ENABLE_HANDLE_ZAPPING',], }], ], - }, # Debug - 'ReleaseBase': { - 'abstract': 1, + + }, # DebugBaseCommon + 'Release': { 'variables': { 'v8_enable_slow_dchecks%': 0, }, + # Temporary refs: https://github.com/nodejs/node/pull/23801 + 'defines!': ['ENABLE_HANDLE_ZAPPING',], 'conditions': [ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \ or OS=="aix"', { @@ -1407,29 +1392,6 @@ }], ], # conditions }, # Release - 'Release': { - 'inherit_from': ['ReleaseBase'], - # Temporary refs: https://github.com/nodejs/node/pull/23801 - 'defines!': ['ENABLE_HANDLE_ZAPPING',], - }, # Debug - 'conditions': [ - [ 'OS=="win"', { - # TODO(bradnelson): add a gyp mechanism to make this more graceful. - 'Debug_x64': { - 'inherit_from': ['DebugBaseCommon'], - 'conditions': [ - ['v8_optimized_debug==0', { - 'inherit_from': ['DebugBase0'], - }, { - 'inherit_from': ['DebugBase1'], - }], - ], - }, - 'Release_x64': { - 'inherit_from': ['ReleaseBase'], - }, - }], - ], }, # configurations 'msvs_disabled_warnings': [ 4245, # Conversion with signed/unsigned mismatch. diff --git a/deps/v8/gypfiles/v8.gyp b/deps/v8/gypfiles/v8.gyp index 8c78f022551e66..e18429b6d2ffdf 100644 --- a/deps/v8/gypfiles/v8.gyp +++ b/deps/v8/gypfiles/v8.gyp @@ -2461,23 +2461,10 @@ '../third_party/antlr4/runtime/Cpp/runtime/src', '../src/torque', ], - # This is defined trough `configurations` for GYP+ninja compatibility - 'configurations': { - 'Debug': { - 'msvs_settings': { - 'VCCLCompilerTool': { - 'RuntimeTypeInfo': 'true', - 'ExceptionHandling': 1, - }, - } - }, - 'Release': { - 'msvs_settings': { - 'VCCLCompilerTool': { - 'RuntimeTypeInfo': 'true', - 'ExceptionHandling': 1, - }, - } + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeTypeInfo': 'true', + 'ExceptionHandling': 1, }, }, 'sources': [ From a1b56439e35e3e539d86d31f0e2965387e053adf Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Mon, 29 Oct 2018 14:40:38 -0400 Subject: [PATCH 03/61] build: add -Werror=undefined-inline to clang builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/23961 Refs: https://github.com/nodejs/node/pull/23954 Refs: https://github.com/nodejs/node/pull/23910 Refs: https://github.com/nodejs/node/pull/23880 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung --- node.gypi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/node.gypi b/node.gypi index ab2df8645e4e0e..7836561a84117d 100644 --- a/node.gypi +++ b/node.gypi @@ -32,9 +32,13 @@ '-Wendif-labels', '-W', '-Wno-unused-parameter', + '-Werror=undefined-inline', ], }, 'conditions': [ + ['clang==1', { + 'cflags': [ '-Werror=undefined-inline', ] + }], [ 'node_shared=="false"', { 'msvs_settings': { 'VCManifestTool': { From 6f249bca80b4e20ff92d030bfe8fcee41f4ce185 Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Mon, 29 Oct 2018 16:47:27 -0700 Subject: [PATCH 04/61] src: fix fully-static & large-pages combination Fixes: https://github.com/nodejs/node/issues/23906 Refs: https://github.com/nodejs/node/pull/22079 This change to ld.implicit.script moves libc static code to .lpstub area and avoids the issue detailed in 23906 Quick performance comparision on web-tooling shows 3% improvement for the combination over fully-static cycles 376,235,487,455 390,007,877,315 instructions 700,341,146,973 714,773,201,182 itlb_misses_walk_completed 20,654,246 28,908,381 itlb_misses_walk_completed_4k 19,884,666 28,865,118 itlb_misses_walk_completed_2m_4m 769,391 43,251 Score 9.13 8.86 PR-URL: https://github.com/nodejs/node/pull/23964 Reviewed-By: Refael Ackermann Reviewed-By: Ben Noordhuis --- src/large_pages/ld.implicit.script | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/large_pages/ld.implicit.script b/src/large_pages/ld.implicit.script index ad7ce1b2e2e5cf..7f12e4bd7df9e5 100644 --- a/src/large_pages/ld.implicit.script +++ b/src/large_pages/ld.implicit.script @@ -1,8 +1,10 @@ SECTIONS { - .lpstub : { *(.lpstub) } + .lpstub : { + *libc.a:*(.text .text.*) + *(.lpstub) + } } PROVIDE (__nodetext = .); PROVIDE (_nodetext = .); PROVIDE (nodetext = .); INSERT BEFORE .text; - From cc72b2a4a3585309cd75a23ce8b1ec9926590116 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 29 Oct 2018 10:27:34 +0100 Subject: [PATCH 05/61] build: make benchmark/napi all prereq order-only This commit makes the all prerequisites order-only to prevent this target's rules to be executed every time which is currently the case as the all target is a phony target and will be executed every time. PR-URL: https://github.com/nodejs/node/pull/23951 Reviewed-By: Richard Lau Reviewed-By: Franziska Hinkelmann Reviewed-By: Refael Ackermann --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 88be22fcace3ec..aa8d75242c00f5 100644 --- a/Makefile +++ b/Makefile @@ -308,19 +308,19 @@ test-valgrind: all test-check-deopts: all $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential -benchmark/napi/function_call/build/Release/binding.node: all \ +benchmark/napi/function_call/build/Release/binding.node: \ benchmark/napi/function_call/napi_binding.c \ benchmark/napi/function_call/binding.cc \ - benchmark/napi/function_call/binding.gyp + benchmark/napi/function_call/binding.gyp | all $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ --python="$(PYTHON)" \ --directory="$(shell pwd)/benchmark/napi/function_call" \ --nodedir="$(shell pwd)" -benchmark/napi/function_args/build/Release/binding.node: all \ +benchmark/napi/function_args/build/Release/binding.node: \ benchmark/napi/function_args/napi_binding.c \ benchmark/napi/function_args/binding.cc \ - benchmark/napi/function_args/binding.gyp + benchmark/napi/function_args/binding.gyp | all $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ --python="$(PYTHON)" \ --directory="$(shell pwd)/benchmark/napi/function_args" \ From 9be73ea1537b6008b166e642ebd1b0a717a18a69 Mon Sep 17 00:00:00 2001 From: Ouyang Yadong Date: Wed, 31 Oct 2018 16:53:38 +0800 Subject: [PATCH 06/61] doc: add types and their corresponding return values This commit supplements some types and their corresponding return values in docs, including `AsyncResource`, `DiffieHellman`, `ECDH`, `https.Server`, `repl.REPLServer`. PR-URL: https://github.com/nodejs/node/pull/23998 Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca --- doc/api/async_hooks.md | 2 ++ doc/api/crypto.md | 5 ++++- doc/api/https.md | 3 +++ doc/api/repl.md | 1 + doc/api/tls.md | 5 +++++ tools/doc/type-parser.js | 7 +++++++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 252ded2ca41b2c..f0752a5892c362 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -704,6 +704,8 @@ alternative. #### asyncResource.emitDestroy() +* Returns: {AsyncResource} A reference to `asyncResource`. + Call all `destroy` hooks. This should only ever be called once. An error will be thrown if it is called more than once. This **must** be manually called. If the resource is left to be collected by the GC then the `destroy` hooks will diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 4dbdc101018a96..30e0a50f3fde27 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1555,6 +1555,7 @@ changes: * `generator` {number | string | Buffer | TypedArray | DataView} **Default:** `2` * `generatorEncoding` {string} +* Returns: {DiffieHellman} Creates a `DiffieHellman` key exchange object using the supplied `prime` and an optional specific `generator`. @@ -1578,6 +1579,7 @@ added: v0.5.0 * `primeLength` {number} * `generator` {number | string | Buffer | TypedArray | DataView} **Default:** `2` +* Returns: {DiffieHellman} Creates a `DiffieHellman` key exchange object and generates a prime of `primeLength` bits using an optional specific numeric `generator`. @@ -1588,6 +1590,7 @@ If `generator` is not specified, the value `2` is used. added: v0.11.14 --> * `curveName` {string} +* Returns: {ECDH} Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a predefined curve specified by the `curveName` string. Use @@ -1840,7 +1843,7 @@ console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] added: v0.7.5 --> * `groupName` {string} -* Returns: {Object} +* Returns: {DiffieHellman} Creates a predefined `DiffieHellman` key exchange object. The supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in diff --git a/doc/api/https.md b/doc/api/https.md index 21317f83a4486a..b61a4bef08d22d 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -28,6 +28,7 @@ This class is a subclass of `tls.Server` and emits events same as added: v0.1.90 --> * `callback` {Function} +* Returns: {https.Server} See [`server.close()`][`http.close()`] from the HTTP module for details. @@ -55,6 +56,7 @@ added: v0.11.2 --> * `msecs` {number} **Default:** `120000` (2 minutes) * `callback` {Function} +* Returns: {https.Server} See [`http.Server#setTimeout()`][]. @@ -81,6 +83,7 @@ added: v0.3.4 * `options` {Object} Accepts `options` from [`tls.createServer()`][], [`tls.createSecureContext()`][] and [`http.createServer()`][]. * `requestListener` {Function} A listener to be added to the `'request'` event. +* Returns: {https.Server} ```js // curl -k https://localhost:8000/ diff --git a/doc/api/repl.md b/doc/api/repl.md index d010265327e5fa..09fe9ebcbece61 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -499,6 +499,7 @@ changes: * `breakEvalOnSigint` - Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is pressed. This cannot be used together with a custom `eval` function. **Default:** `false`. +* Returns: {repl.REPLServer} The `repl.start()` method creates and starts a [`repl.REPLServer`][] instance. diff --git a/doc/api/tls.md b/doc/api/tls.md index d6ead9060182c5..30dfb9c31e01fe 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -378,6 +378,7 @@ added: v0.3.2 * `callback` {Function} A listener callback that will be registered to listen for the server instance's `'close'` event. +* Returns: {tls.Server} The `server.close()` method stops the server from accepting new connections. @@ -911,6 +912,7 @@ changes: * ...: [`tls.createSecureContext()`][] options that are used if the `secureContext` option is missing, otherwise they are ignored. * `callback` {Function} +* Returns: {tls.TLSSocket} The `callback` function, if specified, will be added as a listener for the [`'secureConnect'`][] event. @@ -985,6 +987,7 @@ added: v0.11.3 * `path` {string} Default value for `options.path`. * `options` {Object} See [`tls.connect()`][]. * `callback` {Function} See [`tls.connect()`][]. +* Returns: {tls.TLSSocket} Same as [`tls.connect()`][] except that `path` can be provided as an argument instead of an option. @@ -1000,6 +1003,7 @@ added: v0.11.3 * `host` {string} Default value for `options.host`. * `options` {Object} See [`tls.connect()`][]. * `callback` {Function} See [`tls.connect()`][]. +* Returns: {tls.TLSSocket} Same as [`tls.connect()`][] except that `port` and `host` can be provided as arguments instead of options. @@ -1172,6 +1176,7 @@ changes: * ...: Any [`tls.createSecureContext()`][] option can be provided. For servers, the identity options (`pfx` or `key`/`cert`) are usually required. * `secureConnectionListener` {Function} +* Returns: {tls.Server} Creates a new [`tls.Server`][]. The `secureConnectionListener`, if provided, is automatically set as a listener for the [`'secureConnection'`][] event. diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index b57dc6957a9ae0..49d888e88b9900 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -36,6 +36,7 @@ const customTypesMap = { `${jsDocPrefix}Reference/Iteration_protocols#The_iterator_protocol`, 'AsyncHook': 'async_hooks.html#async_hooks_async_hooks_createhook_callbacks', + 'AsyncResource': 'async_hooks.html#async_hooks_class_asyncresource', 'Buffer': 'buffer.html#buffer_class_buffer', @@ -45,6 +46,8 @@ const customTypesMap = { 'Cipher': 'crypto.html#crypto_class_cipher', 'Decipher': 'crypto.html#crypto_class_decipher', + 'DiffieHellman': 'crypto.html#crypto_class_diffiehellman', + 'ECDH': 'crypto.html#crypto_class_ecdh', 'Hash': 'crypto.html#crypto_class_hash', 'Hmac': 'crypto.html#crypto_class_hmac', 'Sign': 'crypto.html#crypto_class_sign', @@ -83,6 +86,8 @@ const customTypesMap = { 'Http2Stream': 'http2.html#http2_class_http2stream', 'ServerHttp2Stream': 'http2.html#http2_class_serverhttp2stream', + 'https.Server': 'https.html#https_class_https_server', + 'module': 'modules.html#modules_the_module_object', 'Handle': 'net.html#net_server_listen_handle_backlog_callback', @@ -101,6 +106,8 @@ const customTypesMap = { 'readline.Interface': 'readline.html#readline_class_interface', + 'repl.REPLServer': 'repl.html#repl_class_replserver', + 'Stream': 'stream.html#stream_stream', 'stream.Duplex': 'stream.html#stream_class_stream_duplex', 'stream.Readable': 'stream.html#stream_class_stream_readable', From f1f1ae4387e2c8835b8317e5bcdb01a7d7f37c2d Mon Sep 17 00:00:00 2001 From: Jagannath Bhat Date: Tue, 30 Oct 2018 23:01:18 +0530 Subject: [PATCH 07/61] doc: improve BUILDING.md PR-URL: https://github.com/nodejs/node/pull/23976 Reviewed-By: Anna Henningsen Reviewed-By: Denys Otrishko Reviewed-By: Vse Mozhet Byt Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Rich Trott --- BUILDING.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 4beba6ea81715e..efe39e656b383a 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -95,8 +95,8 @@ platforms in production. by Joyent. SmartOS images >= 16.4 are not supported because GCC 4.8 runtime libraries are not available in their pkgsrc repository -2: Tier 1 support for building on Windows is only on 64 bit - hosts. Support is experimental for 32 bit hosts. +2: Tier 1 support for building on Windows is only on 64-bit + hosts. Support is experimental for 32-bit hosts. 3: On Windows, running Node.js in Windows terminal emulators like `mintty` requires the usage of [winpty](https://github.com/rprichard/winpty) @@ -114,7 +114,7 @@ platforms in production. ### Supported toolchains -Depending on host platform, the selection of toolchains may vary. +Depending on the host platform, the selection of toolchains may vary. #### Unix @@ -126,11 +126,11 @@ Depending on host platform, the selection of toolchains may vary. #### Windows -* Visual Studio 2017 with the Windows 10 SDK on a 64 bit host. +* Visual Studio 2017 with the Windows 10 SDK on a 64-bit host. #### OpenSSL asm support -OpenSSL-1.1.0 requires the following asssembler version for use of asm +OpenSSL-1.1.0 requires the following assembler version for use of asm support on x86_64 and ia32. * gas (GNU assembler) version 2.23 or higher @@ -314,7 +314,7 @@ These core dumps are useful for debugging when provided with the corresponding original debug binary and system information. Reading the core dump requires `gdb` built on the same platform the core dump -was captured on (i.e. 64 bit `gdb` for `node` built on a 64 bit system, Linux +was captured on (i.e. 64-bit `gdb` for `node` built on a 64-bit system, Linux `gdb` for `node` built on Linux) otherwise you will get errors like `not in executable format: File format not recognized`. @@ -433,7 +433,7 @@ $ ./configure --without-intl $ pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu ``` -If you are cross compiling, your `pkg-config` must be able to supply a path +If you are cross-compiling, your `pkg-config` must be able to supply a path that works for both your host and target environments. #### Build with a specific ICU: @@ -481,7 +481,7 @@ This version of Node.js does not support FIPS. ## Building Node.js with external core modules It is possible to specify one or more JavaScript text files to be bundled in -the binary as builtin modules when building Node.js. +the binary as built-in modules when building Node.js. ### Unix/macOS From 00c0539625dfd8d68b2710a4ae02117a166bef19 Mon Sep 17 00:00:00 2001 From: Jagannath Bhat Date: Tue, 30 Oct 2018 23:08:04 +0530 Subject: [PATCH 08/61] doc: improve COLLABORATOR_GUIDE PR-URL: https://github.com/nodejs/node/pull/23977 Reviewed-By: Denys Otrishko Reviewed-By: Vse Mozhet Byt Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- COLLABORATOR_GUIDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 7cfc6388c549b5..fd26ea5f15d0db 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -497,7 +497,7 @@ This should be done where a pull request: Assign the `tsc-review` label or @-mention the `@nodejs/tsc` GitHub team if you want to elevate an issue to the [TSC][]. -Do not use the GitHub UI on the right hand side to assign to +Do not use the GitHub UI on the right-hand side to assign to `@nodejs/tsc` or request a review from `@nodejs/tsc`. The TSC should serve as the final arbiter where required. @@ -528,7 +528,7 @@ The TSC should serve as the final arbiter where required. you are unsure exactly how to format the commit messages, use the commit log as a reference. See [this commit][commit-example] as an example. -For PRs from first time contributors, be [welcoming](#welcoming-first-time-contributors). +For PRs from first-time contributors, be [welcoming](#welcoming-first-time-contributors). Also, verify that their git settings are to their liking. All commits should be self-contained, meaning every commit should pass all From 0ca364655f3e87d4bd4ff99fde17a0d2a66b0f6a Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Tue, 30 Oct 2018 16:59:53 -0700 Subject: [PATCH 09/61] test: fix test-fs-watch-system-limit On some systems the default inotify limits might be too high for the test to actually fail. Detect and skip the test in such environments. PR-URL: https://github.com/nodejs/node/pull/23986 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- test/sequential/test-fs-watch-system-limit.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/sequential/test-fs-watch-system-limit.js b/test/sequential/test-fs-watch-system-limit.js index e896cbf83b965a..8b9cb62ad0a007 100644 --- a/test/sequential/test-fs-watch-system-limit.js +++ b/test/sequential/test-fs-watch-system-limit.js @@ -2,6 +2,7 @@ const common = require('../common'); const assert = require('assert'); const child_process = require('child_process'); +const fs = require('fs'); const stream = require('stream'); if (!common.isLinux) @@ -9,6 +10,20 @@ if (!common.isLinux) if (!common.enoughTestCpu) common.skip('This test is resource-intensive'); +try { + // Ensure inotify limit is low enough for the test to actually exercise the + // limit with small enough resources. + const limit = Number( + fs.readFileSync('/proc/sys/fs/inotify/max_user_watches', 'utf8')); + if (limit > 16384) + common.skip('inotify limit is quite large'); +} catch (e) { + if (e.code === 'ENOENT') + common.skip('the inotify /proc subsystem does not exist'); + // Fail on other errors. + throw e; +} + const processes = []; const gatherStderr = new stream.PassThrough(); gatherStderr.setEncoding('utf8'); From db4f92d081b5dbf49fce9acf163ca0173635aa26 Mon Sep 17 00:00:00 2001 From: Shobhit Chittora Date: Mon, 20 Aug 2018 21:32:31 +0530 Subject: [PATCH 10/61] child_process: handle undefined/null for fork() args PR-URL: https://github.com/nodejs/node/pull/22416 Fixes: https://github.com/nodejs/node/issues/20749 Reviewed-By: James M Snell Reviewed-By: Denys Otrishko Reviewed-By: Matheus Marchini --- lib/child_process.js | 5 +++ test/fixtures/child-process-echo-options.js | 1 + .../test-child-process-fork-options.js | 37 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 test/fixtures/child-process-echo-options.js create mode 100644 test/parallel/test-child-process-fork-options.js diff --git a/lib/child_process.js b/lib/child_process.js index bc86ab3797ad17..f08acd76c7953b 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -69,6 +69,11 @@ exports.fork = function fork(modulePath /* , args, options */) { args = arguments[pos++]; } + if (pos < arguments.length && + (arguments[pos] === undefined || arguments[pos] === null)) { + pos++; + } + if (pos < arguments.length && arguments[pos] != null) { if (typeof arguments[pos] !== 'object') { throw new ERR_INVALID_ARG_VALUE(`arguments[${pos}]`, arguments[pos]); diff --git a/test/fixtures/child-process-echo-options.js b/test/fixtures/child-process-echo-options.js new file mode 100644 index 00000000000000..04f3f8dcffe6a9 --- /dev/null +++ b/test/fixtures/child-process-echo-options.js @@ -0,0 +1 @@ +process.send({ env: process.env }); diff --git a/test/parallel/test-child-process-fork-options.js b/test/parallel/test-child-process-fork-options.js new file mode 100644 index 00000000000000..5efb9bdbb49735 --- /dev/null +++ b/test/parallel/test-child-process-fork-options.js @@ -0,0 +1,37 @@ +'use strict'; +const common = require('../common'); +const fixtures = require('../common/fixtures'); + +// This test ensures that fork should parse options +// correctly if args is undefined or null + +const assert = require('assert'); +const { fork } = require('child_process'); + +const expectedEnv = { foo: 'bar' }; + +{ + const cp = fork(fixtures.path('child-process-echo-options.js'), undefined, + { env: Object.assign({}, process.env, expectedEnv) }); + + cp.on('message', common.mustCall(({ env }) => { + assert.strictEqual(env.foo, expectedEnv.foo); + })); + + cp.on('exit', common.mustCall((code) => { + assert.strictEqual(code, 0); + })); +} + +{ + const cp = fork(fixtures.path('child-process-echo-options.js'), null, + { env: Object.assign({}, process.env, expectedEnv) }); + + cp.on('message', common.mustCall(({ env }) => { + assert.strictEqual(env.foo, expectedEnv.foo); + })); + + cp.on('exit', common.mustCall((code) => { + assert.strictEqual(code, 0); + })); +} From 0ed9aaa7bf6bcab7e7bce903497122da284a63f6 Mon Sep 17 00:00:00 2001 From: mritunjaygoutam12 Date: Tue, 30 Oct 2018 12:59:02 +0530 Subject: [PATCH 11/61] test: add property for RangeError in test-buffer-copy PR-URL: https://github.com/nodejs/node/pull/23968 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig --- test/parallel/test-buffer-copy.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-buffer-copy.js b/test/parallel/test-buffer-copy.js index f3c351f09aead3..a53570fa2213cf 100644 --- a/test/parallel/test-buffer-copy.js +++ b/test/parallel/test-buffer-copy.js @@ -1,10 +1,17 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const b = Buffer.allocUnsafe(1024); const c = Buffer.allocUnsafe(512); + +const errorProperty = { + code: 'ERR_INDEX_OUT_OF_RANGE', + type: RangeError, + message: 'Index out of range' +}; + let cntr = 0; { @@ -107,9 +114,9 @@ bb.fill('hello crazy world'); b.copy(c, 0, 100, 10); // copy throws at negative sourceStart -assert.throws(function() { - Buffer.allocUnsafe(5).copy(Buffer.allocUnsafe(5), 0, -1); -}, RangeError); +common.expectsError( + () => Buffer.allocUnsafe(5).copy(Buffer.allocUnsafe(5), 0, -1), + errorProperty); { // check sourceEnd resets to targetEnd if former is greater than the latter @@ -122,7 +129,8 @@ assert.throws(function() { } // throw with negative sourceEnd -assert.throws(() => b.copy(c, 0, 0, -1), RangeError); +common.expectsError( + () => b.copy(c, 0, -1), errorProperty); // when sourceStart is greater than sourceEnd, zero copied assert.strictEqual(b.copy(c, 0, 100, 10), 0); From e0902c8b4ffa7b24ba2c513c2546f1d8737238f1 Mon Sep 17 00:00:00 2001 From: Esteban Sotillo Date: Mon, 29 Oct 2018 15:22:43 +0100 Subject: [PATCH 12/61] test: fix strictEqual arguments order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/23956 Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Franziska Hinkelmann --- test/parallel/test-http2-write-empty-string.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http2-write-empty-string.js b/test/parallel/test-http2-write-empty-string.js index 6e6ce5254ddcfc..ea591176a47251 100644 --- a/test/parallel/test-http2-write-empty-string.js +++ b/test/parallel/test-http2-write-empty-string.js @@ -25,7 +25,7 @@ server.listen(0, common.mustCall(function() { let res = ''; req.on('response', common.mustCall(function(headers) { - assert.strictEqual(200, headers[':status']); + assert.strictEqual(headers[':status'], 200); })); req.on('data', (chunk) => { @@ -33,7 +33,7 @@ server.listen(0, common.mustCall(function() { }); req.on('end', common.mustCall(function() { - assert.strictEqual('1\n2\n3\n', res); + assert.strictEqual(res, '1\n2\n3\n'); client.close(); })); From 3c314d14adeb79d635627335bffd29bede6d770d Mon Sep 17 00:00:00 2001 From: Jerome Covington Date: Sun, 28 Oct 2018 13:55:59 -0400 Subject: [PATCH 13/61] test: assert that invalidcmd throws error code Update invalidcmd test case in test-child-process-spawn-typeerror to assert on specific expected error code. PR-URL: https://github.com/nodejs/node/pull/23942 Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- test/parallel/test-child-process-spawn-typeerror.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-child-process-spawn-typeerror.js b/test/parallel/test-child-process-spawn-typeerror.js index 31a1867df945f7..82acaf8e088038 100644 --- a/test/parallel/test-child-process-spawn-typeerror.js +++ b/test/parallel/test-child-process-spawn-typeerror.js @@ -33,12 +33,11 @@ const invalidArgValueError = common.expectsError({ code: 'ERR_INVALID_ARG_VALUE', type: TypeError }, 14); const invalidArgTypeError = - common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 12); + common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 13); assert.throws(function() { - const child = spawn(invalidcmd, 'this is not an array'); - child.on('error', common.mustNotCall()); -}, TypeError); + spawn(invalidcmd, 'this is not an array'); +}, invalidArgTypeError); // Verify that valid argument combinations do not throw. spawn(cmd); From add267b3ebc36d94eea8ba4854a252ea58f4d914 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Tue, 30 Oct 2018 14:34:20 -0400 Subject: [PATCH 14/61] tools: update alternative docs versions Add `11.x` and mark `10.x` as `lts`. PR-URL: https://github.com/nodejs/node/pull/23980 Reviewed-By: Refael Ackermann Reviewed-By: Vse Mozhet Byt Reviewed-By: Trivikram Kamat Reviewed-By: Luigi Pinca --- tools/doc/html.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index fd74563dd7fc97..9c9c355574d4e5 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -404,7 +404,8 @@ function altDocs(filename, docCreated) { const [, docCreatedMajor, docCreatedMinor] = docCreated.map(Number); const host = 'https://nodejs.org'; const versions = [ - { num: '10.x' }, + { num: '11.x' }, + { num: '10.x', lts: true }, { num: '9.x' }, { num: '8.x', lts: true }, { num: '7.x' }, From 559ce1cd19f8922b230faaee138cf23054805a1d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 30 Oct 2018 23:14:11 -0700 Subject: [PATCH 15/61] doc: revise CHANGELOG.md text Make the text shorter and clearer. PR-URL: https://github.com/nodejs/node/pull/23988 Reviewed-By: Trivikram Kamat Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- CHANGELOG.md | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffc341d69a8820..689c25b604e524 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,5 @@ # Node.js Changelog - - -To make the changelog easier to both use and manage, it has been split into -multiple files organized according to significant major and minor Node.js -release lines. - Select a Node.js version below to view the changelog history: * [Node.js 10](doc/changelogs/CHANGELOG_V10.md) — **Long Term Support** @@ -119,10 +113,9 @@ release. ### Notes -* Release streams marked with `LTS` are currently covered by the - [Node.js Long Term Support plan](https://github.com/nodejs/Release). -* Release versions displayed in **bold** text represent the most - recent actively supported release. +* The [Node.js Long Term Support plan](https://github.com/nodejs/Release) covers + LTS releases. +* Release versions in **bold** text are the most recent supported releases. ---- ---- From 1956800ebeff20be82f3a8c25583a2b9ea157a90 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 30 Oct 2018 23:22:04 -0700 Subject: [PATCH 16/61] doc: simplify CODE_OF_CONDUCT.md PR-URL: https://github.com/nodejs/node/pull/23989 Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig Reviewed-By: Vse Mozhet Byt Reviewed-By: Michael Dawson Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- CODE_OF_CONDUCT.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 5a935352a1f9f0..4c211405596cb4 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,8 +1,4 @@ # Code of Conduct -The Node.js Code of Conduct document has moved to -https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md. Please update -links to this document accordingly. - -The Node.js Moderation policy can be found at -https://github.com/nodejs/admin/blob/master/Moderation-Policy.md +* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md) +* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/master/Moderation-Policy.md) From e8e59267762065fc66c543e78bb72c525abcac0e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 30 Oct 2018 23:41:03 -0700 Subject: [PATCH 17/61] doc: revise COLLABORATOR_GUIDE.md Simplify text/content. PR-URL: https://github.com/nodejs/node/pull/23990 Reviewed-By: Ben Noordhuis Reviewed-By: Richard Lau Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig Reviewed-By: Vse Mozhet Byt Reviewed-By: Michael Dawson Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- COLLABORATOR_GUIDE.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index fd26ea5f15d0db..7fa6fee197aabc 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -28,7 +28,7 @@ - [Using `git-node`](#using-git-node) - [Technical HOWTO](#technical-howto) - [Troubleshooting](#troubleshooting) - - [I Just Made a Mistake](#i-just-made-a-mistake) + - [I Made a Mistake](#i-made-a-mistake) - [Long Term Support](#long-term-support) - [What is LTS?](#what-is-lts) - [How does LTS work?](#how-does-lts-work) @@ -38,13 +38,10 @@ - [How is an LTS release cut?](#how-is-an-lts-release-cut) * [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker) -This document contains information for Collaborators of the Node.js -project regarding managing the project's code, documentation, and issue tracker. - -Collaborators should be familiar with the guidelines for new -contributors in [CONTRIBUTING.md](./CONTRIBUTING.md) and also -understand the project governance model as outlined in -[GOVERNANCE.md](./GOVERNANCE.md). +This document explains how Collaborators manage the Node.js project. +Collaborators should understand the +[guidelines for new contributors](CONTRIBUTING.md) and the +[project governance model](GOVERNANCE.md). ## Issues and Pull Requests @@ -747,7 +744,7 @@ make -j4 test git push upstream master ``` -### I Just Made a Mistake +### I Made a Mistake * Ping a TSC member. * `#node-dev` on freenode From 0c923cff930decffd98dad9b0804efc9bbac7bcc Mon Sep 17 00:00:00 2001 From: Jagannath Bhat Date: Tue, 30 Oct 2018 23:12:09 +0530 Subject: [PATCH 18/61] doc: address bits of proof reading work PR-URL: https://github.com/nodejs/node/pull/23978 Reviewed-By: Anna Henningsen Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell Reviewed-By: Rich Trott --- GOVERNANCE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 40ef6e7bbe5fcb..da6706e87f0d8c 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -45,7 +45,7 @@ be accepted unless: * Discussions and/or additional changes result in no Collaborators objecting to the change. Previously-objecting Collaborators do not necessarily have to - sign-off on the change, but they should not be opposed to it. + sign off on the change, but they should not be opposed to it. * The change is escalated to the TSC and the TSC votes to approve the change. This should only happen if disagreements between Collaborators cannot be resolved through discussion. @@ -123,7 +123,7 @@ The meeting chair is responsible for ensuring that minutes are taken and that a pull request with the minutes is submitted after the meeting. Due to the challenges of scheduling a global meeting with participants in -several timezones, the TSC will seek to resolve as many agenda items as possible +several time zones, the TSC will seek to resolve as many agenda items as possible outside of meetings using [the TSC issue tracker](https://github.com/nodejs/TSC/issues). The process in the issue tracker is: @@ -196,7 +196,7 @@ completed within a month after the nomination is accepted. ## Consensus Seeking Process -The TSC follows a [Consensus Seeking][] decision making model as described by +The TSC follows a [Consensus Seeking][] decision-making model as described by the [TSC Charter][]. [collaborators-discussions]: https://github.com/orgs/nodejs/teams/collaborators/discussions From 579bcd1e1d4c9fbd8e6fe3631b3248b3d0f32070 Mon Sep 17 00:00:00 2001 From: Ivan Filenko Date: Fri, 2 Nov 2018 00:15:48 +0300 Subject: [PATCH 19/61] doc: fix dublication in net.createServer() docs PR-URL: https://github.com/nodejs/node/pull/24026 Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca --- doc/api/net.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/api/net.md b/doc/api/net.md index eb48ab8d00c87f..a8cd321dca968d 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -886,6 +886,7 @@ added: v0.7.0 --> * `options` {Object} * `connectListener` {Function} + Alias to [`net.createConnection(options[, connectListener])`][`net.createConnection(options)`]. @@ -1028,10 +1029,6 @@ then returns the `net.Socket` that starts the connection. -* `options` {Object} -* `connectionListener` {Function} - -Creates a new TCP or [IPC][] server. * `options` {Object} * `allowHalfOpen` {boolean} Indicates whether half-opened TCP @@ -1042,6 +1039,8 @@ Creates a new TCP or [IPC][] server. [`'connection'`][] event. * Returns: {net.Server} +Creates a new TCP or [IPC][] server. + If `allowHalfOpen` is set to `true`, when the other end of the socket sends a FIN packet, the server will only send a FIN packet back when [`socket.end()`][] is explicitly called, until then the connection is From 24a5c56f13827e9a396dec5499c8eed8f35a3dd7 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Wed, 21 Nov 2018 10:51:56 -0500 Subject: [PATCH 20/61] deps: cherry-pick 2987946 from upstream V8 Original commit message: Stop manual unescaping of script source data when preprocessing logs. It appears that the fields are already being unescaped elsewhere, perhaps by the JSON writer. So if we unescape when adding the source filename and contents, unescaping will happen again later and plain backslashes will be interpreted as escape codes. Bug: v8:6240 Change-Id: Ic66b9017ae685d6dd12944ee8d254991e26fbd32 Reviewed-on: https://chromium-review.googlesource.com/1186625 Reviewed-by: Jaroslav Sevcik Commit-Queue: Bret Sepulveda Cr-Commit-Position: refs/heads/master@{#55401} Refs: https://github.com/v8/v8/commit/29879461ceb4bc9b84b0ec38e4dd192fbf884dc2 PR-URL: https://github.com/nodejs/node/pull/24555 Fixes: https://github.com/nodejs/node/issues/20891 Reviewed-By: Richard Lau Reviewed-By: Bartosz Sosnowski --- common.gypi | 2 +- deps/v8/tools/profile.js | 27 ++------------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/common.gypi b/common.gypi index e73d215a982f72..a04c1df94b539f 100644 --- a/common.gypi +++ b/common.gypi @@ -30,7 +30,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.45', + 'v8_embedder_string': '-node.46', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/tools/profile.js b/deps/v8/tools/profile.js index cddadaaf53121a..74b4b3bf663f66 100644 --- a/deps/v8/tools/profile.js +++ b/deps/v8/tools/profile.js @@ -1002,33 +1002,10 @@ JsonProfile.prototype.addSourcePositions = function( }; }; -function unescapeString(s) { - s = s.split("\\"); - for (var i = 1; i < s.length; i++) { - if (s[i] === "") { - // Double backslash. - s[i] = "\\"; - } else if (i > 0 && s[i].startsWith("x")) { - // Escaped Ascii character. - s[i] = String.fromCharCode(parseInt(s[i].substring(1, 3), 16)) + - s[i].substring(3); - } else if (i > 0 && s[i].startsWith("u")) { - // Escaped unicode character. - s[i] = String.fromCharCode(parseInt(s[i].substring(1, 5), 16)) + - s[i].substring(5); - } else { - if (i > 0 && s[i - 1] !== "\\") { - printErr("Malformed source string"); - } - } - } - return s.join(""); -} - JsonProfile.prototype.addScriptSource = function(script, url, source) { this.scripts_[script] = { - name : unescapeString(url), - source : unescapeString(source) + name : url, + source : source }; }; From d9e10fbf1a473b171151c0f55e7949613a5f0774 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Thu, 11 May 2017 12:33:29 +1000 Subject: [PATCH 21/61] build: only check REPLACEME & DEP...X for releases PR-URL: https://github.com/nodejs/node/pull/24575 Refs: https://github.com/nodejs/node/pull/24551 Refs: https://github.com/nodejs/node/pull/12958 Refs: https://github.com/nodejs/node/pull/12957 Refs: https://github.com/nodejs/node/pull/8325 Reviewed-By: Refael Ackermann Reviewed-By: Daniel Bevenius Reviewed-By: Richard Lau --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index aa8d75242c00f5..9d930803f71ed9 100644 --- a/Makefile +++ b/Makefile @@ -810,12 +810,11 @@ MACOSOUTDIR=out/macos .PHONY: release-only release-only: - @if [ "$(DISTTYPE)" != "nightly" ] && [ "$(DISTTYPE)" != "next-nightly" ] && \ - `grep -q REPLACEME doc/api/*.md`; then \ + @if [ "$(DISTTYPE)" = "release" ] && `grep -q REPLACEME doc/api/*.md`; then \ echo 'Please update REPLACEME in Added: tags in doc/api/*.md (See doc/releases.md)' ; \ exit 1 ; \ fi - @if [ "$(DISTTYPE)" != "nightly" ] && [ "$(DISTTYPE)" != "next-nightly" ] && \ + @if [ "$(DISTTYPE)" = "release" ] && \ `grep -q DEP...X doc/api/deprecations.md`; then \ echo 'Please update DEP...X in doc/api/deprecations.md (See doc/releases.md)' ; \ exit 1 ; \ From 17eaf1bae227df4fd47600c389a820b253bfe74e Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 31 Oct 2018 12:09:18 +0100 Subject: [PATCH 22/61] test: increase --stack_size test-async-wrap-pop Currently, when building with --debug test-async-wrap-pop-id-during-load fails on macosx with the following error: $ out/Debug/node test/parallel/test-async-wrap-pop-id-during-load.js assert.js:86 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: EXIT CODE: 1, STDERR: internal/bootstrap/loaders.js:275 const script = new ContextifyScript( ^ RangeError: Maximum call stack size exceeded at NativeModule.compile (internal/bootstrap/loaders.js:275:22) at NativeModule.require (internal/bootstrap/loaders.js:168:18) at assert.js:31:43 at NativeModule.compile (internal/bootstrap/loaders.js:299:7) at NativeModule.require (internal/bootstrap/loaders.js:168:18) at internal/process/main_thread_only.js:23:16 at NativeModule.compile (internal/bootstrap/loaders.js:299:7) at Function.NativeModule.require (internal/bootstrap/loaders.js:168:18) at startup (internal/bootstrap/node.js:58:38) at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3) at Object. (/node/test/parallel/test-async-wrap-pop-id-during-load.js:21:8) at Module._compile (internal/modules/cjs/loader.js:707:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10) at Module.load (internal/modules/cjs/loader.js:605:32) at tryModuleLoad (internal/modules/cjs/loader.js:544:12) at Function.Module._load (internal/modules/cjs/loader.js:536:3) at Function.Module.runMain (internal/modules/cjs/loader.js:760:12) at startup (internal/bootstrap/node.js:308:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3) This commit suggests increasing the stack_size to 80. Refs: https://github.com/nodejs/node/pull/20940 PR-URL: https://github.com/nodejs/node/pull/23996 Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/parallel/test-async-wrap-pop-id-during-load.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-async-wrap-pop-id-during-load.js b/test/parallel/test-async-wrap-pop-id-during-load.js index 31d2113eabc163..cff7e85fdffef4 100644 --- a/test/parallel/test-async-wrap-pop-id-during-load.js +++ b/test/parallel/test-async-wrap-pop-id-during-load.js @@ -16,7 +16,7 @@ const { spawnSync } = require('child_process'); const ret = spawnSync( process.execPath, - ['--stack_size=75', __filename, 'async'] + ['--stack_size=150', __filename, 'async'] ); assert.strictEqual(ret.status, 0, `EXIT CODE: ${ret.status}, STDERR:\n${ret.stderr}`); From 00badcbf2bc405643f4fce80fa21f1208f4803cf Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 1 Nov 2018 18:04:57 +0800 Subject: [PATCH 23/61] fs: handle result of access binding directly in fs.existsSync Instead of throwing errors in fs.accessSync and then catching it, handle the result from the binding directly in fs.existsSync. Note that the argument validation errors still needs to be caught until we properly deprecate the don't-thrown-on-invalid-arguments behavior. PR-URL: https://github.com/nodejs/node/pull/24015 Fixes: https://github.com/nodejs/node/issues/24008 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Refael Ackermann --- lib/fs.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 9e74beee285f2d..56421924fd287a 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -221,11 +221,14 @@ Object.defineProperty(exists, internalUtil.promisify.custom, { // TODO(joyeecheung): deprecate the never-throw-on-invalid-arguments behavior function existsSync(path) { try { - fs.accessSync(path, F_OK); - return true; + path = toPathIfFileURL(path); + validatePath(path); } catch (e) { return false; } + const ctx = { path }; + binding.access(pathModule.toNamespacedPath(path), F_OK, undefined, ctx); + return ctx.errno === undefined; } function readFileAfterOpen(err, fd) { From 06844e81163677ddd8154bda1d7e7ed1c0da23c7 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 31 Oct 2018 15:41:32 +0100 Subject: [PATCH 24/61] n-api: add missing handle scopes Currently when building with --debug test/addons-napi/test_threadsafe_function will error: $ out/Debug/node test/addons-napi/test_threadsafe_function/test.js FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope 1: 0x10004e287 node::DumpBacktrace(__sFILE*) [node/out/Debug/node] 2: 0x1000cd37b node::Abort() [/node/out/Debug/node] 3: 0x1000cd69f node::OnFatalError(char const*, char const*) [/node/out/Debug/node] 4: 0x1004df0b1 v8::Utils::ReportApiFailure(char const*, char const*) [/nodejs/node/out/Debug/node] 5: 0x100a8c0a9 v8::internal::HandleScope::Extend( v8::internal::Isolate*) [/node/out/Debug/node] 6: 0x1004e4229 v8::EmbedderDataFor(v8::Context*, int, bool, char const*) [/node/out/Debug/node] 7: 0x1004e43fa v8::Context::SlowGetAlignedPointerFromEmbedderData(int) [/node/out/Debug/node] 8: 0x10001c26b v8::Context::GetAlignedPointerFromEmbedderData(int) [/node/out/Debug/node] 9: 0x1000144ea node::Environment::GetCurrent(v8::Local) [/node/out/Debug/node] 10: 0x1000f49e2 napi_env__::node_env() const [/node/out/Debug/node] 11: 0x1000f9885 (anonymous namespace)::v8impl::ThreadSafeFunction:: CloseHandlesAndMaybeDelete(bool) [/node/out/Debug/node] 12: 0x1000fb34f (anonymous namespace)::v8impl::ThreadSafeFunction:: DispatchOne() [/node/out/Debug/node] 13: 0x1000fb129 (anonymous namespace)::v8impl::ThreadSafeFunction:: IdleCb(uv_idle_s*) [/node/out/Debug/node] 14: 0x1011a1b69 uv__run_idle [/node/out/Debug/node] 15: 0x101198179 uv_run [/node/out/Debug/node] 16: 0x1000dfca1 node::Start(...) [/node/out/Debug/node] 17: 0x1000dae50 node::Start(...) [/node/out/Debug/node] 18: 0x1000da56f node::Start(int, char**) [/node/out/Debug/node] 19: 0x10141112e main [/node/out/Debug/node] 20: 0x100001034 start [/node/out/Debug/node] Abort trap: 6 This commit adds two HandleScope's, one to CloseHandlesAndMaybeDelete and one to the lambda. SlowGetAlignedPointerFromEmbedderData will only be called for debug builds: https://github.com/v8/v8/blob/2ef0aa662fe907a1b36ac1abe7d77ad2bcd27733 /include/v8.h#L10440-L10447 PR-URL: https://github.com/nodejs/node/pull/24011 Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- src/node_api.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node_api.cc b/src/node_api.cc index c92175c75fea0a..1f7b1405539e7b 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -1084,6 +1084,7 @@ class ThreadSafeFunction : public node::AsyncResource { } void CloseHandlesAndMaybeDelete(bool set_closing = false) { + v8::HandleScope scope(env->isolate); if (set_closing) { node::Mutex::ScopedLock lock(this->mutex); is_closing = true; @@ -1101,6 +1102,7 @@ class ThreadSafeFunction : public node::AsyncResource { ThreadSafeFunction* ts_fn = node::ContainerOf(&ThreadSafeFunction::async, reinterpret_cast(handle)); + v8::HandleScope scope(ts_fn->env->isolate); ts_fn->env->node_env()->CloseHandle( reinterpret_cast(&ts_fn->idle), [](uv_handle_t* handle) -> void { From e5177e9f3209eb0f2e35afed818dc1d9930aedbb Mon Sep 17 00:00:00 2001 From: Weijia Wang Date: Tue, 30 Oct 2018 16:33:00 +0800 Subject: [PATCH 25/61] repl: use promise#finally PR-URL: https://github.com/nodejs/node/pull/23971 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat --- lib/repl.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 3d0020d82d8f18..e02eb8493a6d89 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -374,18 +374,8 @@ function REPLServer(prompt, } promise.then((result) => { - // Remove prioritized SIGINT listener if it was not called. - // TODO(TimothyGu): Use Promise.prototype.finally when it becomes - // available. - prioritizedSigintQueue.delete(sigintListener); - finishExecution(undefined, result); - unpause(); }, (err) => { - // Remove prioritized SIGINT listener if it was not called. - prioritizedSigintQueue.delete(sigintListener); - - unpause(); if (err && process.domain) { debug('not recoverable, send to domain'); process.domain.emit('error', err); @@ -393,6 +383,10 @@ function REPLServer(prompt, return; } finishExecution(err); + }).finally(() => { + // Remove prioritized SIGINT listener if it was not called. + prioritizedSigintQueue.delete(sigintListener); + unpause(); }); } } From 7f0c3bbc2b10958fa2539d7a8c135119a4edc934 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 1 Nov 2018 20:41:10 -0700 Subject: [PATCH 26/61] doc: edit man page for superfluous "node" usage Rather than ponder "node" vs. "Node.js", remove the descriptor so it's just "command-line options" rather than "node command-line options" or "Node.js command-line options". PR-URL: https://github.com/nodejs/node/pull/24029 Reviewed-By: Vse Mozhet Byt Reviewed-By: Richard Lau Reviewed-By: Gus Caplan Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- doc/node.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/node.1 b/doc/node.1 index 397b40ed71e3f4..b8144f4ebb5f6c 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -66,7 +66,7 @@ Alias for stdin, analogous to the use of - in other command-line utilities. The executed script is read from stdin, and remaining arguments are passed to the script. . .It Fl - -Indicate the end of node options. +Indicate the end of command-line options. Pass the rest of the arguments to the script. .Pp If no script filename or eval/print script is supplied prior to this, then @@ -246,7 +246,7 @@ Evaluate as JavaScript. . .It Fl h , Fl -help -Print Node.js command line options. +Print command-line options. The output of this option is less detailed than this document. . .It Fl i , Fl -interactive From 4fb93d1bf38dea9f277f78e4b406daceb5168a6a Mon Sep 17 00:00:00 2001 From: warnerp18 Date: Thu, 1 Nov 2018 21:24:54 -0700 Subject: [PATCH 27/61] doc: add SECURITY.md to readme.md This adds a SECURITY.md file and links to the security document per the request of @https://github.com/Trott at a recent SF Node meetup. PR-URL: https://github.com/nodejs/node/pull/24031 Reviewed-By: Rich Trott Reviewed-By: Vse Mozhet Byt Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca --- README.md | 39 ++------------------------------------- SECURITY.md | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 37 deletions(-) create mode 100644 SECURITY.md diff --git a/README.md b/README.md index 671e5321450c7e..a4a93612c1036d 100644 --- a/README.md +++ b/README.md @@ -159,43 +159,8 @@ source and a list of supported platforms. ## Security -If you find a security vulnerability in Node.js, please report it to -security@nodejs.org. Please withhold public disclosure until after the security -team has addressed the vulnerability. - -The security team will acknowledge your email within 24 hours. You will receive -a more detailed response within 48 hours. - -There are no hard and fast rules to determine if a bug is worth reporting as a -security issue. Here are some examples of past issues and what the Security -Response Team thinks of them. When in doubt, please do send us a report -nonetheless. - - -### Public disclosure preferred - -- [#14519](https://github.com/nodejs/node/issues/14519): _Internal domain - function can be used to cause segfaults_. Requires the ability to execute - arbitrary JavaScript code. That is already the highest level of privilege - possible. - -### Private disclosure preferred - -- [CVE-2016-7099](https://nodejs.org/en/blog/vulnerability/september-2016-security-releases/): - _Fix invalid wildcard certificate validation check_. This was a high-severity - defect. It caused Node.js TLS clients to accept invalid wildcard certificates. - -- [#5507](https://github.com/nodejs/node/pull/5507): _Fix a defect that makes - the CacheBleed Attack possible_. Many, though not all, OpenSSL vulnerabilities - in the TLS/SSL protocols also affect Node.js. - -- [CVE-2016-2216](https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/): - _Fix defects in HTTP header parsing for requests and responses that can allow - response splitting_. This was a remotely-exploitable defect in the Node.js - HTTP implementation. - -When in doubt, please do send us a report. - +For information on reporting security vulnerabilities in Node.js, see +[SECURITY.md](./SECURITY.md). ## Current Project Team Members diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000000000..5f1e3e2cc7d563 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,37 @@ +# Security + +If you find a security vulnerability in Node.js, please report it to +security@nodejs.org. Please withhold public disclosure until after the security +team has addressed the vulnerability. + +The security team will acknowledge your email within 24 hours. You will receive +a more detailed response within 48 hours. + +There are no hard and fast rules to determine if a bug is worth reporting as a +security issue. Here are some examples of past issues and what the Security +Response Team thinks of them. When in doubt, please do send us a report +nonetheless. + +## Public disclosure preferred + +- [#14519](https://github.com/nodejs/node/issues/14519): _Internal domain + function can be used to cause segfaults_. Requires the ability to execute + arbitrary JavaScript code. That is already the highest level of privilege + possible. + +## Private disclosure preferred + +- [CVE-2016-7099](https://nodejs.org/en/blog/vulnerability/september-2016-security-releases/): + _Fix invalid wildcard certificate validation check_. This was a high-severity + defect. It caused Node.js TLS clients to accept invalid wildcard certificates. + +- [#5507](https://github.com/nodejs/node/pull/5507): _Fix a defect that makes + the CacheBleed Attack possible_. Many, though not all, OpenSSL vulnerabilities + in the TLS/SSL protocols also affect Node.js. + +- [CVE-2016-2216](https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/): + _Fix defects in HTTP header parsing for requests and responses that can allow + response splitting_. This was a remotely-exploitable defect in the Node.js + HTTP implementation. + +When in doubt, please do send us a report. From 40c375248424ae5540cb09c293b5a5a9fb6e86c6 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 3 Nov 2018 19:51:54 +0100 Subject: [PATCH 28/61] doc: fix socket.connecting description In particular, this value is `true` and not `false` between calling `connect()` and the operation finishing. PR-URL: https://github.com/nodejs/node/pull/24066 Reviewed-By: Joyee Cheung Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- doc/api/net.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/net.md b/doc/api/net.md index a8cd321dca968d..1b495da81c3f56 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -658,9 +658,9 @@ called with `{port: port, host: host}` as `options`. added: v6.1.0 --> -If `true` - +If `true`, [`socket.connect(options[, connectListener])`][`socket.connect(options)`] -was called and haven't yet finished. Will be set to `false` before emitting +was called and has not yet finished. Will be set to `true` before emitting `'connect'` event and/or calling [`socket.connect(options[, connectListener])`][`socket.connect(options)`]'s callback. From 0ad910317abfe52c564b63fa623109a3eecd953f Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 1 Nov 2018 23:55:19 -0400 Subject: [PATCH 29/61] tools: add script to lint first PR commit message Decouple first commit in pull request linting from Travis by using the GitHub API to work out the first commit. The shell script obtains the pull request number in one of the following ways: 1) supplied on the command line (use this to test against any PR) 2) derived from the HEAD commit via the GitHub API PR-URL: https://github.com/nodejs/node/pull/24030 Reviewed-By: Refael Ackermann Reviewed-By: Rich Trott --- .travis.yml | 2 +- tools/lint-pr-commit-message.sh | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tools/lint-pr-commit-message.sh diff --git a/.travis.yml b/.travis.yml index 21ec6dab70f994..dce15b7ab16851 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ matrix: script: - make lint # Lint the first commit in the PR. - - \[ -z "$TRAVIS_COMMIT_RANGE" \] || (echo -e '\nLinting the commit message according to the guidelines at https://goo.gl/p2fr5Q\n' && git log $TRAVIS_COMMIT_RANGE --pretty=format:'%h' --no-merges | tail -1 | xargs npx -q core-validate-commit --no-validate-metadata) + - \[ "${TRAVIS_PULL_REQUEST}" != "false" \] && PR_ID=${TRAVIS_PULL_REQUEST}; bash tools/lint-pr-commit-message.sh ${PR_ID} - name: "Test Suite" addons: apt: diff --git a/tools/lint-pr-commit-message.sh b/tools/lint-pr-commit-message.sh new file mode 100644 index 00000000000000..1998026a16ae39 --- /dev/null +++ b/tools/lint-pr-commit-message.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +# Shell script to lint the message of the first commit in a pull request. +# +# Depends on curl, git, node, npm and npx being in $PATH. +# +# The pull request is either: +# 1) supplied as an argument to this shell script +# 2) derived from the HEAD commit via the GitHub API + +GH_API_URL="https://api.github.com" +PR_ID=$1; +if [ -z "${PR_ID}" ]; then + # Attempt to work out the PR number based on current HEAD + if HEAD_COMMIT="$( git rev-parse HEAD )"; then + if SEARCH_RESULTS="$( curl -s ${GH_API_URL}/search/issues?q=sha:${HEAD_COMMIT}+type:pr+repo:nodejs/node )"; then + if FOUND_PR="$( node -p 'JSON.parse(process.argv[1]).items[0].number' "${SEARCH_RESULTS}" 2> /dev/null )"; then + PR_ID=${FOUND_PR} + fi + fi + fi +fi +if [ -z "${PR_ID}" ]; then + echo "Unable to determine the pull request number to check. Please specify, " + echo " e.g. $0 " + exit 1 +fi +# Retrieve the first commit of the pull request via GitHub API +# TODO: If we teach core-validate-commit to ignore "fixup!" and "squash!" +# commits and lint messages for all commits in the pull request +# we could simplify the following to: +# npx -q core-validate-commit --no-validate-metadata ${GH_API_URL}/repos/nodejs/node/pulls/${PR_ID}/commits +if PR_COMMITS="$( curl -s ${GH_API_URL}/repos/nodejs/node/pulls/${PR_ID}/commits )"; then + if FIRST_COMMIT="$( node -p 'JSON.parse(process.argv[1])[0].url' "${PR_COMMITS}" 2> /dev/null )"; then + echo "Linting the first commit message for pull request ${PR_ID}" + echo "according to the guidelines at https://goo.gl/p2fr5Q." + # Print the commit message to make it more obvious what is being checked. + echo "Commit message for ${FIRST_COMMIT##*/} is:" + node -p 'JSON.parse(process.argv[1])[0].commit.message' "${PR_COMMITS}" 2> /dev/null + npx -q core-validate-commit --no-validate-metadata "${FIRST_COMMIT}" + else + echo "Unable to determine the first commit for pull request ${PR_ID}." + exit 1 + fi +fi From f6a48d687515411c67a8eb37ab4ec24f9f377308 Mon Sep 17 00:00:00 2001 From: mritunjaygoutam12 Date: Sat, 3 Nov 2018 03:42:26 +0530 Subject: [PATCH 30/61] doc: correct link to test coverage command PR-URL: https://github.com/nodejs/node/pull/24049 Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca --- doc/guides/writing-tests.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index 2059a709ff8a95..4d0c0307bbd765 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -414,7 +414,7 @@ will depend on what is being tested if this is required or not. ### Test Coverage To generate a test coverage report, see the -[Test Coverage section of the Pull Requests guide][]. +[Test Coverage section of the Building guide][]. [ASCII]: http://man7.org/linux/man-pages/man7/ascii.7.html [Google Test]: https://github.com/google/googletest @@ -423,5 +423,5 @@ To generate a test coverage report, see the [all maintained branches]: https://github.com/nodejs/lts [node.green]: http://node.green/ [test fixture]: https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#test-fixtures-using-the-same-data-configuration-for-multiple-tests -[Test Coverage section of the Pull Requests guide]: https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#test-coverage +[Test Coverage section of the Building guide]: https://github.com/nodejs/node/blob/master/BUILDING.md#running-coverage [directory structure overview]: https://github.com/nodejs/node/blob/master/test/README.md#test-directories From aebd6d9fc2f80c9d56aea6c721079bc479eb6411 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 4 Nov 2018 00:18:49 -0700 Subject: [PATCH 31/61] doc: add missing comma in net documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24074 Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Vse Mozhet Byt --- doc/api/net.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/net.md b/doc/api/net.md index 1b495da81c3f56..07c88cc88520af 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -167,7 +167,7 @@ The number of concurrent connections on the server. This becomes `null` when sending a socket to a child with [`child_process.fork()`][]. To poll forks and get current number of active -connections use asynchronous [`server.getConnections()`][] instead. +connections, use asynchronous [`server.getConnections()`][] instead. ### server.getConnections(callback) diff --git a/tools/lint-md.js b/tools/lint-md.js index 3c22cd8704ffc2..cbb658dd418932 100644 --- a/tools/lint-md.js +++ b/tools/lint-md.js @@ -30293,88 +30293,61 @@ function stringify$7(options) { var remark = unified_1().use(remarkParse).use(remarkStringify).freeze(); -const _args = [["remark@8.0.0","D:\\code\\prws\\tools\\node-lint-md-cli-rollup"]]; -const _from = "remark@8.0.0"; -const _id = "remark@8.0.0"; -const _inBundle = false; -const _integrity = "sha512-K0PTsaZvJlXTl9DN6qYlvjTkqSZBFELhROZMrblm2rB+085flN84nz4g/BscKRMqDvhzlK1oQ/xnWQumdeNZYw=="; -const _location = "/remark"; -const _phantomChildren = {}; -const _requested = {"type":"version","registry":true,"raw":"remark@8.0.0","name":"remark","escapedName":"remark","rawSpec":"8.0.0","saveSpec":null,"fetchSpec":"8.0.0"}; -const _requiredBy = ["/"]; -const _resolved = "https://registry.npmjs.org/remark/-/remark-8.0.0.tgz"; -const _spec = "8.0.0"; -const _where = "D:\\code\\prws\\tools\\node-lint-md-cli-rollup"; -const author = {"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}; -const bugs = {"url":"https://github.com/wooorm/remark/issues"}; -const contributors = [{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}]; -const dependencies = {"remark-parse":"^4.0.0","remark-stringify":"^4.0.0","unified":"^6.0.0"}; +const name = "remark"; +const version$1 = "8.0.0"; const description = "Markdown processor powered by plugins"; -const files = ["index.js"]; -const homepage = "http://remark.js.org"; -const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; const license = "MIT"; -const name = "remark"; -const repository = {"type":"git","url":"https://github.com/wooorm/remark/tree/master/packages/remark"}; +const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; +const dependencies = {"remark-parse":"^4.0.0","remark-stringify":"^4.0.0","unified":"^6.0.0"}; +const homepage = "http://remark.js.org"; +const repository = "https://github.com/wooorm/remark/tree/master/packages/remark"; +const bugs = "https://github.com/wooorm/remark/issues"; +const author = "Titus Wormer (http://wooorm.com)"; +const contributors = ["Titus Wormer (http://wooorm.com)"]; +const files = ["index.js"]; const scripts = {}; -const version$1 = "8.0.0"; const xo = false; +const _resolved = "https://registry.npmjs.org/remark/-/remark-8.0.0.tgz"; +const _integrity = "sha512-K0PTsaZvJlXTl9DN6qYlvjTkqSZBFELhROZMrblm2rB+085flN84nz4g/BscKRMqDvhzlK1oQ/xnWQumdeNZYw=="; +const _from = "remark@8.0.0"; var _package = { - _args: _args, - _from: _from, - _id: _id, - _inBundle: _inBundle, - _integrity: _integrity, - _location: _location, - _phantomChildren: _phantomChildren, - _requested: _requested, - _requiredBy: _requiredBy, - _resolved: _resolved, - _spec: _spec, - _where: _where, - author: author, - bugs: bugs, - contributors: contributors, - dependencies: dependencies, + name: name, + version: version$1, description: description, - files: files, - homepage: homepage, - keywords: keywords, license: license, - name: name, + keywords: keywords, + dependencies: dependencies, + homepage: homepage, repository: repository, + bugs: bugs, + author: author, + contributors: contributors, + files: files, scripts: scripts, - version: version$1, - xo: xo + xo: xo, + _resolved: _resolved, + _integrity: _integrity, + _from: _from }; var _package$1 = Object.freeze({ - _args: _args, - _from: _from, - _id: _id, - _inBundle: _inBundle, - _integrity: _integrity, - _location: _location, - _phantomChildren: _phantomChildren, - _requested: _requested, - _requiredBy: _requiredBy, - _resolved: _resolved, - _spec: _spec, - _where: _where, - author: author, - bugs: bugs, - contributors: contributors, - dependencies: dependencies, + name: name, + version: version$1, description: description, - files: files, - homepage: homepage, - keywords: keywords, license: license, - name: name, + keywords: keywords, + dependencies: dependencies, + homepage: homepage, repository: repository, + bugs: bugs, + author: author, + contributors: contributors, + files: files, scripts: scripts, - version: version$1, xo: xo, + _resolved: _resolved, + _integrity: _integrity, + _from: _from, default: _package }); @@ -30382,7 +30355,7 @@ const name$1 = "node-lint-md-cli-rollup"; const description$1 = "remark packaged for node markdown linting"; const version$2 = "1.0.0"; const devDependencies = {"rollup":"^0.55.5","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-json":"^2.3.1","rollup-plugin-node-resolve":"^3.4.0"}; -const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^8.0.0","remark-lint":"^6.0.2","remark-preset-lint-node":"^1.0.3","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; +const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^8.0.0","remark-lint":"^6.0.2","remark-preset-lint-node":"^1.1.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; const scripts$1 = {"build":"rollup -c","build-node":"npm run build && cp dist/* .."}; var _package$2 = { name: name$1, @@ -32479,7 +32452,84 @@ function noInlinePadding(tree, file) { } } +var remarkLintMaximumLineLength = unifiedLintRule('remark-lint:maximum-line-length', maximumLineLength); + var start$6 = unistUtilPosition.start; +var end$4 = unistUtilPosition.end; + +function maximumLineLength(tree, file, pref) { + var style = typeof pref === 'number' && !isNaN(pref) ? pref : 80; + var content = String(file); + var lines = content.split(/\r?\n/); + var length = lines.length; + var index = -1; + var lineLength; + + unistUtilVisit(tree, ['heading', 'table', 'code', 'definition'], ignore); + unistUtilVisit(tree, ['link', 'image', 'inlineCode'], inline); + + /* Iterate over every line, and warn for violating lines. */ + while (++index < length) { + lineLength = lines[index].length; + + if (lineLength > style) { + file.message('Line must be at most ' + style + ' characters', { + line: index + 1, + column: lineLength + 1 + }); + } + } + + /* Finally, whitelist some inline spans, but only if they occur at or after + * the wrap. However, when they do, and there’s white-space after it, they + * are not whitelisted. */ + function inline(node, pos, parent) { + var next = parent.children[pos + 1]; + var initial; + var final; + + /* istanbul ignore if - Nothing to whitelist when generated. */ + if (unistUtilGenerated(node)) { + return + } + + initial = start$6(node); + final = end$4(node); + + /* No whitelisting when starting after the border, or ending before it. */ + if (initial.column > style || final.column < style) { + return + } + + /* No whitelisting when there’s white-space after + * the link. */ + if ( + next && + start$6(next).line === initial.line && + (!next.value || /^(.+?[ \t].+?)/.test(next.value)) + ) { + return + } + + whitelist(initial.line - 1, final.line); + } + + function ignore(node) { + /* istanbul ignore else - Hard to test, as we only run this case on `position: true` */ + if (!unistUtilGenerated(node)) { + whitelist(start$6(node).line - 1, end$4(node).line); + } + } + + /* Whitelist from `initial` to `final`, zero-based. */ + function whitelist(initial, final) { + while (initial < final) { + lines[initial++] = ''; + } + } +} + +var start$7 = unistUtilPosition.start; @@ -32502,7 +32552,7 @@ function noMultipleToplevelHeadings(tree, file, pref) { node ); } else { - duplicate = unistUtilStringifyPosition(start$6(node)); + duplicate = unistUtilStringifyPosition(start$7(node)); } } } @@ -32664,8 +32714,8 @@ var rule$1 = unifiedLintRule; var remarkLintRuleStyle = rule$1('remark-lint:rule-style', ruleStyle); -var start$7 = unistUtilPosition.start; -var end$4 = unistUtilPosition.end; +var start$8 = unistUtilPosition.start; +var end$5 = unistUtilPosition.end; function ruleStyle(tree, file, pref) { var contents = String(file); @@ -32681,8 +32731,8 @@ function ruleStyle(tree, file, pref) { unistUtilVisit(tree, 'thematicBreak', visitor); function visitor(node) { - var initial = start$7(node).offset; - var final = end$4(node).offset; + var initial = start$8(node).offset; + var final = end$5(node).offset; var rule; if (!unistUtilGenerated(node)) { @@ -32701,8 +32751,8 @@ function ruleStyle(tree, file, pref) { var remarkLintTablePipes = unifiedLintRule('remark-lint:table-pipes', tablePipes); -var start$8 = unistUtilPosition.start; -var end$5 = unistUtilPosition.end; +var start$9 = unistUtilPosition.start; +var end$6 = unistUtilPosition.end; var reasonStart = 'Missing initial pipe in table fence'; var reasonEnd = 'Missing final pipe in table fence'; @@ -32730,15 +32780,15 @@ function tablePipes(tree, file) { cells = row.children; head = cells[0]; tail = cells[cells.length - 1]; - initial = contents.slice(start$8(row).offset, start$8(head).offset); - final = contents.slice(end$5(tail).offset, end$5(row).offset); + initial = contents.slice(start$9(row).offset, start$9(head).offset); + final = contents.slice(end$6(tail).offset, end$6(row).offset); if (initial.indexOf('|') === -1) { - file.message(reasonStart, start$8(row)); + file.message(reasonStart, start$9(row)); } if (final.indexOf('|') === -1) { - file.message(reasonEnd, end$5(row)); + file.message(reasonEnd, end$6(row)); } } } @@ -32800,8 +32850,8 @@ var remarkLintCheckboxCharacterStyle = unifiedLintRule( checkboxCharacterStyle ); -var start$9 = unistUtilPosition.start; -var end$6 = unistUtilPosition.end; +var start$10 = unistUtilPosition.start; +var end$7 = unistUtilPosition.end; var checked = {x: true, X: true}; var unchecked = {' ': true, '\t': true}; @@ -32846,8 +32896,8 @@ function checkboxCharacterStyle(tree, file, pref) { } type = types[node.checked]; - initial = start$9(node).offset; - final = (node.children.length ? start$9(node.children[0]) : end$6(node)).offset; + initial = start$10(node).offset; + final = (node.children.length ? start$10(node.children[0]) : end$7(node)).offset; /* For a checkbox to be parsed, it must be followed by a white space. */ value = contents @@ -32881,8 +32931,8 @@ function checkboxCharacterStyle(tree, file, pref) { var remarkLintCodeBlockStyle = unifiedLintRule('remark-lint:code-block-style', codeBlockStyle); -var start$10 = unistUtilPosition.start; -var end$7 = unistUtilPosition.end; +var start$11 = unistUtilPosition.start; +var end$8 = unistUtilPosition.end; var styles = {null: true, fenced: true, indented: true}; @@ -32915,8 +32965,8 @@ function codeBlockStyle(tree, file, pref) { /* Get the style of `node`. */ function check(node) { - var initial = start$10(node).offset; - var final = end$7(node).offset; + var initial = start$11(node).offset; + var final = end$8(node).offset; if (unistUtilGenerated(node)) { return null @@ -33111,8 +33161,8 @@ function strongMarker(tree, file, pref) { var remarkLintTableCellPadding = unifiedLintRule('remark-lint:table-cell-padding', tableCellPadding); -var start$11 = unistUtilPosition.start; -var end$8 = unistUtilPosition.end; +var start$12 = unistUtilPosition.start; +var end$9 = unistUtilPosition.end; var styles$1 = {null: true, padded: true, compact: true}; @@ -33160,8 +33210,8 @@ function tableCellPadding(tree, file, pref) { next = cells[column + 1]; fence = contents.slice( - cell ? end$8(cell).offset : start$11(row).offset, - next ? start$11(next).offset : end$8(row).offset + cell ? end$9(cell).offset : start$12(row).offset, + next ? start$12(next).offset : end$9(row).offset ); pos = fence.indexOf('|'); @@ -33238,7 +33288,7 @@ function tableCellPadding(tree, file, pref) { } function size(node) { - return end$8(node).offset - start$11(node).offset + return end$9(node).offset - start$12(node).offset } var plugins$1 = [ @@ -33258,6 +33308,7 @@ var plugins$1 = [ remarkLintNoHeadingContentIndent, remarkLintNoHeadingIndent, remarkLintNoInlinePadding, + remarkLintMaximumLineLength, remarkLintNoMultipleToplevelHeadings, remarkLintNoShellDollars, remarkLintNoShortcutReferenceImage, diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index 49fcc015cd6829..2d37506884a12b 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -2108,6 +2108,17 @@ "unist-util-visit": "^1.1.1" } }, + "remark-lint-maximum-line-length": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remark-lint-maximum-line-length/-/remark-lint-maximum-line-length-1.1.0.tgz", + "integrity": "sha512-L+jI6+DReoxHyAWRIxABjX8hPDgxB8B5Lzp0/nDYjWbjl7I4vTsdEvejpmP1K8LVvZ7Ew0XcVHd1zt+p2O8tDg==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, "remark-lint-no-auto-link-without-protocol": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/remark-lint-no-auto-link-without-protocol/-/remark-lint-no-auto-link-without-protocol-1.0.2.tgz", @@ -2352,9 +2363,9 @@ } }, "remark-preset-lint-node": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-1.0.3.tgz", - "integrity": "sha512-Ztmm7tcdWWmz/tpCU+bBz9QDRfjrTsa4PUSUWXwPBjQA07asGmw9qUzNTFc1iHXpXVs9xEz1IbVXpWwEJ+9uvA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-1.1.0.tgz", + "integrity": "sha512-wT37p0rYGgSy92XNjd7S5WZmtzRLq5iYT9mhVo/p3dVG9oF5NjOjFNUFu/6JBYgGBmZllftWvhrUpKNg+QXqug==", "requires": { "remark-lint": "^6.0.0", "remark-lint-blockquote-indentation": "^1.0.0", @@ -2370,6 +2381,7 @@ "remark-lint-first-heading-level": "^1.0.0", "remark-lint-hard-break-spaces": "^1.0.1", "remark-lint-heading-style": "^1.0.0", + "remark-lint-maximum-line-length": "^1.1.0", "remark-lint-no-auto-link-without-protocol": "^1.0.0", "remark-lint-no-blockquote-without-caret": "^1.0.0", "remark-lint-no-duplicate-definitions": "^1.0.0", @@ -3173,9 +3185,9 @@ } }, "unist-util-generated": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.2.tgz", - "integrity": "sha512-1HcwiEO62dr0XWGT+abVK4f0aAm8Ik8N08c5nAYVmuSxfvpA9rCcNyX/le8xXj1pJK5nBrGlZefeWB6bN8Pstw==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.3.tgz", + "integrity": "sha512-qlPeDqnQnd84KIqwphzOR+l02cxjDzvEYEBl84EjmKRrX4eUmjyAo8xJv1SCDhJqNjyHRnBMZWNKAiBtXE6hBg==" }, "unist-util-inspect": { "version": "4.1.3", @@ -3191,9 +3203,9 @@ "integrity": "sha512-YkXBK/H9raAmG7KXck+UUpnKiNmUdB+aBGrknfQ4EreE1banuzrKABx3jP6Z5Z3fMSPMQQmeXBlKpCbMwBkxVw==" }, "unist-util-position": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.0.1.tgz", - "integrity": "sha512-05QfJDPI7PE1BIUtAxeSV+cDx21xP7+tUZgSval5CA7tr0pHBwybF7OnEa1dOFqg6BfYH/qiMUnWwWj+Frhlww==" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.0.2.tgz", + "integrity": "sha512-npmFu92l/+b1Ao6uGP4I1WFz9hsKv7qleZ4aliw6x0RVu6A9A3tAf57NMpFfzQ02jxRtJZuRn+C8xWT7GWnH0g==" }, "unist-util-remove-position": { "version": "1.1.2", diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json index e2b105f91bcf4f..b3d491717d4d2f 100644 --- a/tools/node-lint-md-cli-rollup/package.json +++ b/tools/node-lint-md-cli-rollup/package.json @@ -12,7 +12,7 @@ "markdown-extensions": "^1.1.0", "remark": "^8.0.0", "remark-lint": "^6.0.2", - "remark-preset-lint-node": "^1.0.3", + "remark-preset-lint-node": "^1.1.0", "unified-args": "^6.0.0", "unified-engine": "^5.1.0" }, From 219040d95d66144aaa5cec2eacee807f70546f38 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 7 Nov 2018 12:36:57 -0500 Subject: [PATCH 57/61] doc: fix linting errors PR-URL: https://github.com/nodejs/node/pull/24229 Reviewed-By: Rich Trott Reviewed-By: Refael Ackermann --- doc/api/errors.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index e9cf397ebc4f7f..bad6444e471220 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -260,7 +260,10 @@ not capture any frames. * {string} The `error.code` property is a string label that identifies the kind of error. -`error.code` is the most stable way to identify an error. It will only change between major versions of Node.js. In contrast, `error.message` strings may change between any versions of Node.js. See [Node.js Error Codes][] for details about specific codes. +`error.code` is the most stable way to identify an error. It will only change +between major versions of Node.js. In contrast, `error.message` strings may +change between any versions of Node.js. See [Node.js Error Codes][] for details +about specific codes. ### error.message @@ -489,7 +492,8 @@ system error. * {string|number} -The `error.errno` property is a number or a string. If it is a number, it is a negative value which corresponds to the error code defined in +The `error.errno` property is a number or a string. If it is a number, it is a +negative value which corresponds to the error code defined in [`libuv Error handling`]. See the libuv `errno.h` header file (`deps/uv/include/uv/errno.h` in the Node.js source tree) for details. In case of a string, it is the same as `error.code`. From a273da96fa2179ba94557ffb17175a2f87340261 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 6 Nov 2018 11:17:26 -0800 Subject: [PATCH 58/61] src: prefer param function check over args length PR-URL: https://github.com/nodejs/node/pull/23835 Reviewed-By: Refael Ackermann Reviewed-By: Matheus Marchini Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Michael Dawson Reviewed-By: James M Snell Reviewed-By: John-David Dalton Reviewed-By: Yuta Hiroto --- lib/fs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 56421924fd287a..8d2c1dca628a2b 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -408,7 +408,7 @@ function open(path, flags, mode, callback) { path = toPathIfFileURL(path); validatePath(path); const flagsNumber = stringToFlags(flags); - if (arguments.length < 4) { + if (typeof mode === 'function') { callback = makeCallback(mode); mode = 0o666; } else { @@ -788,7 +788,7 @@ function readdirSync(path, options) { } function fstat(fd, options, callback) { - if (arguments.length < 3) { + if (typeof options === 'function') { callback = options; options = {}; } @@ -799,7 +799,7 @@ function fstat(fd, options, callback) { } function lstat(path, options, callback) { - if (arguments.length < 3) { + if (typeof options === 'function') { callback = options; options = {}; } @@ -812,7 +812,7 @@ function lstat(path, options, callback) { } function stat(path, options, callback) { - if (arguments.length < 3) { + if (typeof options === 'function') { callback = options; options = {}; } From 69360601aa8360ea1bf64dadf3e2106e3b5bb891 Mon Sep 17 00:00:00 2001 From: mritunjaygoutam12 Date: Sun, 4 Nov 2018 11:12:44 +0530 Subject: [PATCH 59/61] build: change repo to https protocol in Makefile PR-URL: https://github.com/nodejs/node/pull/24073 Reviewed-By: Refael Ackermann Reviewed-By: Rich Trott Reviewed-By: Richard Lau --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9d930803f71ed9..ae3830ddd40e00 100644 --- a/Makefile +++ b/Makefile @@ -205,7 +205,7 @@ coverage-build: all if [ ! -d node_modules/nyc ]; then \ $(NODE) ./deps/npm install nyc@13 --no-save --no-package-lock; fi if [ ! -d gcovr ]; then git clone -b 3.4 --depth=1 \ - --single-branch git://github.com/gcovr/gcovr.git; fi + --single-branch https://github.com/gcovr/gcovr.git; fi if [ ! -d build ]; then git clone --depth=1 \ --single-branch https://github.com/nodejs/build.git; fi if [ ! -f gcovr/scripts/gcovr.orig ]; then \ From 4cc8ec2ddc67a075a239b86a3d8bce230e311de7 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Mon, 29 Oct 2018 16:53:10 -0700 Subject: [PATCH 60/61] doc: sort markdown refs in errors Backport-PR-URL: https://github.com/nodejs/node/pull/24678 PR-URL: https://github.com/nodejs/node/pull/23972 Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca --- doc/api/errors.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index bad6444e471220..e120a58b5d9c14 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2097,24 +2097,25 @@ instance.setEncoding('utf8'); An attempt has been made to create a string larger than the maximum allowed size. -[`--force-fips`]: cli.html#cli_force_fips [`'uncaughtException'`]: process.html#process_event_uncaughtexception +[`--force-fips`]: cli.html#cli_force_fips +[`Class: assert.AssertionError`]: assert.html#assert_class_assert_assertionerror +[`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE +[`EventEmitter`]: events.html#events_class_eventemitter +[`Writable`]: stream.html#stream_class_stream_writable [`child_process`]: child_process.html [`cipher.getAuthTag()`]: crypto.html#crypto_cipher_getauthtag -[`Class: assert.AssertionError`]: assert.html#assert_class_assert_assertionerror [`crypto.scrypt()`]: crypto.html#crypto_crypto_scrypt_password_salt_keylen_options_callback [`crypto.scryptSync()`]: crypto.html#crypto_crypto_scryptsync_password_salt_keylen_options [`crypto.timingSafeEqual()`]: crypto.html#crypto_crypto_timingsafeequal_a_b [`dgram.createSocket()`]: dgram.html#dgram_dgram_createsocket_options_callback -[`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE -[`EventEmitter`]: events.html#events_class_eventemitter -[`fs`]: fs.html [`errno`(3) man page]: http://man7.org/linux/man-pages/man3/errno.3.html [`fs.readFileSync`]: fs.html#fs_fs_readfilesync_path_options [`fs.readdir`]: fs.html#fs_fs_readdir_path_options_callback [`fs.symlink()`]: fs.html#fs_fs_symlink_target_path_type_callback [`fs.symlinkSync()`]: fs.html#fs_fs_symlinksync_target_path_type [`fs.unlink`]: fs.html#fs_fs_unlink_path_callback +[`fs`]: fs.html [`hash.digest()`]: crypto.html#crypto_hash_digest_encoding [`hash.update()`]: crypto.html#crypto_hash_update_data_inputencoding [`http`]: http.html @@ -2126,10 +2127,10 @@ size. [`process.send()`]: process.html#process_process_send_message_sendhandle_options_callback [`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn [`readable._read()`]: stream.html#stream_readable_read_size_1 -[`require()`]: modules.html#modules_require [`require('crypto').setEngine()`]: crypto.html#crypto_crypto_setengine_engine_flags -[`server.listen()`]: net.html#net_server_listen +[`require()`]: modules.html#modules_require [`server.close()`]: net.html#net_server_close_callback +[`server.listen()`]: net.html#net_server_listen [`sign.sign()`]: crypto.html#crypto_sign_sign_privatekey_outputformat [`stream.pipe()`]: stream.html#stream_readable_pipe_destination_options [`stream.push()`]: stream.html#stream_readable_push_chunk_encoding @@ -2137,18 +2138,19 @@ size. [`stream.write()`]: stream.html#stream_writable_write_chunk_encoding_callback [`subprocess.kill()`]: child_process.html#child_process_subprocess_kill_signal [`subprocess.send()`]: child_process.html#child_process_subprocess_send_message_sendhandle_options_callback -[`Writable`]: stream.html#stream_class_stream_writable [`zlib`]: zlib.html [ES6 module]: esm.html +[ICU]: intl.html#intl_internationalization_support [Node.js Error Codes]: #nodejs-error-codes [V8's stack trace API]: https://github.com/v8/v8/wiki/Stack-Trace-API +[WHATWG Supported Encodings]: util.html#util_whatwg_supported_encodings [WHATWG URL API]: url.html#url_the_whatwg_url_api [crypto digest algorithm]: crypto.html#crypto_crypto_gethashes [domains]: domain.html [event emitter-based]: events.html#events_class_eventemitter [file descriptors]: https://en.wikipedia.org/wiki/File_descriptor +[online]: http://man7.org/linux/man-pages/man3/errno.3.html [stream-based]: stream.html [syscall]: http://man7.org/linux/man-pages/man2/syscalls.2.html [try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch [vm]: vm.html -[WHATWG Supported Encodings]: util.html#util_whatwg_supported_encodings From 2a9f701acf48eba00e8673bca34dafc557942e81 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Fri, 30 Nov 2018 13:46:34 -0800 Subject: [PATCH 61/61] fixup! doc: sort markdown refs in errors --- doc/api/errors.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index e120a58b5d9c14..3e9f78f2762298 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2149,7 +2149,6 @@ size. [domains]: domain.html [event emitter-based]: events.html#events_class_eventemitter [file descriptors]: https://en.wikipedia.org/wiki/File_descriptor -[online]: http://man7.org/linux/man-pages/man3/errno.3.html [stream-based]: stream.html [syscall]: http://man7.org/linux/man-pages/man2/syscalls.2.html [try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
10Current