- sysctl.patch: unit test fixes

OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs18?expand=0&rev=49
This commit is contained in:
Adam Majer 2023-02-22 15:54:13 +00:00 committed by Git OBS Bridge
parent e78f88ce82
commit 1f9bdb1024
3 changed files with 23 additions and 0 deletions

View File

@ -18,6 +18,7 @@ Wed Feb 22 13:59:45 UTC 2023 - Adam Majer <adam.majer@suse.de>
(bsc#1208413, bsc#1208485, CVE-2023-24807, CVE-2023-23936)
- versioned.patch: refreshed
- sysctl.patch: unit test fixes
-------------------------------------------------------------------
Fri Feb 3 11:43:02 UTC 2023 - Adam Majer <adam.majer@suse.de>

View File

@ -172,6 +172,7 @@ Patch200: versioned.patch
Patch305: qemu_timeouts_arches.patch
Patch307: s390.patch
Patch309: sysctl.patch
BuildRequires: pkg-config
BuildRequires: fdupes
@ -378,6 +379,8 @@ Provides: bundled(llhttp) = 6.0.10
Provides: bundled(ngtcp2) = 0.8.1
Provides: bundled(base64) = 0.5.0
Provides: bundled(simdutf) = 3.1.0
# bundled url-ada parser, not ada
Provides: bundled(node-acorn) = 8.8.1
Provides: bundled(node-acorn-walk) = 8.2.0
@ -706,6 +709,7 @@ popd
%patch305 -p1
%patch307 -p1
%patch309 -p1
%if %{node_version_number} == 12
# minimist security update - patch50

18
sysctl.patch Normal file
View File

@ -0,0 +1,18 @@
Index: node-v19.5.0/test/parallel/test-cluster-bind-privileged-port.js
===================================================================
--- node-v19.5.0.orig/test/parallel/test-cluster-bind-privileged-port.js
+++ node-v19.5.0/test/parallel/test-cluster-bind-privileged-port.js
@@ -24,11 +24,10 @@ const common = require('../common');
const assert = require('assert');
const cluster = require('cluster');
const net = require('net');
-const { execSync } = require('child_process');
+const { readFileSync } = require('fs');
if (common.isLinux) {
- const sysctlOutput = execSync('sysctl net.ipv4.ip_unprivileged_port_start').toString();
- const unprivilegedPortStart = parseInt(sysctlOutput.split(' ')[2], 10);
+ const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
if (unprivilegedPortStart <= 42) {
common.skip('Port 42 is unprivileged');
}