From cf44d0d389925fb7f02163fde3904f6f915106f7 Mon Sep 17 00:00:00 2001 From: Mohammed Anas Date: Mon, 27 Nov 2023 02:58:30 +0000 Subject: [PATCH 1/2] c-ares: import patch to allow an empty server list. Fixes https://github.com/void-linux/void-packages/issues/47411. --- .../patches/allow-empty-server-list.patch | 394 ++++++++++++++++++ srcpkgs/c-ares/template | 4 +- 2 files changed, 396 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/c-ares/patches/allow-empty-server-list.patch diff --git a/srcpkgs/c-ares/patches/allow-empty-server-list.patch b/srcpkgs/c-ares/patches/allow-empty-server-list.patch new file mode 100644 index 0000000000000..114a5b8a2b0ed --- /dev/null +++ b/srcpkgs/c-ares/patches/allow-empty-server-list.patch @@ -0,0 +1,394 @@ +From 320cefe1c775e88b4a6b66953deef20fe2735ae2 Mon Sep 17 00:00:00 2001 +From: Brad House +Date: Sun, 19 Nov 2023 13:28:41 -0500 +Subject: [PATCH] ares_set_servers_*() should allow an empty server list + +For historic reasons, we have users depending on ares_set_servers_*() +to return ARES_SUCCESS when passing no servers and actually *clear* +the server list. It appears they do this for test cases to simulate +DNS unavailable or similar. Presumably they could achieve the same +effect in other ways (point to localhost on a port that isn't in use). +But it seems like this might be wide-spread enough to cause headaches +so we just will document and test for this behavior, clearly it hasn't +caused "issues" for anyone with the old behavior. + +See: https://github.com/nodejs/node/pull/50800 + +Fix By: Brad House (@bradh352) +--- +Upstream commit: https://github.com/c-ares/c-ares/commit/320cefe1c775e88b4a6b66953deef20fe2735ae2 + + docs/ares_set_servers.3 | 6 ++- + docs/ares_set_servers_csv.3 | 8 +++- + src/lib/ares_options.c | 8 ++-- + src/lib/ares_private.h | 5 ++- + src/lib/ares_process.c | 10 +++-- + src/lib/ares_update_servers.c | 76 ++++++++++++++++++----------------- + test/ares-test-misc.cc | 41 ++++++++++++++++++- + 7 files changed, 104 insertions(+), 50 deletions(-) + +diff --git a/docs/ares_set_servers.3 b/docs/ares_set_servers.3 +index ac94416ad..e2817e722 100644 +--- a/docs/ares_set_servers.3 ++++ b/docs/ares_set_servers.3 +@@ -42,7 +42,7 @@ The name server linked list pointer argument may be the result of a previous + call to \fBares_get_servers(3)\fP or a linked list of \fBares_addr_node\fP structs + set up by other means. + .PP +-The \fBares_set_servers(3)\fP function also allows the specification of UDP and ++The \fBares_set_servers_ports(3)\fP function also allows the specification of UDP and + TCP ports to be used for communication on a per-server basis. The provided + linked list argument may be the result of a previous call to + \fBares_get_servers_ports(3)\fP or a linked list of \fBares_addr_port_node\fP structs +@@ -51,7 +51,9 @@ set up by other means. + This function replaces any potentially previously configured name servers + with the ones given in the linked list. So, in order to configure a channel + with more than one name server all the desired ones must be specified in a +-single list. ++single list. Though not recommended, passing NULL will clear all configured ++servers and make an inoperable channel, this may be advantageous for test ++simulation but unlikely to be useful in production. + .PP + The function does not take ownership of the linked list argument. + The caller is responsible for freeing the linked list when no longer needed. +diff --git a/docs/ares_set_servers_csv.3 b/docs/ares_set_servers_csv.3 +index 0db159695..44ea72b7d 100644 +--- a/docs/ares_set_servers_csv.3 ++++ b/docs/ares_set_servers_csv.3 +@@ -30,7 +30,13 @@ int ares_set_servers_ports_csv(ares_channel_t *\fIchannel\fP, const char* \fIser + The \fBares_set_servers_csv\fP and \fBares_set_servers_ports_csv\fPfunctions set + the list of DNS servers that ARES will query. As of v1.22.0 this function can + be called on an active channel with running queries, previously it would return +-ARES_ENOTIMP. The format of the servers option is: ++ARES_ENOTIMP. ++ ++Though not recommended, passing NULL for servers will clear all configured ++servers and make an inoperable channel, this may be advantageous for test ++simulation but unlikely to be useful in production. ++ ++The format of the servers option is: + + host[:port][,host[:port]]... + +diff --git a/src/lib/ares_options.c b/src/lib/ares_options.c +index 312fa0301..de1050c88 100644 +--- a/src/lib/ares_options.c ++++ b/src/lib/ares_options.c +@@ -234,12 +234,12 @@ static ares_status_t ares__init_options_servers(ares_channel_t *channel, + const struct in_addr *servers, + size_t nservers) + { +- ares__llist_t *slist; ++ ares__llist_t *slist = NULL; + ares_status_t status; + +- slist = ares_in_addr_to_server_config_llist(servers, nservers); +- if (slist == NULL) { +- return ARES_ENOMEM; ++ status = ares_in_addr_to_server_config_llist(servers, nservers, &slist); ++ if (status != ARES_SUCCESS) { ++ return status; + } + + status = ares__servers_update(channel, slist, ARES_TRUE); +diff --git a/src/lib/ares_private.h b/src/lib/ares_private.h +index 0fcfe8861..14931ca5c 100644 +--- a/src/lib/ares_private.h ++++ b/src/lib/ares_private.h +@@ -477,9 +477,10 @@ ares_status_t ares__sconfig_append(ares__llist_t **sconfig, + unsigned short tcp_port); + ares_status_t ares__sconfig_append_fromstr(ares__llist_t **sconfig, + const char *str); +-ares__llist_t * ++ares_status_t + ares_in_addr_to_server_config_llist(const struct in_addr *servers, +- size_t nservers); ++ size_t nservers, ++ ares__llist_t **llist); + + struct ares_hosts_entry; + typedef struct ares_hosts_entry ares_hosts_entry_t; +diff --git a/src/lib/ares_process.c b/src/lib/ares_process.c +index 2f959b9f6..0c34d7f1d 100644 +--- a/src/lib/ares_process.c ++++ b/src/lib/ares_process.c +@@ -777,7 +777,7 @@ static struct server_state *ares__random_server(ares_channel_t *channel) + + /* Silence coverity, not possible */ + if (num_servers == 0) +- num_servers = 1; ++ return NULL; + + ares__rand_bytes(channel->rand_state, &c, 1); + +@@ -816,9 +816,8 @@ static size_t ares__calc_query_timeout(const struct query *query) + size_t rounds; + size_t num_servers = ares__slist_len(channel->servers); + +- /* Silence coverity, not possible */ + if (num_servers == 0) +- num_servers = 1; ++ return 0; + + /* For each trip through the entire server list, we want to double the + * retry from the last retry */ +@@ -878,6 +877,11 @@ ares_status_t ares__send_query(struct query *query, struct timeval *now) + server = ares__slist_first_val(channel->servers); + } + ++ if (server == NULL) { ++ end_query(channel, query, ARES_ESERVFAIL /* ? */, NULL, 0); ++ return ARES_ECONNREFUSED; ++ } ++ + if (query->using_tcp) { + size_t prior_len = 0; + /* Make sure the TCP socket for this server is set up and queue +diff --git a/src/lib/ares_update_servers.c b/src/lib/ares_update_servers.c +index 2937c727c..9075b7366 100644 +--- a/src/lib/ares_update_servers.c ++++ b/src/lib/ares_update_servers.c +@@ -531,11 +531,14 @@ ares_status_t ares__servers_update(ares_channel_t *channel, + size_t idx = 0; + ares_status_t status; + +- if (channel == NULL || server_list == NULL || +- ares__llist_len(server_list) == 0) { ++ if (channel == NULL) { + return ARES_EFORMERR; + } + ++ /* NOTE: a NULL or zero entry server list is considered valid due to ++ * real-world people needing support for this for their test harnesses ++ */ ++ + /* Add new entries */ + for (node = ares__llist_node_first(server_list); node != NULL; + node = ares__llist_node_next(node)) { +@@ -589,19 +592,18 @@ ares_status_t ares__servers_update(ares_channel_t *channel, + return status; + } + +-static ares__llist_t * +- ares_addr_node_to_server_config_llist(const struct ares_addr_node *servers) ++static ares_status_t ++ ares_addr_node_to_server_config_llist(const struct ares_addr_node *servers, ++ ares__llist_t **llist) + { + const struct ares_addr_node *node; + ares__llist_t *s; + +- if (servers == NULL) { +- return NULL; +- } ++ *llist = NULL; + + s = ares__llist_create(ares_free); + if (s == NULL) { +- return NULL; ++ goto fail; + } + + for (node = servers; node != NULL; node = node->next) { +@@ -632,26 +634,26 @@ static ares__llist_t * + } + } + +- return s; ++ *llist = s; ++ return ARES_SUCCESS; + + fail: + ares__llist_destroy(s); +- return NULL; ++ return ARES_ENOMEM; + } + +-static ares__llist_t *ares_addr_port_node_to_server_config_llist( +- const struct ares_addr_port_node *servers) ++static ares_status_t ares_addr_port_node_to_server_config_llist( ++ const struct ares_addr_port_node *servers, ++ ares__llist_t **llist) + { + const struct ares_addr_port_node *node; + ares__llist_t *s; + +- if (servers == NULL) { +- return NULL; +- } ++ *llist = NULL; + + s = ares__llist_create(ares_free); + if (s == NULL) { +- return NULL; ++ goto fail; + } + + for (node = servers; node != NULL; node = node->next) { +@@ -685,30 +687,30 @@ static ares__llist_t *ares_addr_port_node_to_server_config_llist( + } + } + +- return s; ++ *llist = s; ++ return ARES_SUCCESS; + + fail: + ares__llist_destroy(s); +- return NULL; ++ return ARES_ENOMEM; + } + +-ares__llist_t * ++ares_status_t + ares_in_addr_to_server_config_llist(const struct in_addr *servers, +- size_t nservers) ++ size_t nservers, ++ ares__llist_t **llist) + { + size_t i; + ares__llist_t *s; + +- if (servers == NULL || nservers == 0) { +- return NULL; +- } ++ *llist = NULL; + + s = ares__llist_create(ares_free); + if (s == NULL) { +- return NULL; ++ goto fail; + } + +- for (i = 0; i < nservers; i++) { ++ for (i = 0; servers != NULL && i < nservers; i++) { + ares_sconfig_t *sconfig; + + sconfig = ares_malloc_zero(sizeof(*sconfig)); +@@ -725,11 +727,12 @@ ares__llist_t * + } + } + +- return s; ++ *llist = s; ++ return ARES_SUCCESS; + + fail: + ares__llist_destroy(s); +- return NULL; ++ return ARES_ENOMEM; + } + + int ares_get_servers(ares_channel_t *channel, struct ares_addr_node **servers) +@@ -842,13 +845,13 @@ int ares_set_servers(ares_channel_t *channel, + ares__llist_t *slist; + ares_status_t status; + +- if (channel == NULL || servers == NULL) { ++ if (channel == NULL) { + return ARES_ENODATA; + } + +- slist = ares_addr_node_to_server_config_llist(servers); +- if (slist == NULL) { +- return ARES_ENOMEM; ++ status = ares_addr_node_to_server_config_llist(servers, &slist); ++ if (status != ARES_SUCCESS) { ++ return (int)status; + } + + status = ares__servers_update(channel, slist, ARES_TRUE); +@@ -864,13 +867,13 @@ int ares_set_servers_ports(ares_channel_t *channel, + ares__llist_t *slist; + ares_status_t status; + +- if (channel == NULL || servers == NULL) { ++ if (channel == NULL) { + return ARES_ENODATA; + } + +- slist = ares_addr_port_node_to_server_config_llist(servers); +- if (slist == NULL) { +- return ARES_ENOMEM; ++ status = ares_addr_port_node_to_server_config_llist(servers, &slist); ++ if (status != ARES_SUCCESS) { ++ return (int)status; + } + + status = ares__servers_update(channel, slist, ARES_TRUE); +@@ -904,7 +907,8 @@ static ares_status_t set_servers_csv(ares_channel_t *channel, const char *_csv, + + i = ares_strlen(_csv); + if (i == 0) { +- return ARES_SUCCESS; /* blank all servers */ ++ /* blank all servers */ ++ return (ares_status_t)ares_set_servers_ports(channel, NULL); + } + + csv = ares_malloc(i + 2); +diff --git a/test/ares-test-misc.cc b/test/ares-test-misc.cc +index 4016a8e08..28458f21e 100644 +--- a/test/ares-test-misc.cc ++++ b/test/ares-test-misc.cc +@@ -45,7 +45,21 @@ TEST_F(DefaultChannelTest, GetServersFailures) { + } + + TEST_F(DefaultChannelTest, SetServers) { +- EXPECT_EQ(ARES_ENODATA, ares_set_servers(channel_, nullptr)); ++ /* NOTE: This test is because we have actual external users doing test case ++ * simulation and removing all servers to generate various error ++ * conditions in their own code. It would make more sense to return ++ * ARES_ENODATA, but due to historical users, we can't break them. ++ * See: https://github.com/nodejs/node/pull/50800 ++ */ ++ EXPECT_EQ(ARES_SUCCESS, ares_set_servers(channel_, nullptr)); ++ std::vector expected_empty = { }; ++ EXPECT_EQ(expected_empty, GetNameServers(channel_)); ++ HostResult result; ++ ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); ++ Process(); ++ EXPECT_TRUE(result.done_); ++ EXPECT_EQ(ARES_ESERVFAIL, result.status_); ++ + + struct ares_addr_node server1; + struct ares_addr_node server2; +@@ -63,7 +77,15 @@ TEST_F(DefaultChannelTest, SetServers) { + } + + TEST_F(DefaultChannelTest, SetServersPorts) { +- EXPECT_EQ(ARES_ENODATA, ares_set_servers_ports(channel_, nullptr)); ++ /* NOTE: This test is because we have actual external users doing test case ++ * simulation and removing all servers to generate various error ++ * conditions in their own code. It would make more sense to return ++ * ARES_ENODATA, but due to historical users, we can't break them. ++ * See: https://github.com/nodejs/node/pull/50800 ++ */ ++ EXPECT_EQ(ARES_SUCCESS, ares_set_servers_ports(channel_, nullptr)); ++ std::vector expected_empty = { }; ++ EXPECT_EQ(expected_empty, GetNameServers(channel_)); + + struct ares_addr_port_node server1; + struct ares_addr_port_node server2; +@@ -91,6 +113,21 @@ TEST_F(DefaultChannelTest, SetServersCSV) { + EXPECT_EQ(ARES_ENODATA, ares_set_servers_csv(nullptr, "1.2.3.4.5")); + EXPECT_EQ(ARES_ENODATA, ares_set_servers_csv(nullptr, "1:2:3:4:5")); + ++ /* NOTE: This test is because we have actual external users doing test case ++ * simulation and removing all servers to generate various error ++ * conditions in their own code. It would make more sense to return ++ * ARES_ENODATA, but due to historical users, we can't break them. ++ * See: https://github.com/nodejs/node/pull/50800 ++ */ ++ EXPECT_EQ(ARES_SUCCESS, ares_set_servers_csv(channel_, NULL)); ++ std::vector expected_empty = { }; ++ EXPECT_EQ(expected_empty, GetNameServers(channel_)); ++ EXPECT_EQ(ARES_SUCCESS, ares_set_servers_csv(channel_, "")); ++ EXPECT_EQ(expected_empty, GetNameServers(channel_)); ++ ++ ++ ++ + EXPECT_EQ(ARES_SUCCESS, + ares_set_servers_csv(channel_, "1.2.3.4,0102:0304:0506:0708:0910:1112:1314:1516,2.3.4.5")); + std::vector expected = {"1.2.3.4:53", "[0102:0304:0506:0708:0910:1112:1314:1516]:53", "2.3.4.5:53"}; diff --git a/srcpkgs/c-ares/template b/srcpkgs/c-ares/template index b0e998a08180b..78e001bfd14b0 100644 --- a/srcpkgs/c-ares/template +++ b/srcpkgs/c-ares/template @@ -1,7 +1,7 @@ # Template file for 'c-ares' pkgname=c-ares version=1.22.1 -revision=1 +revision=2 build_style=gnu-configure checkdepends="iana-etc" short_desc="Library for asynchronous DNS requests" @@ -9,7 +9,7 @@ maintainer="Duncaen " license="MIT" homepage="https://c-ares.haxx.se/" changelog="https://c-ares.haxx.se/changelog.html" -distfiles="https://c-ares.haxx.se/download/c-ares-${version}.tar.gz" +distfiles="https://c-ares.org/download/c-ares-${version}.tar.gz" checksum=f67c180deb799c670d9dda995a18ce06f6c7320b6c6363ff8fa85b77d0da9db8 make_check=ci-skip # segfaults only on CI From 13191af83741447a01096f96f3cab27aaef18c24 Mon Sep 17 00:00:00 2001 From: triallax Date: Sun, 30 Jul 2023 21:49:24 +0100 Subject: [PATCH 2/2] nodejs: update to 18.18.2, adopt. --- srcpkgs/nodejs/template | 47 +++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/srcpkgs/nodejs/template b/srcpkgs/nodejs/template index 2576dbdbbbe89..0db0fcffa1eca 100644 --- a/srcpkgs/nodejs/template +++ b/srcpkgs/nodejs/template @@ -1,35 +1,40 @@ # Template file for 'nodejs' pkgname=nodejs -version=18.16.0 -revision=3 -# Need these for host v8 for torque, see https://github.com/nodejs/node/pull/21079 -hostmakedepends="which pkg-config python3-setuptools zlib-devel - $(vopt_if icu icu-devel) $(vopt_if ssl openssl-devel) $(vopt_if libuv libuv-devel) - $(vopt_if nghttp2 nghttp2-devel) $(vopt_if cares c-ares-devel)" -makedepends="zlib-devel $(vopt_if icu icu-devel) +version=18.18.2 +revision=1 +hostmakedepends="which pkg-config python3-setuptools" +_make_depends="zlib-devel $(vopt_if icu icu-devel) $(vopt_if ssl openssl-devel) $(vopt_if libuv libuv-devel) - $(vopt_if nghttp2 nghttp2-devel) $(vopt_if cares c-ares-devel)" + $(vopt_if nghttp2 nghttp2-devel) $(vopt_if cares c-ares-devel) + $(vopt_if brotli brotli-devel)" +makedepends="${_make_depends}" checkdepends="procps-ng iana-etc" short_desc="Evented I/O for V8 javascript" -maintainer="Enno Boland " +maintainer="triallax " license="MIT" homepage="https://nodejs.org/" -distfiles="https://nodejs.org/dist/v${version}/node-v${version}.tar.gz" -checksum=6a4f5c5d76e5c50cef673099e56f19bc3266ae363f56ca0ab77dd2f3c5088c6d +distfiles="https://nodejs.org/dist/v${version}/node-v${version}.tar.xz" +checksum=7249e2f0af943ec38599504f4b2a2bd31fb938787291b6ccca6c8badf01e3b56 python_version=3 -build_options="ssl libuv icu nghttp2 cares" +build_options="ssl libuv icu nghttp2 cares brotli" desc_option_ssl="Enable shared openssl" desc_option_libuv="Enable shared libuv" desc_option_icu="Enable shared icu" desc_option_nghttp2="Enable shared nghttp2" desc_option_cares="Enable shared c-ares" -build_options_default="ssl libuv icu nghttp2 cares" +desc_option_brotli="Enable shared brotli" +build_options_default="ssl libuv icu nghttp2 cares brotli" replaces="iojs>=0" conflicts="nodejs-lts-10" provides="nodejs-runtime-0_1" +if [ "$CROSS_BUILD" ]; then + # Need these for host v8 for torque, see https://github.com/nodejs/node/pull/21079 + hostmakedepends+=" ${_make_depends}" +fi + # https://build.voidlinux.org/builders/i686_builder/builds/27325/steps/shell_3/logs/stdio if [ "$XBPS_WORDSIZE" = 32 ]; then LDFLAGS="-Wl,--no-keep-memory" @@ -71,12 +76,13 @@ do_configure() { # to execute it within the build system fails _args+=" --cross-compiling" fi - ./configure --prefix=/usr --shared-zlib \ + ./configure --prefix=/usr --shared-zlib --enable-lto \ $(vopt_if icu --with-intl=system-icu) \ $(vopt_if ssl --shared-openssl) \ $(vopt_if libuv --shared-libuv) \ $(vopt_if nghttp2 --shared-nghttp2) \ - $(vopt_if cares --shared-cares) ${_args} + $(vopt_if cares --shared-cares) \ + $(vopt_if brotli --shared-brotli) ${_args} } do_build() { @@ -88,7 +94,16 @@ do_build() { } do_check() { - local CI_SKIP_TESTS="test-cluster-primary-error.js,test-cluster-primary-kill.js,test-child-process-uid-gid.js,test-process-euid-egid.js,test-process-uid-gid.js,test-socket-write-after-fin-error.js,test-dns-perf_hooks.js" + local CI_SKIP_TESTS="test-child-process-uid-gid.js,test-process-euid-egid.js,test-process-uid-gid.js,test-tls-session-cache.js,test-tls-getprotocol.js,test-tls-alert.js,test-tls-cli-min-version-1.1.js,test-tls-cli-max-version-1.1.js,test-tls-cli-min-version-1.2.js,test-tls-cli-max-version-1.2.js,test-tls-cli-min-version-1.3.js,test-tls-cli-max-version-1.3.js,test-tls-min-max-version.js,test-process-versions.js,test-strace-openat-openssl.js,test-crypto-dh.js,test-dgram-send-cb-quelches-error.js,test-https-agent-session-eviction.js" + + # https://github.com/nodejs/node/issues/50741 + CI_SKIP_TESTS+=",test-dns-resolveany.js,test-dns-resolveany-bad-ancount.js" + + if [ "$XBPS_TARGET_MACHINE" = i686 ]; then + # https://github.com/nodejs/node/issues/45906 + CI_SKIP_TESTS+=",test-fs-utimes-y2K38.js" + fi + make CI_SKIP_TESTS="$CI_SKIP_TESTS" LD="$CXX" LDFLAGS+=-ldl ${makejobs} V=1 test-only }