From ec5470976f3a95ff3183835fcf6816d8ed2e87a57347f193f7576f85d5340a2d Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Tue, 2 Jan 2024 14:28:38 +0000 Subject: [PATCH] - c-ares-fixes.patch: fixes unit tests for new c-ares OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs21?expand=0&rev=12 --- c-ares-fixes.patch | 46 ++++++++++++++++++++++++++++++++++++++++++++++ nodejs21.changes | 5 +++++ nodejs21.spec | 10 ++++++++++ 3 files changed, 61 insertions(+) create mode 100644 c-ares-fixes.patch diff --git a/c-ares-fixes.patch b/c-ares-fixes.patch new file mode 100644 index 0000000..bccc1bd --- /dev/null +++ b/c-ares-fixes.patch @@ -0,0 +1,46 @@ +Index: node-v21.4.0/test/parallel/test-dns-resolveany-bad-ancount.js +=================================================================== +--- node-v21.4.0.orig/test/parallel/test-dns-resolveany-bad-ancount.js ++++ node-v21.4.0/test/parallel/test-dns-resolveany-bad-ancount.js +@@ -7,6 +7,8 @@ const dgram = require('dgram'); + const dnsPromises = dns.promises; + + const server = dgram.createSocket('udp4'); ++const resolver = new dns.Resolver({ timeout: 100, tries: 1 }); ++const resolverPromises = new dnsPromises.Resolver({ timeout: 100, tries: 1 }); + + server.on('message', common.mustCall((msg, { address, port }) => { + const parsed = dnstools.parseDNSPacket(msg); +@@ -18,16 +20,20 @@ server.on('message', common.mustCall((ms + questions: parsed.questions, + answers: { type: 'A', address: '1.2.3.4', ttl: 123, domain }, + }); +- // Overwrite the # of answers with 2, which is incorrect. ++ // Overwrite the # of answers with 2, which is incorrect. The response is ++ // discarded in c-ares >= 1.21.0. This is the reason why a small timeout is ++ // used in the `Resolver` constructor. See ++ // https://github.com/nodejs/node/pull/50743#issue-1994909204 + buf.writeUInt16LE(2, 6); + server.send(buf, port, address); + }, 2)); + + server.bind(0, common.mustCall(async () => { + const address = server.address(); +- dns.setServers([`127.0.0.1:${address.port}`]); ++ resolver.setServers([`127.0.0.1:${address.port}`]); ++ resolverPromises.setServers([`127.0.0.1:${address.port}`]); + +- dnsPromises.resolveAny('example.org') ++ resolverPromises.resolveAny('example.org') + .then(common.mustNotCall()) + .catch(common.expectsError({ + // May return EBADRESP or ETIMEOUT +@@ -36,7 +42,7 @@ server.bind(0, common.mustCall(async () + hostname: 'example.org' + })); + +- dns.resolveAny('example.org', common.mustCall((err) => { ++ resolver.resolveAny('example.org', common.mustCall((err) => { + assert.notStrictEqual(err.code, 'SUCCESS'); + assert.strictEqual(err.syscall, 'queryAny'); + assert.strictEqual(err.hostname, 'example.org'); diff --git a/nodejs21.changes b/nodejs21.changes index 6f7c45c..1a1f312 100644 --- a/nodejs21.changes +++ b/nodejs21.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jan 2 14:25:03 UTC 2024 - Adam Majer + +- c-ares-fixes.patch: fixes unit tests for new c-ares + ------------------------------------------------------------------- Mon Dec 11 07:31:07 UTC 2023 - Adam Majer diff --git a/nodejs21.spec b/nodejs21.spec index 1200ef4..07a3ebc 100644 --- a/nodejs21.spec +++ b/nodejs21.spec @@ -49,6 +49,11 @@ Release: 0 %bcond_with libalternatives %endif +# nodejs20+ is not for SLE12 +%if %{node_version_number} >= 20 && 0%{?suse_version} > 0 && 0%{?suse_version} < 1500 +ExclusiveArch do_not_build +%endif + %if %node_version_number >= 12 %define openssl_req_ver 1.1.1 %else @@ -172,6 +177,7 @@ Patch200: versioned.patch Patch305: qemu_timeouts_arches.patch Patch308: node-gyp-config.patch Patch309: gcc13.patch +Patch311: c-ares-fixes.patch BuildRequires: pkg-config BuildRequires: fdupes @@ -672,6 +678,7 @@ popd %if %{node_version_number} >= 19 %patch308 -p1 +%else %endif %endif @@ -686,7 +693,9 @@ popd %patch13 -p1 %patch100 -p1 %patch101 -p1 +%if 0%{?suse_version} >= 1500 || 0%{?suse_version} == 0 %patch102 -p1 +%endif # Add check_output to configure script (not part of Python 2.6 in SLE11). %if 0%{?suse_version} == 1110 %endif @@ -701,6 +710,7 @@ popd %patch305 -p1 %patch309 -p1 +%patch311 -p1 %if %{node_version_number} == 12 # minimist security update - patch50