Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cares_wrap.cc #38572

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 195 additions & 0 deletions .github/label-pr-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
## Order of entries in this map *does* matter for the resolved labels
## earlier entries override later entries
subSystemLabels:
# src subsystems
/^src\/async-wrap/: c++, async_wrap
/^src\/(?:base64|node_buffer|string_)/: c++, buffer
/^src\/cares/: c++, cares
/^src\/(?:process_wrap|spawn_)/: c++, child_process
/^src\/(?:node_)?crypto/: c++, crypto
/^src\/(?:debug-|node_debug)/: c++, debugger
/^src\/udp_/: c++, dgram
/^src\/(?:fs_|node_file|node_stat_watcher)/: c++, fs
/^src\/node_http_parser/: c++, http_parser
/^src\/node_i18n/: c++, intl
/^src\/uv\./: c++, libuv
/^src\/(?:connect(?:ion)?|pipe|tcp)_/: c++, net
/^src\/node_os/: c++, os
/^src\/(?:node_main|signal_)/: c++, process
/^src\/timer_/: c++, timers
/^src\/(?:CNNICHashWhitelist|node_root_certs|tls_)/: c++, tls
/^src\/tty_/: c++, tty
/^src\/node_url/: c++, url-whatwg
/^src\/node_util/: c++, util
/^src\/(?:node_v8|v8abbr)/: c++, V8 Engine
/^src\/node_contextify/: c++, vm
/^src\/.*win32.*/: c++, windows
/^src\/node_zlib/: c++, zlib
/^src\/tracing/: c++, tracing
/^src\/node_api/: c++, n-api
/^src\/node_http2/: c++, http2, dont-land-on-v6.x
/^src\/node_report/: c++, report
/^src\/node_wasi/: c++, wasi
/^src\/node_worker/: c++, worker
/^src\/quic\/*/: c++, quic, dont-land-on-v14.x, dont-land-on-v12.x
/^src\/node_bob*/: c++, quic, dont-land-on-v14.x, dont-land-on-v12.x

# don't label python files as c++
/^src\/.+\.py$/: lib / src, needs-ci

# properly label changes to v8 inspector integration-related files
/^src\/inspector_/: c++, inspector, needs-ci

# don't want to label it a c++ update when we're "only" bumping the Node.js version
/^src\/(?!node_version\.h)/: c++
# BUILDING.md should be marked as 'build' in addition to 'doc'
/^BUILDING\.md$/: build, doc
# meta is a very specific label for things that are policy and or meta-info related
/^([A-Z]+$|CODE_OF_CONDUCT|ROADMAP|WORKING_GROUPS|GOVERNANCE|CHANGELOG|\.mail|\.git.+)/: meta
# things that edit top-level .md files are always a doc change
/^\w+\.md$/: doc
# different variants of *Makefile and build files
/^(tools\/)?(Makefile|BSDmakefile|create_android_makefiles|\.travis\.yml)$/: build, needs-ci
/^tools\/(install\.py|genv8constants\.py|getnodeversion\.py|js2c\.py|utils\.py|configure\.d\/.*)$/: build, needs-ci
/^vcbuild\.bat$/: build, windows, needs-ci
/^(android-)?configure|node\.gyp|common\.gypi$/: build, needs-ci
# more specific tools
/^tools\/gyp/: tools, build, needs-ci
/^tools\/doc\//: tools, doc
/^tools\/icu\//: tools, intl, needs-ci
/^tools\/(?:osx-pkg\.pmdoc|pkgsrc)\//: tools, macos, install
/^tools\/(?:(?:mac)?osx-)/: tools, macos
/^tools\/test-npm/: tools, test, npm
/^tools\/test/: tools, test
/^tools\/(?:certdata|mkssldef|mk-ca-bundle)/: tools, openssl, tls
/^tools\/msvs\//: tools, windows, install, needs-ci
/^tools\/[^/]+\.bat$/: tools, windows, needs-ci
/^tools\/make-v8/: tools, V8 Engine, needs-ci
/^tools\/(code_cache|snapshot|v8_gypfiles)/: needs-ci,
/^tools\/build-addons.js/: needs-ci,
# all other tool changes should be marked as such
/^tools\//: tools
/^\.eslint|\.remark|\.editorconfig/: tools

## Dependencies
# libuv needs an explicit mapping, as the ordinary /deps/ mapping below would
# end up as libuv changes labeled with "uv" (which is a non-existing label)
/^deps\/uv\//: libuv
/^deps\/v8\/tools\/gen-postmortem-metadata\.py/: V8 Engine, post-mortem
/^deps\/v8\//: V8 Engine
/^deps\/uvwasi\//: wasi
/^deps\/nghttp2\/nghttp2\.gyp/: build, http2, dont-land-on-v6.x
/^deps\/nghttp2\//: http2, dont-land-on-v6.x
/^deps\/ngtcp2\//: quic, dont-land-on-v14.x, dont-land-on-v12.x
/^deps\/nghttp3\//: quic, dont-land-on-v14.x, dont-land-on-v12.x
/^deps\/([^/]+)/: $1

## JS subsystems
# Oddities first
/^lib\/(punycode|\w+\/freelist|sys\.js)/: ''
/^lib\/constants\.js$/: lib / src
/^lib\/_(debug_agent|debugger)\.js$/: debugger
/^lib(\/\w+)?\/(_)?link(ed)?list/: timers
/^lib\/\w+\/bootstrap_node/: lib / src
/^lib\/\w+\/v8_prof_/: tools
/^lib\/\w+\/socket_list/: net
/^lib\/\w+\/streams$/: stream
/^lib\/.*http2/: http2, dont-land-on-v6.x
/^lib\/worker_threads.js$/: worker
/^lib\/internal\/url\.js$/: url-whatwg
/^lib\/internal\/modules\/esm/: ES Modules
/^lib\/internal\/quic\/*/: quic, dont-land-on-v14.x, dont-land-on-v12.x

# All other lib/ files map directly
/^lib\/_(\w+)_\w+\.js?$/: $1 # e.g. _(stream)_wrap
/^lib(\/internal)?\/(\w+)\.js?$/: $2 # other .js files
/^lib\/internal\/(\w+)(?:\/|$)/: $1 # internal subfolders

exlusiveLabels:
# more specific tests
/^test\/addons\//: test, addons
/^test\/debugger\//: test, debugger
/^test\/doctool\//: test, doc, tools
/^test\/timers\//: test, timers
/^test\/pseudo-tty\//: test, tty
/^test\/inspector\//: test, inspector
/^test\/cctest\/test_inspector/: test, inspector
/^test\/cctest\/test_url/: test, url-whatwg
/^test\/addons-napi\//: test, n-api
/^test\/async-hooks\//: test, async_hooks
/^test\/report\//: test, report
/^test\/fixtures\/es-module/: test, ES Modules
/^test\/es-module\//: test, ES Modules

/^test\//: test

# specific map for webcrypto.md as it should be labeled 'crypto'
/^doc\/api\/webcrypto.md$/: doc, crypto
# specific map for modules.md as it should be labeled 'module' not 'modules'
/^doc\/api\/modules.md$/: doc, module
# specific map for esm.md as it should be labeled 'ES Modules' not 'esm'
/^doc\/api\/esm.md$/: doc, ES Modules
# n-api is treated separately since it is not a JS core module but is still
# considered a subsystem of sorts
/^doc\/api\/n-api.md$/: doc, n-api
# quic
/^doc\/api\/quic.md$/: doc, quic, dont-land-on-v14.x, dont-land-on-v12.x
# add worker label to PRs that affect doc/api/worker_threads.md
/^doc\/api\/worker_threads.md$/: doc, worker
# automatically tag JS subsystem-specific API doc changes
/^doc\/api\/(\w+)\.md$/: doc, $1
# add deprecations label to PRs that affect doc/api/deprecations.md
/^doc\/api\/deprecations.md$/: doc, deprecations

/^doc\//: doc

# more specific benchmarks
/^benchmark\/buffers\//: benchmark, buffer
/^benchmark\/(?:arrays|es)\//: benchmark, V8 Engine
/^benchmark\/_http/: benchmark, http
/^benchmark\/(?:misc|fixtures)\//: benchmark
/^benchmark\/streams\//: benchmark, stream
/^benchmark\/([^/]+)\//: benchmark, $1

/^benchmark\//: benchmark

allJsSubSystems:
- assert
- async_hooks
- buffer
- child_process
- cluster
- console
- crypto
- debugger
- dgram
- dns
- domain
- events
- esm
- fs
- http
- https
- http2
- module
- net
- os
- path
- process
- querystring
- quic
- readline
- repl
- report
- stream
- string_decoder
- timers
- tls
- tty
- url
- util
- v8
- vm
- wasi
- worker
- zlib
14 changes: 14 additions & 0 deletions .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Label PRs

on:
pull_request_target:
types: [opened]

jobs:
label:
runs-on: ubuntu-latest

steps:
- uses: nodejs/node-pr-labeler@v1
with:
configuration-path: .github/label-pr-config.yml
4 changes: 4 additions & 0 deletions deps/cjs-module-lexer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.1.1
- Better support for Babel reexport getter function forms (https://github.com/guybedford/cjs-module-lexer/issues/50)
- Support Babel interopRequireWildcard reexports patterns (https://github.com/guybedford/cjs-module-lexer/issues/52)

1.1.0
- Support for Babel reexport conflict filter (https://github.com/guybedford/cjs-module-lexer/issues/36, @nicolo-ribaudo)
- Support trailing commas in getter patterns (https://github.com/guybedford/cjs-module-lexer/issues/31)
Expand Down
8 changes: 4 additions & 4 deletions deps/cjs-module-lexer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ EXPORTS_DEFINE_VALUE: EXPORTS_DEFINE `, {`
(`enumerable: true,`)?
(
`value:` |
`get` (`: function` IDENTIFIER? )? `()` {` return IDENTIFIER (`.` IDENTIFIER | `[` IDENTIFIER_STRING `]`)? `;`? `}` `,`?
`get` (`: function` IDENTIFIER? )? `() {` return IDENTIFIER (`.` IDENTIFIER | `[` IDENTIFIER_STRING `]`)? `;`? `}` `,`?
)
`})`

EXPORTS_LITERAL: MODULE_EXPORTS `=` `{` (EXPORTS_LITERAL_PROP | EXPORTS_SPREAD) `,`)+ `}`

REQUIRE: `require` `(` STRING_LITERAL `)`

EXPORTS_ASSIGN: (`var` | `const` | `let`) IDENTIFIER `=` REQUIRE
EXPORTS_ASSIGN: (`var` | `const` | `let`) IDENTIFIER `=` (`_interopRequireWildcard (`)? REQUIRE

MODULE_EXPORTS_ASSIGN: MODULE_EXPORTS `=` REQUIRE

Expand All @@ -119,7 +119,7 @@ EXPORT_STAR_LIB: `Object.keys(` IDENTIFIER$1 `).forEach(function (` IDENTIFIER$2
)
(
EXPORTS_IDENTIFIER `[` IDENTIFIER$2 `] =` IDENTIFIER$1 `[` IDENTIFIER$2 `]` `;`? |
`Object.defineProperty(` EXPORTS_IDENTIFIER `, ` IDENTIFIER$2 `, { enumerable: true, get: function () { return ` IDENTIFIER$1 `[` IDENTIFIER$2 `]` `;`? `}` `,`? `})` `;`?
`Object.defineProperty(` EXPORTS_IDENTIFIER `, ` IDENTIFIER$2 `, { enumerable: true, get` (`: function` IDENTIFIER? )? `() { return ` IDENTIFIER$1 `[` IDENTIFIER$2 `]` `;`? `}` `,`? `})` `;`?
)
`})`
```
Expand All @@ -129,7 +129,7 @@ Spacing between tokens is taken to be any ECMA-262 whitespace, ECMA-262 block co
* The returned export names are taken to be the combination of:
1. All `IDENTIFIER` and `IDENTIFIER_STRING` slots for `EXPORTS_MEMBER` and `EXPORTS_LITERAL` matches.
2. The first `IDENTIFIER_STRING` slot for all `EXPORTS_DEFINE_VALUE` matches where that same string is not an `EXPORTS_DEFINE` match that is not also an `EXPORTS_DEFINE_VALUE` match.
* The reexport specifiers are taken to be the the combination of:
* The reexport specifiers are taken to be the combination of:
1. The `REQUIRE` matches of the last matched of either `MODULE_EXPORTS_ASSIGN` or `EXPORTS_LITERAL`.
2. All _top-level_ `EXPORT_STAR` `REQUIRE` matches and `EXPORTS_ASSIGN` matches whose `IDENTIFIER` also matches the first `IDENTIFIER` in `EXPORT_STAR_LIB`.

Expand Down
2 changes: 1 addition & 1 deletion deps/cjs-module-lexer/dist/lexer.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/cjs-module-lexer/dist/lexer.mjs

Large diffs are not rendered by default.

30 changes: 23 additions & 7 deletions deps/cjs-module-lexer/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,18 @@ function parseSource (cjsSource) {
lastTokenPos = pos;
continue;
case 95/*_*/:
if (source.startsWith('_export', pos + 1) && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) {
if (source.startsWith('interopRequireWildcard', pos + 1) && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) {
const startPos = pos;
pos += 23;
if (source.charCodeAt(pos) === 40/*(*/) {
pos++;
openTokenPosStack[openTokenDepth++] = lastTokenPos;
if (tryParseRequire(Import) && keywordStart(startPos)) {
tryBacktrackAddStarExportBinding(startPos - 1);
}
}
}
else if (source.startsWith('_export', pos + 1) && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) {
pos += 8;
if (source.startsWith('Star', pos))
pos += 4;
Expand Down Expand Up @@ -724,12 +735,17 @@ function tryParseObjectDefineOrKeys (keys) {
if (ch !== 103/*g*/ || !source.startsWith('et', pos + 1)) break;
pos += 3;
ch = commentWhitespace();
if (ch !== 58/*:*/) break;
pos++;
ch = commentWhitespace();
if (ch !== 102/*f*/ || !source.startsWith('unction', pos + 1)) break;
pos += 8;
ch = commentWhitespace();
if (ch === 58/*:*/) {
pos++;
ch = commentWhitespace();
if (ch !== 102/*f*/) break;
if (!source.startsWith('unction', pos + 1)) break;
pos += 8;
let lastPos = pos;
ch = commentWhitespace();
if (ch !== 40 && (lastPos === pos || !identifier())) break;
ch = commentWhitespace();
}
if (ch !== 40/*(*/) break;
pos++;
ch = commentWhitespace();
Expand Down
2 changes: 1 addition & 1 deletion deps/cjs-module-lexer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cjs-module-lexer",
"version": "1.1.0",
"version": "1.1.1",
"description": "Lexes CommonJS modules, returning their named exports metadata",
"main": "lexer.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ success!
[`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
[dynamic instantiate hook]: #esm_code_dynamicinstantiate_code_hook
[`util.TextDecoder`]: util.md#util_class_util_textdecoder
[cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/1.1.0
[cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/1.1.1
[special scheme]: https://url.spec.whatwg.org/#special-scheme
[the official standard format]: https://tc39.github.io/ecma262/#sec-modules
[transpiler loader example]: #esm_transpiler_loader
Expand Down
1 change: 1 addition & 0 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#endif

#if defined(__OpenBSD__)
# define AI_ALL 0
# define AI_V4MAPPED 0
Comment on lines 52 to 54
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously, this was this way before, but I'm wondering why we're not doing

Suggested change
#if defined(__OpenBSD__)
# define AI_ALL 0
# define AI_V4MAPPED 0
// OpenBSD does not define these
#ifndef AI_ALL
#define AI_ALL 0
#endif
#ifndef AI_V4MAPPED
#define AI_V4MAPPED 0

which seems just a bit more future-proof (because OpenBSD might add support at some point) and flexible (because what if there's other OSes that also don't have these)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. From what I can tell, that change should apply to 14.x as well, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VlkrS Err… yeah, I just noticed that this PR was opened against v12.x. Is there a reason for that? Typically changes are being made against the master branch first and then backported, unless there’s a reason not to.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current version in OpenBSD ports is 12.16.1 and I was trying to upgrade that (I'm just a user and not involved in the project), so my concern was mainly to get a more recent 12.x version to build on account of the numerous security patches.

I can confirm that with the current patches in the port and this fix, I get a clean build and as far as I can tell a working node environment on OpenBSD, but I have not even looked into building any later release branch, let alone MASTER yet, so I thought it'd be best to stick to the branch I've actually tested :-)

#endif

Expand Down