Accepting request 1136239 from devel:languages:nodejs

- c-ares-fixes.patch: fixes unit tests for new c-ares

OBS-URL: https://build.opensuse.org/request/show/1136239
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/nodejs21?expand=0&rev=4
This commit is contained in:
Dominique Leuenberger 2024-01-04 14:56:50 +00:00 committed by Git OBS Bridge
commit 6c41f997fd
3 changed files with 61 additions and 0 deletions

46
c-ares-fixes.patch Normal file
View File

@ -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');

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jan 2 14:25:03 UTC 2024 - Adam Majer <adam.majer@suse.de>
- c-ares-fixes.patch: fixes unit tests for new c-ares
-------------------------------------------------------------------
Mon Dec 11 07:31:07 UTC 2023 - Adam Majer <adam.majer@suse.de>

View File

@ -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