From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id oHyjCHFk0V76UwAA0tVLHw (envelope-from ) for ; Fri, 29 May 2020 19:37:21 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0MVvBHFk0V66dAAAbx9fmQ (envelope-from ) for ; Fri, 29 May 2020 19:37:21 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C80E19403EC for ; Fri, 29 May 2020 19:37:19 +0000 (UTC) Received: from localhost ([::1]:46868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jekoe-0006Py-Qu for larch@yhetil.org; Fri, 29 May 2020 15:37:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jekoQ-0006Po-Em for guix-patches@gnu.org; Fri, 29 May 2020 15:37:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44717) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jekoQ-0005oc-5r for guix-patches@gnu.org; Fri, 29 May 2020 15:37:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jekoQ-00052v-22 for guix-patches@gnu.org; Fri, 29 May 2020 15:37:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41363] knot-resolver: Enable reloading of policy files (add lua-cqueues) References: <878shqtyaa.fsf@mercury.simonsouth.net> In-Reply-To: <878shqtyaa.fsf@mercury.simonsouth.net> Resent-From: Simon South Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 29 May 2020 19:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41363 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41363@debbugs.gnu.org Received: via spool by 41363-submit@debbugs.gnu.org id=B41363.159078097219327 (code B ref 41363); Fri, 29 May 2020 19:37:02 +0000 Received: (at 41363) by debbugs.gnu.org; 29 May 2020 19:36:12 +0000 Received: from localhost ([127.0.0.1]:56263 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeknb-00051f-Lr for submit@debbugs.gnu.org; Fri, 29 May 2020 15:36:12 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:32792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeknZ-00051T-LS for 41363@debbugs.gnu.org; Fri, 29 May 2020 15:36:10 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id D210521279 for <41363@debbugs.gnu.org>; Fri, 29 May 2020 19:36:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at emo06-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo06-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rwmsEwWwuLHX for <41363@debbugs.gnu.org>; Fri, 29 May 2020 19:36:02 +0000 (UTC) Received: from mercury.simonsouth.net (unknown [108.162.141.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 2F3AA22BE6 for <41363@debbugs.gnu.org>; Fri, 29 May 2020 19:36:01 +0000 (UTC) From: Simon South Date: Fri, 29 May 2020 15:36:01 -0400 Message-ID: <87v9keleji.fsf@mercury.simonsouth.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: Xrd2+EGSK415 --=-=-= Content-Type: text/plain I'm posting updated patches here as a work-in-progress, in case anyone else is interested. The patches are not yet ready to be applied. The package definitions are pretty much complete (I believe), however the regression tests for luajit-cqueues are failing for me on both aarch64 and x86_64. On aarch64, the test for issue #71 (only) fails with 71-empty-cqueue: ....... 71-empty-cqueue: testing issue 71A 71-empty-cqueue: 71A OK 71-empty-cqueue: testing 71B 71-empty-cqueue: setting alert on inner loop 71-empty-cqueue: stepping inner loop 71-empty-cqueue: polling inner loop 71-empty-cqueue: stepping inner loop 71-empty-cqueue: timeout before inner loop test completed This test, along with the rest of the suite, passes fine if the stock Lua 5.1 interpreter is used instead, which suggests a possible regression in LuaJIT. (Building LuaJIT from the latest revision in its source repository leads to the same error.) On x86_64, that test passes but a different one fails: 141-segfault-on-accept: OK PANIC: unprotected error in call to Lua API (attempt to call a thread value) I've written to the authors of cqueues regarding the first issue but have not received a response. I may try following up with LuaJIT's author as a next step; a bit of analysis might reveal why these tests are failing but my interest here is in getting a DNS server up and running, not in learning Lua or diving into the internals of a compiler. Perhaps someone more familiar with these libraries, language and tools could help? -- Simon South ssouth@simonsouth.net --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-gnu-Add-luajit-ossl.patch Content-Transfer-Encoding: quoted-printable >From d648ce07cd4828b4f2a848464a31efd76f00cb7c Mon Sep 17 00:00:00 2001 From: Simon South Date: Fri, 15 May 2020 11:18:44 -0400 Subject: [PATCH 1/3] gnu: Add luajit-ossl. * gnu/packages/lua.scm (make-lua-ossl): New function. (luajit-ossl): New variable. --- gnu/packages/lua.scm | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index 181ce76559..ab86e24bb9 100644 --- a/gnu/packages/lua.scm +++ b/gnu/packages/lua.scm @@ -11,6 +11,7 @@ ;;; Copyright =C2=A9 2018, 2019 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2018 Fis Trivial ;;; Copyright =C2=A9 2020 Nicolas Goaziou +;;; Copyright =C2=A9 2020 Simon South ;;; ;;; This file is part of GNU Guix. ;;; @@ -38,6 +39,7 @@ #:use-module (guix build-system trivial) #:use-module (gnu packages) #:use-module (gnu packages readline) + #:use-module (gnu packages m4) #:use-module (gnu packages tls) #:use-module (gnu packages xml) #:use-module (gnu packages glib) @@ -292,6 +294,86 @@ directory structure and file attributes.") (define-public lua5.2-filesystem (make-lua-filesystem "lua5.2-filesystem" lua-5.2)) =20 +(define (make-lua-ossl name lua) + (package + (name name) + (version "20190731") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/wahern/luaossl.git") + (commit (string-append "rel-" version)))) + (sha256 + (base32 + "03xmhy90qrby8pbwqdwy2xa7bk5jbpfzzrmpj83klzw7zkyf2k96")))) + (build-system gnu-build-system) + (arguments + `(#:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 popen) + (ice-9 rdelim)) + #:make-flags + (let ((out (assoc-ref %outputs "out")) + (lua-api-version ,(if (eq? lua luajit) + "5.1" + (version-major+minor + (package-version lua))))) + (list "CC=3Dgcc" + "CFLAGS=3D'-D HAVE_SYS_SYSCTL_H=3D0'" ; sys/sysctl.h is dep= recated + (string-append "DESTDIR=3D" out) + (string-append "LUA_APIS=3D" lua-api-version) + "prefix=3D")) + #:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'check) + (add-after 'install 'check + (lambda* (#:key outputs #:allow-other-keys) + (let* ((lua-api-version ,(if (eq? lua luajit) + "5.1" + (version-major+minor + (package-version lua)))) + (lua-cpath (lambda (p) + (string-append p "/lib/lua/" lua-api-vers= ion + "/?.so"))) + (lua-path (lambda (p) + (string-append p "/share/lua/" lua-api-ver= sion + "/?.lua"))) + (lua-interp (begin + (setenv "CC" "gcc") + (read-line + (open-pipe* OPEN_READ "mk/luapath" "lua= ")))) + (out (assoc-ref outputs "out"))) + (setenv "LUA_CPATH" (string-append (lua-cpath out) ";;")) + (setenv "LUA_PATH" (string-append (lua-path out) ";;")) + + (with-directory-excursion "regress" + (for-each (lambda (f) + (invoke lua-interp f)) + (filter + ;; Omit a test that requires lua-cqueues, as t= hat + ;; requires this package also + (lambda (f) + (not (equal? f "./148-custom-extensions.lua"= ))) + (find-files "." "^[0-9].*\\.lua$"))))) + #t))))) + (inputs + `(("lua" ,lua) + ;; TODO: Support interpreters other than LuaJIT using luaffifb or a + ;; similar FFI-compatibility module + ("openssl" ,openssl))) + (home-page "https://25thandclement.com/~william/projects/luaossl.html") + (synopsis "OpenSSL bindings for Lua") + (description "The luaossl extension module for Lua provides comprehens= ive, +low-level bindings to the OpenSSL library, including support for certifica= te and +key management, key generation, signature verification, and deep bindings = to the +distinguished name, alternative name, and X.509v3 extension interfaces. I= t also +binds OpenSSL's bignum, message digest, HMAC, cipher, and CSPRNG interface= s.") + (license license:expat))) + +(define-public luajit-ossl + (make-lua-ossl "luajit-ossl" luajit)) + (define (make-lua-sec name lua) (package (name name) --=20 2.26.2 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-gnu-Add-lua-cqueues.patch >From 0cf2c3b798071048d70c39d9f6697e8137e24251 Mon Sep 17 00:00:00 2001 From: Simon South Date: Fri, 15 May 2020 18:18:51 -0400 Subject: [PATCH 2/3] gnu: Add lua-cqueues. * gnu/packages/lua.scm (make-lua-cqueues): New function. (luajit-cqueues): New variable. --- gnu/packages/lua.scm | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index ab86e24bb9..dd14f7dd43 100644 --- a/gnu/packages/lua.scm +++ b/gnu/packages/lua.scm @@ -422,6 +422,112 @@ secure session between the peers.") (define-public lua5.2-sec (make-lua-sec "lua5.2-sec" lua-5.2)) +(define (make-lua-cqueues name lua lua-ossl) + (package + (name name) + (version "20190813") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/wahern/cqueues.git") + (commit (string-append "rel-" version)))) + (sha256 + (base32 + "0yin39cldhc1l6rr33nj2z8la6rvv0c70g47rkvjb7s0wy760ggz")))) + (build-system gnu-build-system) + (arguments + `(#:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 string-fun)) + #:make-flags + (let ((lua-api-version ,(if (eq? lua luajit) + "5.1" + (version-major+minor (package-version lua))))) + (list "CC=gcc" + (string-append "LUA_APIS=" lua-api-version))) + #:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'check) + (replace 'install + (lambda* (#:key make-flags outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (apply invoke "make" "install" + (append make-flags + (list (string-append "DESTDIR=" out) + "prefix=")))))) + (add-after 'install 'check + (lambda* (#:key inputs make-flags outputs #:allow-other-keys) + (let* ((lua-api-version ,(if (eq? lua luajit) + "5.1" + (version-major+minor + (package-version lua)))) + (lua-cpath (lambda (p) + (string-append p "/lib/lua/" lua-api-version + "/?.so"))) + (lua-path (lambda (p) + (string-append p "/share/lua/" lua-api-version + "/?.lua"))) + (env-suffix (if (equal? lua-api-version "5.1") + "" + (string-append + "_" + (string-replace-substring lua-api-version + "." "_")))) + (lua-ossl (assoc-ref inputs "lua-ossl")) + (out (assoc-ref outputs "out"))) + ;; The test suite sets Lua-version-specific search-path variables + ;; when available so we must do the same, as these take + ;; precedence over the generic "LUA_CPATH" and "LUA_PATH" + (setenv (string-append "LUA_CPATH" env-suffix) + (string-append + (string-join (map lua-cpath (list out lua-ossl)) ";") + ";;")) + (setenv (string-append "LUA_PATH" env-suffix) + (string-append + (string-join (map lua-path (list out lua-ossl)) ";") + ";;")) + + ;; Skip regression tests we expect to fail + (with-directory-excursion "regress" + (for-each (lambda (f) + (rename-file f (string-append f ".skip"))) + (append + ;; Tests that require network connectivity + '("22-client-dtls.lua" + "30-starttls-completion.lua" + "62-noname.lua" + "153-dns-resolvers.lua") + + ;; Tests that require LuaJIT + (if ,(not (eq? lua luajit)) + '("44-resolvers-gc.lua" + "51-join-defunct-thread.lua") + '()) + + ;; Tests that require Lua 5.3 + (if (not (equal? lua-api-version "5.3")) + '("152-thread-integer-passing.lua") + '())))) + + (apply invoke "make" "check" make-flags))))))) + (native-inputs + `(("m4" ,m4))) + (inputs + `(("lua" ,lua) + ("openssl" ,openssl))) + (propagated-inputs + `(("lua-ossl" ,lua-ossl))) + (home-page "https://25thandclement.com/~william/projects/cqueues.html") + (synopsis "Event loop for Lua using continuation queues") + (description "The cqueues extension module for Lua implements an event loop +that operates through the yielding and resumption of coroutines. It is designed +to be non-intrusive, composable, and embeddable within existing applications.") + (license license:expat))) + +(define-public luajit-cqueues + (make-lua-cqueues "luajit-cqueues" luajit luajit-ossl)) + (define-public lua-penlight (package (name "lua-penlight") -- 2.26.2 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-gnu-knot-resolver-Enable-automatic-reloading-of-poli.patch >From c8b4d696c96a3dc81e84aa05a24220cbadf90809 Mon Sep 17 00:00:00 2001 From: Simon South Date: Sat, 16 May 2020 14:35:27 -0400 Subject: [PATCH 3/3] gnu: knot-resolver: Enable automatic reloading of policy files. * gnu/packages/dns.scm (knot-resolver)[inputs]: Add lua5.1-cqueues. --- gnu/packages/dns.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm index 7ff0501ab2..dea24cf7c9 100644 --- a/gnu/packages/dns.scm +++ b/gnu/packages/dns.scm @@ -723,8 +723,9 @@ synthesis, and on-the-fly re-configuration.") ("libuv" ,libuv) ("lmdb" ,lmdb) ("luajit" ,luajit) - ;; TODO: Add optional lua modules: basexx, cqueues and psl. + ;; TODO: Add optional lua modules: basexx and psl. ("lua-bitop" ,lua5.1-bitop) + ("lua-cqueues" ,lua5.1-cqueues) ("lua-filesystem" ,lua5.1-filesystem) ("lua-sec" ,lua5.1-sec) ("lua-socket" ,lua5.1-socket))) -- 2.26.2 --=-=-=--