From d885b90711efec256dc4256033f78c276fe671d8 Mon Sep 17 00:00:00 2001 From: Stuart D. Gathman Date: May 15 2019 22:53:53 +0000 Subject: Merge branch 'master' into el6 --- diff --git a/.gitignore b/.gitignore index 417de9d..cffa842 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /results_cjdns /*.src.rpm /.build-* +/cjdns-v20.3.tar.gz diff --git a/cjdns.fuzz.patch b/cjdns.fuzz.patch new file mode 100644 index 0000000..3faaed6 --- /dev/null +++ b/cjdns.fuzz.patch @@ -0,0 +1,21 @@ +diff -up ./test/Main_fuzz_test.c.fuzz ./test/Main_fuzz_test.c +--- ./test/Main_fuzz_test.c.fuzz 2019-05-08 19:31:34.995364838 -0400 ++++ ./test/Main_fuzz_test.c 2019-05-08 19:31:51.955608910 -0400 +@@ -59,8 +59,8 @@ static Iface_DEFUN incomingTun(struct Me + static void notLinkedYet(struct Context* ctx) + { + uint64_t now = Time_currentTimeMilliseconds(ctx->base); +- if ((now - ctx->startTime) > 5000) { +- Assert_failure("Failed to link in 5 seconds"); ++ if ((now - ctx->startTime) > 100000) { ++ Assert_failure("Failed to link in 100 seconds"); + } + } + +@@ -185,4 +185,4 @@ void CJDNS_FUZZ_MAIN(void* vctx, struct + TestFramework_assertLastMessageUnaltered(ctx->nodeA); + + EventBase_beginLoop(ctx->base); +-} +\ No newline at end of file ++} diff --git a/cjdns.genconf.patch b/cjdns.genconf.patch index b189db5..5129b68 100644 --- a/cjdns.genconf.patch +++ b/cjdns.genconf.patch @@ -1,7 +1,7 @@ diff -up ./client/cjdroute2.c.genconf ./client/cjdroute2.c ---- ./client/cjdroute2.c.genconf 2016-01-19 15:19:10.084151612 -0500 -+++ ./client/cjdroute2.c 2016-01-19 15:21:18.035546520 -0500 -@@ -323,7 +323,7 @@ static int genconf(struct Random* rand, +--- ./client/cjdroute2.c.genconf 2019-05-02 04:02:32.000000000 -0400 ++++ ./client/cjdroute2.c 2019-05-08 12:14:53.146838389 -0400 +@@ -336,7 +336,7 @@ static int genconf(struct Random* rand, " // and ETHInterface will be unable to hot-add new interfaces\n" " // Use { \"setuser\": 0 } to disable.\n" " // Default: enabled with keepNetAdmin\n" @@ -10,7 +10,7 @@ diff -up ./client/cjdroute2.c.genconf ./client/cjdroute2.c "\n" " // Chroot changes the filesystem root directory which cjdns sees, blocking it\n" " // from accessing files outside of the chroot sandbox, if the user does not\n" -@@ -335,7 +335,7 @@ static int genconf(struct Random* rand, +@@ -348,7 +348,7 @@ static int genconf(struct Random* rand, } else { printf(" // Default: enabled (using \"/var/run\")\n" @@ -19,3 +19,18 @@ diff -up ./client/cjdroute2.c.genconf ./client/cjdroute2.c } printf("\n" " // Nofiles is a deprecated security feature which prevents cjdns from opening\n" +@@ -695,11 +695,12 @@ int main(int argc, char** argv) + char corePipeName[64] = "client-core-"; + Random_base32(rand, (uint8_t*)corePipeName+CString_strlen(corePipeName), 31); + String* pipePath = Dict_getStringC(config, "pipe"); ++ String* path = String_CONST(Pipe_PATH); + if (!pipePath) { +- pipePath = String_CONST(Pipe_PATH); ++ pipePath = path; + } + if (!Defined(win32) && access(pipePath->bytes, W_OK)) { +- Except_throw(eh, "Can't have writable permission to pipe directory."); ++ Except_throw(eh, "Pipe directory not writable: [%s]",pipePath->bytes); + } + Assert_ifParanoid(EventBase_eventCount(eventBase) == 0); + struct Pipe* corePipe = Pipe_named(pipePath->bytes, corePipeName, eventBase, diff --git a/cjdns.libuv.patch b/cjdns.libuv.patch new file mode 100644 index 0000000..a29be39 --- /dev/null +++ b/cjdns.libuv.patch @@ -0,0 +1,126 @@ +diff -up ./dht/dhtcore/NodeStore.c.libuv ./dht/dhtcore/NodeStore.c +--- ./dht/dhtcore/NodeStore.c.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./dht/dhtcore/NodeStore.c 2019-04-24 23:37:26.625881889 -0400 +@@ -28,7 +28,7 @@ + #include "util/Endian.h" + #include "util/events/Time.h" + +-#include ++#include "dependencies/uv_tree.h" + + /** A list of DHT nodes. */ + struct NodeStore_pvt +diff -up ./node_build/make.js.libuv ./node_build/make.js +--- ./node_build/make.js.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./node_build/make.js 2019-04-24 23:37:26.690882782 -0400 +@@ -46,7 +46,7 @@ Builder.configure({ + crossCompiling: process.env['CROSS'] !== undefined, + gcc: GCC, + tempDir: process.env['CJDNS_BUILD_TMPDIR'] || '/tmp', +- optimizeLevel: '-O3', ++ optimizeLevel: '-O', + logLevel: process.env['Log_LEVEL'] || 'DEBUG' + }, function (builder, waitFor) { + +@@ -101,7 +101,7 @@ Builder.configure({ + + if (!builder.config.crossCompiling) { + if (NO_MARCH_FLAG.indexOf(process.arch) == -1) { +- builder.config.cflags.push('-march=native'); ++ builder.config.cflags.push('-mtune=generic'); + } + } + +@@ -287,7 +287,7 @@ Builder.configure({ + + if (!builder.config.crossCompiling) { + if (NO_MARCH_FLAG.indexOf(process.arch) == -1) { +- args.unshift('-march=native'); ++ args.unshift('-mtune=generic'); + } + } + +@@ -301,7 +301,7 @@ Builder.configure({ + + }).nThen(function (waitFor) { + +- builder.config.libs.push(libuvLib); ++ builder.config.libs.push('-luv'); + if (!android) { + builder.config.libs.push('-lpthread'); + } +@@ -328,15 +328,13 @@ Builder.configure({ + ); + } + +- builder.config.includeDirs.push(dependencyDir + '/libuv/include/'); ++ /* builder.config.includeDirs.push('/usr/include/uv/'); */ + + var libuvBuilt; + var python; + nThen(function (waitFor) { + +- Fs.exists(libuvLib, waitFor(function (exists) { +- if (exists) { libuvBuilt = true; } +- })); ++ libuvBuilt = true; + + }).nThen(function (waitFor) { + +diff -up ./test/Beacon_test.c.libuv ./test/Beacon_test.c +--- ./test/Beacon_test.c.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./test/Beacon_test.c 2019-04-24 23:44:04.535476759 -0400 +@@ -256,7 +256,8 @@ int main() + start(alloc, logger, base, rand, runTest); + + EventBase_beginLoop(base); +- Allocator_free(alloc); ++ EventBase_endLoop(base); ++ /* Allocator_free(alloc); */ + return 0; + } + #endif +diff -up ./util/events/libuv/FileNo.c.libuv ./util/events/libuv/FileNo.c +--- ./util/events/libuv/FileNo.c.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./util/events/libuv/FileNo.c 2019-04-24 23:37:26.626881902 -0400 +@@ -77,14 +77,14 @@ static void onClose(uv_handle_t* handle) + #endif + #define ALLOC(buff) (((struct Allocator**) &(buff[-(8 + (((uintptr_t)buff) % 8))]))[0]) + +-static void incoming(uv_pipe_t* stream, ++static void incoming(uv_stream_t* stream, + ssize_t nread, +- const uv_buf_t* buf, +- uv_handle_type pending) ++ const uv_buf_t* buf) + { + // Grab out the allocator which was placed there by allocate() + struct Allocator* alloc = buf->base ? ALLOC(buf->base) : NULL; + ++ uv_handle_type pending = uv_pipe_pending_type((uv_pipe_t*) stream); + Assert_true(pending == UV_UNKNOWN_HANDLE); + + if (nread < 0) { +@@ -134,8 +134,8 @@ static void connected(uv_connect_t* req, + fileno->pub.pipePath, uv_strerror(status) ); + uv_close((uv_handle_t*) &fileno->peer, onClose); + +- } else if ((ret = uv_read2_start((uv_stream_t*)&fileno->peer, allocate, incoming))) { +- Log_info(fileno->pub.logger, "uv_read2_start() failed for pipe [%s] [%s]", ++ } else if ((ret = uv_read_start((uv_stream_t*)&fileno->peer, allocate, incoming))) { ++ Log_info(fileno->pub.logger, "uv_read_start() failed for pipe [%s] [%s]", + fileno->pub.pipePath, uv_strerror(ret)); + uv_close((uv_handle_t*) &fileno->peer, onClose); + +diff -up ./util/events/libuv/Timeout.c.libuv ./util/events/libuv/Timeout.c +--- ./util/events/libuv/Timeout.c.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./util/events/libuv/Timeout.c 2019-04-24 23:37:26.626881902 -0400 +@@ -38,7 +38,7 @@ struct Timeout + /** + * The callback to be called by libuv. + */ +-static void handleEvent(uv_timer_t* handle, int status) ++static void handleEvent(uv_timer_t* handle) + { + struct Timeout* timeout = Identity_check((struct Timeout*) handle); + if (!timeout->isInterval) { diff --git a/cjdns.spec b/cjdns.spec index 0bba646..7249dab 100644 --- a/cjdns.spec +++ b/cjdns.spec @@ -15,7 +15,8 @@ # Option to disable SECCOMP: confusing backward logic # Needed to run on openvz and other container systems %bcond_without seccomp - +# Option to use system libuv instead of bundled libuv-0.11.19 +%bcond_with libuv %if %{with embedded} %global use_embedded 1 @@ -23,6 +24,12 @@ %global use_embedded 0 %endif +%if %{with libuv} +%global use_libuv 1 +%else +%global use_libuv 0 +%endif + %if %{with generic} %global generic_build 1 %else @@ -64,10 +71,9 @@ Name: cjdns # major version is cjdns protocol version: -Version: 20.2 -Release: 4%{?dist} +Version: 20.3 +Release: 3%{?dist} Summary: The privacy-friendly network without borders -Group: System Environment/Base # cjdns is all GPLv3 except libuv which is MIT and BSD and ISC # cnacl is unused except when use_embedded is true License: GPLv3 and MIT and BSD and ISC @@ -124,7 +130,11 @@ Patch12: cjdns.sign.patch # Specify python2 for systems that default to python3 Patch16: cjdns.python3.patch # s390x support for embedded cnacl library from Dan HorĂ¡k -Patch17: cjdns.s390x.patch +# Included upstream since 20.3 +#Patch17: cjdns.s390x.patch +# patch build to use system libuv +Patch18: cjdns.libuv.patch +Patch19: cjdns.fuzz.patch BuildRequires: nodejs, nodejs-ronn, python2 @@ -144,7 +154,11 @@ Requires(preun): systemd Requires(postun): systemd %endif Requires(pre): shadow-utils +%if 0%{use_libuv} +BuildRequires: libuv-devel +%else Provides: bundled(libuv) = 0.11.19 +%endif %if 0%{use_embedded} Provides: bundled(nacl) = 20110221 %endif @@ -159,7 +173,6 @@ scalability issues that plague existing networks. %package selinux Summary: Targeted SELinux policy module for cjdns -Group: System Environment/Base BuildRequires: policycoreutils, checkpolicy, selinux-policy-devel Requires: policycoreutils, selinux-policy-targeted Requires: %{name} = %{version}-%{release} @@ -171,7 +184,6 @@ Targeted SELinux policy module for cjdns. # FIXME: keep C tools separate? %package tools Summary: Nodejs tools for cjdns -Group: System Environment/Base Requires: nodejs, %{name} = %{version}-%{release} BuildArch: noarch @@ -188,7 +200,11 @@ sessionStats show current crypto sessions Provides: %{name}-python = %{version}-%{release} Obsoletes: %{name}-python < %{version}-%{release} Summary: Python tools for cjdns -Group: System Environment/Base +%if 0%{?fedora} >= 18 +BuildRequires: python2-rpm-macros +%else +BuildRequires: python-rpm-macros +%endif Requires: python2, %{name} = %{version}-%{release} BuildArch: noarch @@ -196,13 +212,18 @@ BuildArch: noarch Python tools for cjdns. %package graph -Summary: Python tools for cjdns -Group: System Environment/Base -Requires: python2-%{name} = %{version}-%{release}, python2-networkx +Summary: Python peer graph tools for cjdns +Requires: python2-%{name} = %{version}-%{release} +%if 0%{?rhel} == 6 || 0%{?rhel} == 7 +Requires: python-networkx +Requires: python2-matplotlib +%else +Requires: python2-networkx +%endif BuildArch: noarch %description graph -Python graphing tools for cjdns. +Python peer graph tools for cjdns. %prep %setup -qn cjdns-%{name}-v%{version} @@ -253,9 +274,13 @@ echo "int super_pedantic = 1;" >>crypto/Sign.c #patch14 -b .entropy #patch15 -b .benc %patch16 -b .python3 -%if 0%{use_embedded} -%patch17 -p1 -b .s390x +%if 0%{use_libuv} +%patch18 -p1 -b .libuv +mkdir dependencies +cp node_build/dependencies/libuv/include/tree.h dependencies/uv_tree.h +rm -rf node_build/dependencies/libuv %endif +%patch19 -p1 -b .fuzz cp %{SOURCE1} README_Fedora.md @@ -271,6 +296,12 @@ sed -e '$ s,^python ,/usr/bin/python2 ,' -i contrib/python/cjdnsa find tools -type f | xargs grep -l '^#!\/usr\/bin\/env ' | xargs sed -e '1 s,^#!/usr/bin/env ,#!/usr/bin/,' -i +# Fix deprecated Buffer ctor except on EL6 +%if 0%{?rhel} != 6 +sed -e '1,$ s/new Buffer/Buffer.from/' -i \ + tools/lib/publicToIp6.js tools/lib/cjdnsadmin/cjdnsadmin.js +%endif + # Remove unpackaged code with undeclared licenses %if %{with_admin} rm -rf contrib/nodejs # GPLv3 and ASL 2.0 @@ -292,7 +323,11 @@ EOF chmod a+x cjdns-up.sh %if %{generic_build} +%ifarch s390x +sed -i -e 's/-march=native/-mtune=native/' node_build/make.js +%else sed -i -e 's/-march=native/-mtune=generic/' node_build/make.js +%endif rm node_build/dependencies/cnacl/node_build/plans/*_AVX_plan.json # Leaving SSE2 code in since x86 is secondary arch and pretty much everyone # is going to have SSE2, except things like XO-1 which needs custom build. @@ -319,14 +354,15 @@ export SUBNODE=1 %if 0%{?rhel} && 0%{?rhel} <= 6 export MINVER="0.10.48" %endif -CJDNS_RELEASE_VERSION="%{name}-%{version}-%{release}" ./do +NO_TEST=1 CJDNS_RELEASE_VERSION="%{name}-%{version}-%{release}" ./do # FIXME: use system libuv on compatible systems -# bundled libuv is 0.11.4 with changes: +# bundled libuv is 0.11.19 with changes: # https://github.com/cjdelisle/cjdns/commits/master/node_build/dependencies/libuv %check # test suite is executed in %%build +build_linux/test_testcjdroute_c all >test.out %install %if 0%{?rhel} == 5 @@ -418,6 +454,10 @@ rm %{buildroot}%{_libexecdir}/cjdns/python/README.md rm %{buildroot}%{_libexecdir}/cjdns/python/cjdns-dynamic.conf rm %{buildroot}%{_libexecdir}/cjdns/python/cjdnsadmin/bencode.py.LICENSE.txt +# Move cjdnsadmin to site-packages +mkdir -p %{buildroot}%{python2_sitelib} +mv %{buildroot}%{_libexecdir}/cjdns/python/cjdnsadmin %{buildroot}%{python2_sitelib} + # symlink python tools w/o conflict with nodejs tools or needing networkx for t in pingAll.py trashroutes \ getLinks ip6topk pktoip6 cjdnsa searches findnodes; do @@ -538,6 +578,7 @@ fi %files -n python2-cjdns %doc contrib/python/README.md contrib/python/cjdns-dynamic.conf %license contrib/python/cjdnsadmin/bencode.py.LICENSE.txt +%{python2_sitelib}/cjdnsadmin %dir %{_libexecdir}/cjdns/python %{_libexecdir}/cjdns/python/cexec %{_libexecdir}/cjdns/python/cjdnsadminmaker.py* @@ -546,7 +587,6 @@ fi %{_libexecdir}/cjdns/python/dynamicEndpoints.py* %{_libexecdir}/cjdns/python/peerStats %{_libexecdir}/cjdns/python/sessionStats -%{_libexecdir}/cjdns/python/cjdnsadmin %{_libexecdir}/cjdns/python/pingAll.py* %{_libexecdir}/cjdns/python/trashroutes %{_libexecdir}/cjdns/python/getLinks @@ -573,6 +613,27 @@ fi %{_bindir}/graphStats %changelog +* Thu May 09 2019 Stuart Gathman - 20.3-3 +- Move running test suite to check + +* Wed May 08 2019 Stuart Gathman - 20.3-2 +- Increase timeout for fuzz tests to allow slower arches to succeed + +* Wed May 08 2019 Stuart Gathman - 20.3-1 +- New upstream version 20.3 + +* Fri May 03 2019 Stuart Gathman - 20.2-7 +- Option to use system libuv +- Fix scope of Pipe_PATH String_CONST in config. + +* Thu Jan 31 2019 Fedora Release Engineering - 20.2-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Nov 8 2018 Stuart Gathman - 20.2-5 +- Install cjdnsadmin python module in site-packages +- Work around missing python2-networkx Provides in python-networkx bz#1647987 +- Fix deprecated Buffer ctor in nodejs tools except on el6 + * Wed Jul 18 2018 Stuart Gathman - 20.2-4 - cjdns-20.2 bundles libuv-0.11.19 - disable CPU specific optimization diff --git a/cjdns.tools.patch b/cjdns.tools.patch index d789d2e..1c1dca8 100644 --- a/cjdns.tools.patch +++ b/cjdns.tools.patch @@ -1,6 +1,6 @@ diff -up ./tools/traceroute.tools ./tools/traceroute ---- ./tools/traceroute.tools 2016-03-13 21:23:01.529922250 -0400 -+++ ./tools/traceroute 2016-03-13 21:27:38.006631098 -0400 +--- ./tools/traceroute.tools 2019-05-02 04:02:32.000000000 -0400 ++++ ./tools/traceroute 2019-05-08 12:18:10.958661859 -0400 @@ -83,6 +83,11 @@ var main = function (target) { cjdns.RouterModule_getPeers("0000.0000.0000.0001", waitFor(function (err, ret) { @@ -13,7 +13,7 @@ diff -up ./tools/traceroute.tools ./tools/traceroute self = ret.peers[0]; })); -@@ -101,12 +106,13 @@ var main = function (target) { +@@ -101,11 +106,12 @@ var main = function (target) { }).nThen(function (waitFor) { @@ -23,8 +23,7 @@ diff -up ./tools/traceroute.tools ./tools/traceroute process.stdout.write(lastRet.from); tracePath(nodeToIP6(self), lastRet.from, cjdns, function (ret) { lastRet = ret; - process.stdout.write(' ' + ret.ms + 'ms\n'); + if (!ret || !ret.nodes) { return; } + process.stdout.write(' ' + ret.ms + 'ms\n'); if (ret.result === 'timeout') { process.stdout.write('\n' + ret.from + ' ' + ret.result + '!'); - } else if (ret.nodes.length === 0) { diff --git a/sources b/sources index 3248ec9..becd651 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (cjdns-v20.2.tar.gz) = 31edd3ff7e62bfe2ab555da1e34d4b900829180d9558eecdd93a3d726126067c8094419683f047abdcabc444e3b2ae933a68ca4fa1b535731f977e07983b7d39 +SHA512 (cjdns-v20.3.tar.gz) = ae38b33b47a567893e63bc925c91d07b5554f0c7147f90429cac41cfe35a429f507e3adc9463175a1714140169eaae370ab8c8255e82ddd9b2b32f09adae1cea