From unknown Fri Jun 20 07:16:05 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#40267 <40267@debbugs.gnu.org> To: bug#40267 <40267@debbugs.gnu.org> Subject: Status: [PATCH 1/2] gnu: Add unicorn. Reply-To: bug#40267 <40267@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:16:05 +0000 retitle 40267 [PATCH 1/2] gnu: Add unicorn. reassign 40267 guix-patches submitter 40267 Jakub K=C4=85dzio=C5=82ka severity 40267 normal tag 40267 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 27 20:51:01 2020 Received: (at submit) by debbugs.gnu.org; 28 Mar 2020 00:51:02 +0000 Received: from localhost ([127.0.0.1]:33541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHzgj-0001Vx-CJ for submit@debbugs.gnu.org; Fri, 27 Mar 2020 20:51:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:49177) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHzgh-0001Vm-80 for submit@debbugs.gnu.org; Fri, 27 Mar 2020 20:50:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42540) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHzgf-0006YU-En for guix-patches@gnu.org; Fri, 27 Mar 2020 20:50:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHzgd-00074A-Mf for guix-patches@gnu.org; Fri, 27 Mar 2020 20:50:57 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:34348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jHzgd-000734-Dt for guix-patches@gnu.org; Fri, 27 Mar 2020 20:50:55 -0400 Received: (qmail 11701 invoked by uid 1009); 28 Mar 2020 01:50:53 +0100 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25763. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.027054 secs); 28 Mar 2020 00:50:53 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 28 Mar 2020 01:50:53 +0100 From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= To: guix-patches@gnu.org Subject: [PATCH 1/2] gnu: Add unicorn. Date: Sat, 28 Mar 2020 01:50:52 +0100 Message-Id: <20200328005052.22846-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Qmailux-2.08st: added fake Content-Type header Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 37.59.186.212 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/packages/emulators.scm (unicorn-next): New variable. --- If I package a -rc version, should it have a -next suffix in its name even though the "stable" version isn't packaged? Maybe I should also package the non-rc unicorn? The test suite for that version fails to compile, so it's not entirely trivial. I'd also like to bring these build phases to your attention - I feel like they need a review the most. gnu/packages/emulators.scm | 110 ++++++++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm index 3591b1740c..5b5e1359e3 100644 --- a/gnu/packages/emulators.scm +++ b/gnu/packages/emulators.scm @@ -44,6 +44,7 @@ #:use-module (gnu packages boost) #:use-module (gnu packages backup) #:use-module (gnu packages cdrom) + #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages curl) #:use-module (gnu packages elf) @@ -88,7 +89,8 @@ #:use-module (gnu packages web) #:use-module (guix build-system cmake) #:use-module (guix build-system glib-or-gtk) - #:use-module (guix build-system gnu)) + #:use-module (guix build-system gnu) + #:use-module (guix build-system python)) (define-public desmume (package @@ -1628,3 +1630,109 @@ derived from Gens. Project goals include clean source code, combined features from various forks of Gens, and improved platform portability.") (supported-systems '("i686-linux" "x86_64-linux")) (license license:gpl2+))) + +;; python-pwntools requires a -rc release of unicorn +(define-public unicorn-next + (package + (name "unicorn-next") + (version "1.0.2-rc2") + ;; NOTE: unicorn ships a bundled QEMU, but with custom modifications. + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/unicorn-engine/unicorn") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0v5sc8sniv2w0bki1f7n3pgsk17y7hggw55fvkjzk2sv8z8w4bsj")))) + (outputs '("out" "python")) + ;; The main library is not written in Python, but the build process has + ;; little in common with any defined build system, so we might as well + ;; build on top of python-build-system and make use of all + ;; the Python-specific phases that can be reused. + (build-system python-build-system) + (arguments + `(#:modules ((srfi srfi-26) + (guix build python-build-system) + (guix build utils)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'install-bindings-to-python-output + (lambda* (#:key outputs #:allow-other-keys) + ;; python-build-system will build the bindings and install them to + ;; the "out" output, so change the build-internal names of the + ;; outputs. + (set-car! (assoc "out" outputs) "lib") + (set-car! (assoc "python" outputs) "out") + #t)) + (add-before 'build 'build-library + (lambda* (#:key inputs #:allow-other-keys) + (invoke "make" + "-j" (number->string (parallel-job-count)) + (string-append + "UNICORN_QEMU_FLAGS=--python=" + (assoc-ref inputs "python-for-qemu") + "/bin/python2") + "UNICORN_STATIC=no" + "CC=gcc"))) + (add-after 'build-library 'install-library + (lambda* (#:key outputs #:allow-other-keys) + (invoke "make" "install" + "UNICORN_STATIC=no" + (string-append + "PREFIX=" + (assoc-ref outputs "lib"))))) + (add-before 'build 'prepare-bindings + (lambda* (#:key outputs #:allow-other-keys) + (chdir "bindings/python") + ;; Set this environment variable so that the Python bindings + ;; don't build their own copy of the shared object, but use + ;; a dummy value such that the bindings test suite uses the + ;; same mechanism for loading the library as any other user. + (setenv "LIBUNICORN_PATH" "1") + (substitute* "unicorn/unicorn.py" + (("_path_list = \\[.*") + (string-append + "_path_list = [\"" + (assoc-ref outputs "lib") + ;; eat the rest of the list + "/lib\"] + 0*["))) + #t)) + (add-before 'check 'check-library + (lambda* (#:key outputs #:allow-other-keys) + ;; TODO: running the tests on non-x86 requires a cross-binutils + ;; with x86 as target. + ,@(if (member (%current-system) '("x86_64-linux" "i686-linux")) + '((for-each + (lambda (suite) + (with-directory-excursion + (string-append "../../tests/" suite) + (invoke "make" "test" "CC=gcc"))) + '("unit" "regress"))) + '()) + #t)) + (add-after 'install 'install-samples + (lambda* (#:key outputs #:allow-other-keys) + (let* ((python-samples (find-files "." "sample_.*")) + (c-samples (find-files "../../samples" ".*\\.c")) + (python-docdir + (string-append (assoc-ref outputs "out") + "/share/doc/unicorn/samples")) + (c-docdir + (string-append (assoc-ref outputs "lib") + "/share/doc/unicorn/samples"))) + (for-each (cut install-file <> c-docdir) c-samples) + (for-each (cut install-file <> python-docdir) python-samples) + #t)))))) + (native-inputs + `(("cmocka" ,cmocka) + ("python-for-qemu" ,python-2) + ("hexdump-for-tests" ,util-linux))) + (home-page "http://www.unicorn-engine.org") + (synopsis "Unicorn CPU emulator framework") + (description + "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator +framework based on QEMU.") + (license license:gpl2+))) -- 2.26.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 27 20:53:50 2020 Received: (at 40267) by debbugs.gnu.org; 28 Mar 2020 00:53:50 +0000 Received: from localhost ([127.0.0.1]:33546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHzjS-0001bJ-1w for submit@debbugs.gnu.org; Fri, 27 Mar 2020 20:53:50 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:47442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHzjQ-0001bB-Az for 40267@debbugs.gnu.org; Fri, 27 Mar 2020 20:53:48 -0400 Received: (qmail 12181 invoked by uid 1009); 28 Mar 2020 01:53:46 +0100 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25763. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.019527 secs); 28 Mar 2020 00:53:46 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 28 Mar 2020 01:53:46 +0100 From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= To: 40267@debbugs.gnu.org Subject: [PATCH 2/2] gnu: Add python-pwntools. Date: Sat, 28 Mar 2020 01:53:45 +0100 Message-Id: <20200328005345.24506-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Qmailux-2.08st: added fake Content-Type header Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40267 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/packages/cybersecurity.scm (python-pwntools): New variable. --- This patch requires #40265. gnu/packages/cybersecurity.scm | 51 +++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/gnu/packages/cybersecurity.scm b/gnu/packages/cybersecurity.scm index aedac03b8a..cb9c33bae1 100644 --- a/gnu/packages/cybersecurity.scm +++ b/gnu/packages/cybersecurity.scm @@ -18,10 +18,17 @@ (define-module (gnu packages cybersecurity) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (guix packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system python) - #:use-module (gnu packages engineering)) + #:use-module (gnu packages bioinformatics) + #:use-module (gnu packages emulators) + #:use-module (gnu packages engineering) + #:use-module (gnu packages python-crypto) + #:use-module (gnu packages python-web) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages time)) (define-public ropgadget (package @@ -44,3 +51,45 @@ gadgets in binaries. Some facilities are included for automatically generating chains of gadgets to execute system calls.") (license license:bsd-3))) + +(define-public python-pwntools + (package + (name "python-pwntools") + (version "4.0.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Gallopsled/pwntools") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "14grsflkfpr7y3gg2lm86lfn6n40yip45n4gjz0hzi9sjalq1gr5")))) + (build-system python-build-system) + (arguments + `(#:tests? #f)) ; Tests require networking and custom sshd configuration + (propagated-inputs + `(("paramiko" ,python-paramiko) + ("mako" ,python-mako) + ("pyelftools" ,python-pyelftools) + ("capstone" ,python-capstone) + ("ropgadget" ,ropgadget) + ("pyserial" ,python-pyserial) + ("requests" ,python-requests) + ("pygments" ,python-pygments) + ("pysocks" ,python-pysocks) + ("dateutil" ,python-dateutil) + ("packaging" ,python-packaging) + ("psutil" ,python-psutil) + ("intervaltree" ,python-intervaltree) + ("sortedcontainers" ,python-sortedcontainers) + ("unicorn" ,unicorn-next "python"))) + (native-inputs + `(("tox" ,python-tox))) + (home-page "https://github.com/Gallopsled/pwntools") + (synopsis "CTF framework and exploit development library") + (description "Pwntools is a CTF framework and exploit development library. +Written in Python, it is designed for rapid prototyping and development, and +intended to make exploit writing as simple as possible.") + (license (list license:expat license:bsd-2 license:gpl2+)))) -- 2.26.0 From leo@famulari.name Sat Mar 28 22:56:44 2020 Received: (at 40267) by debbugs.gnu.org; 30 Mar 2020 02:35:35 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:50297) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIO7w-0008Tg-1P for 40267@debbugs.gnu.org; Sat, 28 Mar 2020 22:56:44 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id D33295C9; Sat, 28 Mar 2020 22:56:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 28 Mar 2020 22:56:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=famulari.name; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=mesmtp; bh=L36G7hHr0x08EjiTmFYpDDuJQaq1TzEQa7Pc0bSfaTQ=; b=ZSvlMRGp8ye0 c3JJg/UIDekS2BN7cV3xAo5AJUu76eTFZZTLEKB5szxdLq3mqax6xMJFsipISOlU VdmqdPB0wDft370b7SDw9V/N283BtaYC5jiVivFyAg9/wv/sdok5v8A5OGrIZ48d lDzOLXjnLwD+7Wn3jtUvVC/AImae3TE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=L36G7hHr0x08EjiTmFYpDDuJQaq1TzEQa7Pc0bSfa TQ=; b=wEQcYn/GQADesEWQ054NjrTWGm+kR0CIwsihS224pax3uep+AyAj7ULu/ keFFYOT/Qx7AdBtGnmtDPpdnwSaszHdmJA+2+6eavjvECzmU2dyEa/2+zbYHQsgV ZOoltEeBufWnLrAHCAhF7g8Y7pxmjyQpHpgRd9nGIUjnJ5P64Y45izyY5jwwxFFE Z/Bk/op2I25ZPkNJrC2iTIaahCiUwHflGFX7u/n0NyWuX9cZFJJjewDsxE9iugxD 2Qbxb6a1EOS8OeiDHAISbme7tk9QIlfT+KEXrv5iQ3lIK222YnCg3LAoXMm7BSPi juLzZRDkseyX2gD/xTHlGNhquqNyg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudeivddgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggugfgjsehtke ertddttdejnecuhfhrohhmpefnvghoucfhrghmuhhlrghrihcuoehlvghosehfrghmuhhl rghrihdrnhgrmhgvqeenucfkphepjeeirdduvdegrddufeekrdeifeenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlvghosehfrghmuhhlrghr ihdrnhgrmhgv X-ME-Proxy: Received: from localhost (c-76-124-138-63.hsd1.pa.comcast.net [76.124.138.63]) by mail.messagingengine.com (Postfix) with ESMTPA id CA14E306C7A7; Sat, 28 Mar 2020 22:56:36 -0400 (EDT) Date: Sat, 28 Mar 2020 22:56:15 -0400 From: Leo Famulari To: Jakub =?utf-8?B?S8SFZHppb8WCa2E=?= Cc: 40267@debbugs.gnu.org Subject: Re: [bug#40267] [PATCH 2/2] gnu: Add python-pwntools. Message-ID: <20200329025615.GA16918@jasmine.lan> References: <20200328005052.22846-1-kuba@kadziolka.net> <20200328005345.24506-1-kuba@kadziolka.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200328005345.24506-1-kuba@kadziolka.net> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40267 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Mar 2020 02:56:44 -0000 On Sat, Mar 28, 2020 at 01:53:45AM +0100, Jakub Kądziołka wrote: > * gnu/packages/cybersecurity.scm (python-pwntools): New variable. > + (propagated-inputs It would be nice to sort these, especially if the package might grow new dependencies later. > + (license (list license:expat license:bsd-2 license:gpl2+)))) I looked it up; the package is overall MIT/Expat licensed, but a few components use other licenses. It helpful to list the files with the other licenses, or to say where to look up the info with a comment like "See LICENSE-pwntools.txt in the source distribution." From leo@famulari.name Sat Mar 28 23:48:21 2020 Received: (at 40267) by debbugs.gnu.org; 30 Mar 2020 02:35:35 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:37107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIOvs-0001Qh-Sd for 40267@debbugs.gnu.org; Sat, 28 Mar 2020 23:48:21 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 93D0A5E7; Sat, 28 Mar 2020 23:48:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 28 Mar 2020 23:48:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=famulari.name; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=mesmtp; bh=b//v4HhoTz5ydRpfTR+M2Tbm/R3gs6EF1h48TEBnM3M=; b=pt+QfEl7DI5n hw9lJVw/toaN2jsRcOXhgjxKgEx1OZWEu5Vs0mxzBPRt52ul50V6YRB1+St7Q//K AMTcy9S08X4XeSaLviXEyCpdNHmiS0l8A/6681WCRU0sSyx+e7mOfJfPDdkkibN6 vXtH8wsyTtvz/IOigMfngL8AwNbAcig= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=b//v4HhoTz5ydRpfTR+M2Tbm/R3gs6EF1h48TEBnM 3M=; b=Ptv9BL1yEZUocck0bqXiw8u7NXnjUm9WL9aa3zjnzbYHDAObiAqXW97YO DomykMxVG8pBZLZZu3iy+KubvPWgTrM9SxSXjW+u+2UbEAnqZadw0+rwQuRaqD5c H5GVxdOKGat1fLzVNiJLbKmw6H7XH8D3X1d2blpeb+9YbCeAnxChR2V26+vITldc 47lJ1Wqodt2hRFxFHIwiopooc9zIXn70RhpU9HZYeyuJydhz08uAQAkAm50nIwNv 8AtiAqZKAgPS3yrMVrVr1NBUp0GpgJ6xpqcHYcnx5rO4RTeDVvFWvpq4q+FeQuh8 6uD2gqKro/BSh4cvLBq55i1bZAY1w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudeivddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggugfgjsehtke ertddttdejnecuhfhrohhmpefnvghoucfhrghmuhhlrghrihcuoehlvghosehfrghmuhhl rghrihdrnhgrmhgvqeenucfkphepjeeirdduvdegrddufeekrdeifeenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlvghosehfrghmuhhlrghr ihdrnhgrmhgv X-ME-Proxy: Received: from localhost (c-76-124-138-63.hsd1.pa.comcast.net [76.124.138.63]) by mail.messagingengine.com (Postfix) with ESMTPA id 7A29C3280059; Sat, 28 Mar 2020 23:48:13 -0400 (EDT) Date: Sat, 28 Mar 2020 23:48:11 -0400 From: Leo Famulari To: Jakub =?utf-8?B?S8SFZHppb8WCa2E=?= Cc: 40267@debbugs.gnu.org Subject: Re: [bug#40267] [PATCH 1/2] gnu: Add unicorn. Message-ID: <20200329034811.GB16918@jasmine.lan> References: <20200328005052.22846-1-kuba@kadziolka.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200328005052.22846-1-kuba@kadziolka.net> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40267 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Mar 2020 03:48:21 -0000 On Sat, Mar 28, 2020 at 01:50:52AM +0100, Jakub Kądziołka wrote: > * gnu/packages/emulators.scm (unicorn-next): New variable. Sounds like a cool package! > If I package a -rc version, should it have a -next suffix in its name > even though the "stable" version isn't packaged? I think it's best to just call it unicorn. The version says -rc and we mention it in the synopsis and description. And it's useful under the hood for guix lint to match the upstream name. > Maybe I should also package the non-rc unicorn? The test suite for that > version fails to compile, so it's not entirely trivial. Is the previous release useful? We normally don't package betas or release candidates... it depends. Do you have an idea of the release timeline? Do you think upstream would mind if we packaged the RC? > + ;; NOTE: unicorn ships a bundled QEMU, but with custom modifications. Can you add more detail to this comment? Is it just a patch on a QEMU tarball or is this not really QEMU anymore? > + ;; The main library is not written in Python, but the build process has > + ;; little in common with any defined build system, so we might as well > + ;; build on top of python-build-system and make use of all > + ;; the Python-specific phases that can be reused. Okay > + (add-after 'unpack 'install-bindings-to-python-output > + (lambda* (#:key outputs #:allow-other-keys) > + ;; python-build-system will build the bindings and install them to > + ;; the "out" output, so change the build-internal names of the > + ;; outputs. > + (set-car! (assoc "out" outputs) "lib") > + (set-car! (assoc "python" outputs) "out") > + #t)) I would wait for advice here. The manual requests we write everything in a functional style. But I don't know of another way to make python-build-system install things to alternate outputs without changing the build system or replacing the install phase. It would be nice to have a parameter for this somewhere... > + (add-before 'check 'check-library > + (lambda* (#:key outputs #:allow-other-keys) > + ;; TODO: running the tests on non-x86 requires a cross-binutils > + ;; with x86 as target. > + ,@(if (member (%current-system) '("x86_64-linux" "i686-linux")) I think the 'when' procedure is more clear than 'if' in cases where the else branch is empty. From kuba@kadziolka.net Sun Mar 29 08:43:56 2020 Received: (at 40267) by debbugs.gnu.org; 30 Mar 2020 02:35:37 +0000 Received: from pat.zlotemysli.pl ([37.59.186.212]:51142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIXIB-0000JZ-0z for 40267@debbugs.gnu.org; Sun, 29 Mar 2020 08:43:56 -0400 Received: (qmail 537 invoked by uid 1009); 29 Mar 2020 14:43:53 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25765. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.030789 secs); 29 Mar 2020 12:43:53 -0000 Received: from unknown (HELO gravity) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with SMTP; 29 Mar 2020 14:43:52 +0200 Date: Sun, 29 Mar 2020 14:43:51 +0200 From: Jakub =?utf-8?B?S8SFZHppb8WCa2E=?= To: Leo Famulari Cc: 40267@debbugs.gnu.org Subject: Re: [bug#40267] [PATCH 1/2] gnu: Add unicorn. Message-ID: <20200329124351.dckxah33q6ajb6z2@gravity> References: <20200328005052.22846-1-kuba@kadziolka.net> <20200329034811.GB16918@jasmine.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vzywwqkch572k4rq" Content-Disposition: inline In-Reply-To: <20200329034811.GB16918@jasmine.lan> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40267 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Mar 2020 12:43:56 -0000 --vzywwqkch572k4rq Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 28, 2020 at 11:48:11PM -0400, Leo Famulari wrote: > On Sat, Mar 28, 2020 at 01:50:52AM +0100, Jakub K=C4=85dzio=C5=82ka wrote: > > If I package a -rc version, should it have a -next suffix in its name > > even though the "stable" version isn't packaged? >=20 > I think it's best to just call it unicorn. The version says -rc and we > mention it in the synopsis and description. And it's useful under the > hood for guix lint to match the upstream name. Fair enough. > > Maybe I should also package the non-rc unicorn? The test suite for that > > version fails to compile, so it's not entirely trivial. >=20 > Is the previous release useful? As far as I am aware, the non-rc release is not useful beyond avoiding any potential uneasyness about running -rc releases ;) > We normally don't package betas or > release candidates... it depends. Do you have an idea of the release > timeline? Sadly, I have no idea. > Do you think upstream would mind if we packaged the RC? I don't think so? As a datapoint, FreeBSD packages the -rc. > > + ;; NOTE: unicorn ships a bundled QEMU, but with custom modificatio= ns. >=20 > Can you add more detail to this comment? Is it just a patch on a QEMU > tarball or is this not really QEMU anymore? The documentation suggests the changes go quite deep: | Internally, Unicorn reuses the CPU emulation component of QEMU as its | core (with quite a lot of changes to adapt to our design). What do you think about a comment like this? ;; NOTE: unicorn ships a bundled QEMU, but heavily modified. > > + (add-after 'unpack 'install-bindings-to-python-output > > + (lambda* (#:key outputs #:allow-other-keys) > > + ;; python-build-system will build the bindings and instal= l them to > > + ;; the "out" output, so change the build-internal names o= f the > > + ;; outputs. > > + (set-car! (assoc "out" outputs) "lib") > > + (set-car! (assoc "python" outputs) "out") > > + #t)) >=20 > I would wait for advice here. The manual requests we write everything in > a functional style. But I don't know of another way to make > python-build-system install things to alternate outputs without changing > the build system or replacing the install phase. It would be nice to > have a parameter for this somewhere... Yeah, it's not the nicest thing. I think I'll submit a patch to c-u that would add such a parameter (does #:python-output sound good?), and then come back here when it lands. Would this imperative hack be ok as a temporary so= lution? > > + (add-before 'check 'check-library > > + (lambda* (#:key outputs #:allow-other-keys) > > + ;; TODO: running the tests on non-x86 requires a cross-bi= nutils > > + ;; with x86 as target. > > + ,@(if (member (%current-system) '("x86_64-linux" "i686-li= nux")) >=20 > I think the 'when' procedure is more clear than 'if' in cases where the > else branch is empty. The issue is that the else branch contains '(), and is not itself empty. Do you happen to know how to get the value of (%current-system) build-side? Thanks for your review! --vzywwqkch572k4rq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl6AmAEACgkQ4xWnWEYT FWSgFhAAyDaaXmj8Js9BvgjvinyLCQRrB0CVull04a2pIT7O527tsxxlUK3uRM0U WIbLEovk/5dkWILIOkDPKc5/rSQM7tO+xjya6fJCT5Y6i6M0plurrtUKrBnAOdUq EgvjWYfGeOOYnoM5+v86RMSdy/4fRe0pogSQ8hlhsQmfpA0d3m6FnWKExxp97ya+ /SdXp2SQcGV6zJAfa4s+PAqxrPJSEJqOdTS5yY9AGb17sSm/PmsGxaKhtnVtuRS9 Igr9VD4ljfuzRZx9qreg5nwxqZ0hwXqjRaiIPen/CHB+HSqs8p4eOvl9jHAC5XQt oVr0NdB3Fh3Z7jLNhWpWfYENzp72baQftMopXPTM7mBMje75x+bBzr6UZXshnRzU qFG3f+iW2PiAjPGKPrJnLNVJVP84IA09HTdRKxE/OhCwNQ8cMrK5+gCsPJZ4QSB+ +X0F6/QgCuJUcRE3nMz4vrArFw/t/KDGmBxGGEe6pN2yKZx3lC0Stk4W9L2blyrw 5IfEmkPq3pl1fDWLUKw+H2eriA9dHFaWKsl7nXGBtT7giylr0OVTNVzZp0M8AWcB DusOLuCogkKAvs5inBaP0InDttBYN2vZNW27Dbhqz2O4AFMx6p3GD4NxXecilGVQ 5ucITT19Nf/+Y5yXd8PShcIDwEnrJ43YAsUK6RJlySjwYGDfw9Y= =0iAC -----END PGP SIGNATURE----- --vzywwqkch572k4rq-- From kuba@kadziolka.net Sun Mar 29 11:32:50 2020 Received: (at 40267) by debbugs.gnu.org; 30 Mar 2020 02:35:38 +0000 Received: from pat.zlotemysli.pl ([37.59.186.212]:46460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIZve-000578-5E for 40267@debbugs.gnu.org; Sun, 29 Mar 2020 11:32:50 -0400 Received: (qmail 25138 invoked by uid 1009); 29 Mar 2020 17:32:48 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25765. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.023209 secs); 29 Mar 2020 15:32:48 -0000 Received: from unknown (HELO gravity) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with SMTP; 29 Mar 2020 17:32:48 +0200 Date: Sun, 29 Mar 2020 17:32:46 +0200 From: Jakub =?utf-8?B?S8SFZHppb8WCa2E=?= To: Leo Famulari Cc: 40267@debbugs.gnu.org Subject: Re: [bug#40267] [PATCH 2/2] gnu: Add python-pwntools. Message-ID: <20200329153246.prmtftsaburxt4tt@gravity> References: <20200328005052.22846-1-kuba@kadziolka.net> <20200328005345.24506-1-kuba@kadziolka.net> <20200329025615.GA16918@jasmine.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sexsfyzgwa7epi6n" Content-Disposition: inline In-Reply-To: <20200329025615.GA16918@jasmine.lan> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40267 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Mar 2020 15:32:50 -0000 --sexsfyzgwa7epi6n Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 28, 2020 at 10:56:15PM -0400, Leo Famulari wrote: > On Sat, Mar 28, 2020 at 01:53:45AM +0100, Jakub K=C4=85dzio=C5=82ka wrote: > > * gnu/packages/cybersecurity.scm (python-pwntools): New variable. > > + (propagated-inputs >=20 > It would be nice to sort these, especially if the package might grow new > dependencies later. The current order is copied from setup.py in the package, as I felt it was easier to compare it that way, but I can sort them if that's preferred. > > + (license (list license:expat license:bsd-2 license:gpl2+)))) >=20 > I looked it up; the package is overall MIT/Expat licensed, but a few > components use other licenses. It helpful to list the files with the > other licenses, or to say where to look up the info with a comment like > "See LICENSE-pwntools.txt in the source distribution." Ok, I added your suggested comment locally. --sexsfyzgwa7epi6n Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl6Av5YACgkQ4xWnWEYT FWT0FQ/+KCI7a/IX8tuJGmJh3Dy2j41V9w/WE0HyHltpYgGSBXGlfWmdeIE+j1sP 4B1DrS0DN1aZKkv8T+1dnupbuCBI65xD2xYwZejXD5QyV2ZRW4A+SpmcUtCeJykY q88x7/4jeOhvWeiham44wZEO58ZzdCTz/V73eSA9eCMLwB8zfz8N9VaWG4lE+mEl yQ7sWpYhMb/uHKwWKU3i4nXTK8KCLQe0OffG22UWHP5+5YGgRowdA6y1Zs4u3IhD IjYqltZhexKZSAiIzUFx+/mAbxfiI5vFaQ58j+zZuJrZMwLgtNg5e5x42Ja4lQHD 4gug0uXMa90uAsYhwjS3ISC32QmwpP+eFnOfPVsNTyXODpY0jiRoQm80as+GmGy9 8tR7Fh8eOhEdlHmlC50x85yLyIUxnITxAMFq/sIFbM9tdinoCirPP9X/xMQEVXp9 dgfqAPDJ+ZYhdc4wNDplwhMFo9zvqQ8eXw/D1wq7XfWANDC7rtS8KjtKHX2Yj+i9 0wLXSiqGeH+FtxOMgaPBAeT0p3IpnDRnSTVw099bQyIwlzDQjAZounLnv7M6CFlV c3TTTlJodHVkKN69JCcVChzhkyZDa6L8GG4IXIbE+JcbH2mb20IClkHHT3LA9qDW Sb+N5GwvRCySMfFLLFXHJWXXCNKH8uVMEDJteatyQwXZeKwN5xs= =87PL -----END PGP SIGNATURE----- --sexsfyzgwa7epi6n-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 07 16:19:50 2020 Received: (at 40267) by debbugs.gnu.org; 7 Jun 2020 20:19:50 +0000 Received: from localhost ([127.0.0.1]:55025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ji1ll-00044D-OC for submit@debbugs.gnu.org; Sun, 07 Jun 2020 16:19:50 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:55150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ji1lk-000443-7e for 40267@debbugs.gnu.org; Sun, 07 Jun 2020 16:19:48 -0400 Received: (qmail 15304 invoked by uid 1009); 7 Jun 2020 22:19:46 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25835. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.071735 secs); 07 Jun 2020 20:19:46 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 7 Jun 2020 22:19:46 +0200 From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= To: 40267@debbugs.gnu.org Subject: [PATCH v2 1/2] gnu: Add unicorn. Date: Sun, 7 Jun 2020 22:19:40 +0200 Message-Id: <20200607201941.5044-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Qmailux-2.08st: added fake Content-Type header Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40267 Cc: leo@famulari.name X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/packages/emulators.scm (unicorn): New variable. --- Changes from v1: packaged a new -rc, which makes tests pass on ARM. Add an input for cross-binutils, and use it while running tests. Also, the new -rc doesn't need Python for build orchestration, so the python-2 input got dropped. The python-build-system phases hack got prefixed with a comment referencing the core-updates patch. gnu/packages/emulators.scm | 117 ++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm index 9798ac370e..a82df6e9b6 100644 --- a/gnu/packages/emulators.scm +++ b/gnu/packages/emulators.scm @@ -44,7 +44,9 @@ #:use-module (gnu packages boost) #:use-module (gnu packages backup) #:use-module (gnu packages cdrom) + #:use-module (gnu packages check) #:use-module (gnu packages compression) + #:use-module (gnu packages cross-base) #:use-module (gnu packages curl) #:use-module (gnu packages elf) #:use-module (gnu packages fonts) @@ -88,7 +90,8 @@ #:use-module (gnu packages web) #:use-module (guix build-system cmake) #:use-module (guix build-system glib-or-gtk) - #:use-module (guix build-system gnu)) + #:use-module (guix build-system gnu) + #:use-module (guix build-system python)) (define-public desmume (package @@ -1622,3 +1625,115 @@ derived from Gens. Project goals include clean source code, combined features from various forks of Gens, and improved platform portability.") (supported-systems '("i686-linux" "x86_64-linux")) (license license:gpl2+))) + +;; python-pwntools requires a -rc release of unicorn +(define-public unicorn + (let ((unless-x86 + (lambda (code) + (if (member (%current-system) '("x86_64-linux" "i686-linux")) + '() + code)))) + (package + (name "unicorn") + (version "1.0.2-rc4") + ;; NOTE: unicorn ships a bundled QEMU, but with a lot of custom modifications. + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/unicorn-engine/unicorn") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "17nyccgk7hpc4hab24yn57f1xnmr7kq4px98zbp2bkwcrxny8gwy")))) + (outputs '("out" "python")) + ;; The main library is not written in Python, but the build process has + ;; little in common with any defined build system, so we might as well + ;; build on top of python-build-system and make use of all + ;; the Python-specific phases that can be reused. + (build-system python-build-system) + (arguments + `(#:modules ((srfi srfi-26) + (guix build python-build-system) + (guix build utils)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'install-bindings-to-python-output + (lambda* (#:key outputs #:allow-other-keys) + ;; python-build-system will build the bindings and install them to + ;; the "out" output, so change the build-internal names of the + ;; outputs. + ;; + ;; TODO: remove this once #40469 lands, through the core-updates + ;; holding zone, on master. + (set-car! (assoc "out" outputs) "lib") + (set-car! (assoc "python" outputs) "out") + #t)) + (add-before 'build 'build-library + (lambda* (#:key inputs #:allow-other-keys) + (invoke "make" + "-j" (number->string (parallel-job-count)) + "UNICORN_STATIC=no" + "CC=gcc"))) + (add-after 'build-library 'install-library + (lambda* (#:key outputs #:allow-other-keys) + (invoke "make" "install" + "UNICORN_STATIC=no" + (string-append + "PREFIX=" + (assoc-ref outputs "lib"))))) + (add-before 'build 'prepare-bindings + (lambda* (#:key outputs #:allow-other-keys) + (chdir "bindings/python") + ;; Set this environment variable so that the Python bindings + ;; don't build their own copy of the shared object, but use + ;; a dummy value such that the bindings test suite uses the + ;; same mechanism for loading the library as any other user. + (setenv "LIBUNICORN_PATH" "1") + (substitute* "unicorn/unicorn.py" + (("_path_list = \\[.*") + (string-append + "_path_list = [\"" + (assoc-ref outputs "lib") + ;; eat the rest of the list + "/lib\"] + 0*["))) + #t)) + (add-before 'check 'check-library + (lambda* (#:key outputs #:allow-other-keys) + (for-each + (lambda (suite) + (with-directory-excursion + (string-append "../../tests/" suite) + (invoke "make" "test" "CC=gcc" + ,@(unless-x86 + '("AS=i686-unknown-linux-gnu-as" + "OBJCOPY=i686-unknown-linux-gnu-objcopy"))))) + '("unit" "regress")) + #t)) + (add-after 'install 'install-samples + (lambda* (#:key outputs #:allow-other-keys) + (let* ((python-samples (find-files "." "sample_.*")) + (c-samples (find-files "../../samples" ".*\\.c")) + (python-docdir + (string-append (assoc-ref outputs "out") + "/share/doc/unicorn/samples")) + (c-docdir + (string-append (assoc-ref outputs "lib") + "/share/doc/unicorn/samples"))) + (for-each (cut install-file <> c-docdir) c-samples) + (for-each (cut install-file <> python-docdir) python-samples) + #t)))))) + (native-inputs + ;; NOTE: cross-binutils needs to be wrapped with unless-x86, as otherwise + ;; the linker provided by the package will be used, circumventing the ld-wrapper. + `(,@(unless-x86 + `(("assembler-for-tests" ,(cross-binutils "i686-unknown-linux-gnu")))) + ("cmocka" ,cmocka) + ("hexdump-for-tests" ,util-linux))) + (home-page "http://www.unicorn-engine.org") + (synopsis "Unicorn CPU emulator framework") + (description + "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator +framework based on QEMU.") + (license license:gpl2+)))) -- 2.26.2 From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 07 16:19:58 2020 Received: (at 40267) by debbugs.gnu.org; 7 Jun 2020 20:19:58 +0000 Received: from localhost ([127.0.0.1]:55027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ji1lq-00044T-45 for submit@debbugs.gnu.org; Sun, 07 Jun 2020 16:19:58 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:55152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ji1lk-000444-8S for 40267@debbugs.gnu.org; Sun, 07 Jun 2020 16:19:52 -0400 Received: (qmail 15314 invoked by uid 1009); 7 Jun 2020 22:19:46 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25835. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.067067 secs); 07 Jun 2020 20:19:46 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 7 Jun 2020 22:19:46 +0200 From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= To: 40267@debbugs.gnu.org Subject: [WIP PATCH v2 2/2] gnu: Add python-pwntools. Date: Sun, 7 Jun 2020 22:19:41 +0200 Message-Id: <20200607201941.5044-2-kuba@kadziolka.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200607201941.5044-1-kuba@kadziolka.net> References: <20200607201941.5044-1-kuba@kadziolka.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Qmailux-2.08st: added fake Content-Type header Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40267 Cc: leo@famulari.name X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/packages/cybersecurity.scm (python-pwntools): New variable. --- Changes from v1: added a patch to fix the installed commands' behavior when wrapped by Guix - exec doesn't fool Python's sys.argv[0]. Resolved the optional dependency on binutils for various architectures. Some unresolved questions here mentioned in the comments. I tried moving python-intervaltree out of bioinformatics.scm, but I couldn't find a good place for intervaltree (the C library) to go with it. python-xyz.scm feels wrong, since it's not in Python, and leaving it in bioinformatics.scm creates a cycle. gnu/local.mk | 1 + gnu/packages/cybersecurity.scm | 83 ++++++++++++++++++- .../python-pwntools-guix-wrappers.patch | 14 ++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/python-pwntools-guix-wrappers.patch diff --git a/gnu/local.mk b/gnu/local.mk index ae8a2275f7..4384ad952d 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1431,6 +1431,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-packaging-test-arch.patch \ %D%/packages/patches/python2-parameterized-docstring-test.patch \ %D%/packages/patches/python-paste-remove-timing-test.patch \ + %D%/packages/patches/python-pwntools-guix-wrappers.patch \ %D%/packages/patches/python-pycrypto-CVE-2013-7459.patch \ %D%/packages/patches/python-pycrypto-time-clock.patch \ %D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \ diff --git a/gnu/packages/cybersecurity.scm b/gnu/packages/cybersecurity.scm index 8ded081c50..d45618e617 100644 --- a/gnu/packages/cybersecurity.scm +++ b/gnu/packages/cybersecurity.scm @@ -18,10 +18,20 @@ (define-module (gnu packages cybersecurity) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (guix packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system python) - #:use-module (gnu packages engineering)) + #:use-module (gnu packages) + #:use-module (gnu packages avr) + #:use-module (gnu packages bioinformatics) + #:use-module (gnu packages cross-base) + #:use-module (gnu packages emulators) + #:use-module (gnu packages engineering) + #:use-module (gnu packages python-crypto) + #:use-module (gnu packages python-web) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages time)) (define-public ropgadget (package @@ -43,3 +53,74 @@ gadgets in binaries. Some facilities are included for automatically generating chains of gadgets to execute system calls.") (license license:bsd-3))) + +(define-public python-pwntools + (package + (name "python-pwntools") + (version "4.1.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Gallopsled/pwntools") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "101whqdfj415h0f4b9hz2jrwny44b0jdd9jmbh6rzz5w1yp41d5v")) + (patches (search-patches "python-pwntools-guix-wrappers.patch")))) + (build-system python-build-system) + (arguments + `(#:tests? #f)) ; Tests require networking and custom sshd configuration + (propagated-inputs + `(("paramiko" ,python-paramiko) + ("mako" ,python-mako) + ("pyelftools" ,python-pyelftools) + ("capstone" ,python-capstone) + ("ropgadget" ,ropgadget) + ("pyserial" ,python-pyserial) + ("requests" ,python-requests) + ("pygments" ,python-pygments) + ("pysocks" ,python-pysocks) + ("dateutil" ,python-dateutil) + ("packaging" ,python-packaging) + ("psutil" ,python-psutil) + ("intervaltree" ,python-intervaltree) + ("sortedcontainers" ,python-sortedcontainers) + ("unicorn" ,unicorn "python") + + ;; See https://docs.pwntools.com/en/stable/install/binutils.html + ;; All architectures recognized by pwntools are included. + ("binutils:aarch64" ,(cross-binutils "aarch64-linux-gnu")) + ("binutils:alpha" ,(cross-binutils "alpha-linux-gnu")) + ("binutils:arm" ,(cross-binutils "arm-linux-gnueabihf")) + ;; TODO: AVR binutils aren't detected, + ;; see https://github.com/Gallopsled/pwntools/pull/1536 + ("binutils:avr" ,avr-binutils) + ("binutils:cris" ,(cross-binutils "cris-linux-gnu")) + ("binutils:i686" ,(cross-binutils "i686-linux-gnu")) + ("binutils:ia64" ,(cross-binutils "ia64-linux-gnu")) + ("binutils:m68k" ,(cross-binutils "m68k-linux-gnu")) + ("binutils:mips" ,(cross-binutils "mipsel-linux-gnu")) + ("binutils:mips64" ,(cross-binutils "mips64el-linux-gnu")) + ;; TODO: MSP430 doesn't work for the same reason as AVR. + ("binutils:msp430" ,(cross-binutils "msp430")) + ("binutils:powerpc" ,(cross-binutils "powerpc-linux-gnu")) + ("binutils:powerpc64" ,(cross-binutils "powerpc64-linux-gnu")) + ;; TODO: Attempting to assemble code for arch='s390' complains + ;; about bfdname + ("binutils:s390" ,(cross-binutils "s390-linux-gnu")) + ("binutils:sparc" ,(cross-binutils "sparc-linux-gnu")) + ("binutils:sparc64" ,(cross-binutils "sparc64-linux-gnu")) + ;; TODO: Should VAX use a -linux-gnu target, or just "vax"? + ("binutils:vax" ,(cross-binutils "vax-linux-gnu")) + ("binutils:x86_64" ,(cross-binutils "x86_64-linux-gnu")))) + (native-inputs + `(("tox" ,python-tox))) + (home-page "https://github.com/Gallopsled/pwntools") + (synopsis "CTF framework and exploit development library") + (description "Pwntools is a CTF framework and exploit development library. +Written in Python, it is designed for rapid prototyping and development, and +intended to make exploit writing as simple as possible.") + ;; See LICENSE-pwntools.txt in the source distribution. + (license (list license:expat license:bsd-2 license:gpl2+)))) diff --git a/gnu/packages/patches/python-pwntools-guix-wrappers.patch b/gnu/packages/patches/python-pwntools-guix-wrappers.patch new file mode 100644 index 0000000000..b79a22320d --- /dev/null +++ b/gnu/packages/patches/python-pwntools-guix-wrappers.patch @@ -0,0 +1,14 @@ +Parse argv properly when the programs are wrapped by Guix. +======================================================================== +diff --git a/pwnlib/commandline/common.py b/pwnlib/commandline/common.py +index 75edfdcb..5249b6e6 100644 +--- a/pwnlib/commandline/common.py ++++ b/pwnlib/commandline/common.py +@@ -28,5 +28,7 @@ parser_commands = parser.add_subparsers(dest='command') + def main(file=sys.argv[0]): + import pwnlib.commandline.main + name = os.path.splitext(os.path.basename(file))[0] ++ if name.startswith('.') and name.endswith('-real'): ++ name = name[1:-5] + sys.argv.insert(1, name) + pwnlib.commandline.main.main() -- 2.26.2 From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 12 07:00:31 2024 Received: (at control) by debbugs.gnu.org; 12 Nov 2024 12:00:31 +0000 Received: from localhost ([127.0.0.1]:60941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tApZP-0003V1-13 for submit@debbugs.gnu.org; Tue, 12 Nov 2024 07:00:31 -0500 Received: from mail-pj1-f51.google.com ([209.85.216.51]:56410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tApZM-0003Uk-Q1 for control@debbugs.gnu.org; Tue, 12 Nov 2024 07:00:29 -0500 Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2e3d523a24dso4346549a91.0 for ; Tue, 12 Nov 2024 04:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731412763; x=1732017563; darn=debbugs.gnu.org; h=subject:from:to:message-id:date:from:to:cc:subject:date:message-id :reply-to; bh=NU/HmK+rumW3e440TqH2dqFnu/1T52nwAqonClQVaIM=; b=hk4vHqMU7f2kC/Nl/BZw/sEzsU4l3wgPB6uV3bJciHaJ9CwyVOKTouCZPmX5OIt6PA EpjI6v6zuOWRIRwvjD/fbTzeyIIZl1AnohcFgydJpACGH/XIGECB/snv7vDRISgTUUgk FD9lZdsmgYzyeEGhEryL/YrhS8ZFvbtWwJ9QqwdIRhQcEU1hbbqhMK02iWdeHNk8B2T+ 5IRt5a6G7ABURKe4GCUsamqU8g12nmrjGc2u195yq5eifBgqjMJfAwCR8VYjjbkx6Ut3 ZaRAQgoyXiRBZGgyvM1OzDgyEdyLVZS/CwYyWqApC5o2FvG1kkHbbob0gBHfodlkLwzr WXuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731412763; x=1732017563; h=subject:from:to:message-id:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NU/HmK+rumW3e440TqH2dqFnu/1T52nwAqonClQVaIM=; b=Db4lNOJcjhVUu/OJS9OG11t7a2U6NDOHqzxcI2d//CdWaM+CloHASM6I7JWNW2rCxF WfG3Jt63mv+wmvzFizPGrFCOI76iWzZJ1OTJYB2brCUHwSIGh47pBmH29GfIj1jl/Xe5 hbygswVRQMNF+PX4VGqz/jFCJAsro+lI5Kwi3GXfOrDcmUMYUvplDvG/+KhbuOEYcehq e0HGK3SWd2pMRs5N7p0z2i4HvW9b7lbeD8BcBJxfUqN00sIeMDoNkU7hQB5Ay7w/7BgW +hgXvy7NXA4Y5TPPIEfwi43xUGE0MI0MXYx0kJX5HZjHpRSrUvBb1ERHlir4swuquish rSXw== X-Gm-Message-State: AOJu0YxfNpJwuqp0adSjplf0MCPY0xQU+CERUAByOEMK/1DxmDizmp6I 5vdq6HIlYbb+EYxS42EWhbNWGIFVOsWd8CBecepTYM9BGhMgMq+/BSTQSMtz X-Google-Smtp-Source: AGHT+IG98QuIDX5E96yMzcbM0XnxYcgu3FU2IPtEY4WO46f/ZtOiYjkVHXdp/g6RyogHLKrogcelzA== X-Received: by 2002:a17:90b:48c9:b0:2e2:b204:90c5 with SMTP id 98e67ed59e1d1-2e9b1797cedmr21585124a91.33.1731412762646; Tue, 12 Nov 2024 03:59:22 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e9a5f948a9sm10327823a91.29.2024.11.12.03.59.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 03:59:21 -0800 (PST) Date: Tue, 12 Nov 2024 20:59:15 +0900 Message-Id: <87ed3g4q98.fsf@gmail.com> To: control@debbugs.gnu.org From: Maxim Cournoyer Subject: control message for bug #40267 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 40267 quit From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 12 07:00:14 2024 Received: (at 40267-done) by debbugs.gnu.org; 12 Nov 2024 12:00:15 +0000 Received: from localhost ([127.0.0.1]:60938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tApZ8-0003UO-B4 for submit@debbugs.gnu.org; Tue, 12 Nov 2024 07:00:14 -0500 Received: from mail-pl1-f175.google.com ([209.85.214.175]:58499) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tApZ6-0003UD-3k for 40267-done@debbugs.gnu.org; Tue, 12 Nov 2024 07:00:12 -0500 Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-21145812538so50802305ad.0 for <40267-done@debbugs.gnu.org>; Tue, 12 Nov 2024 04:00:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731412751; x=1732017551; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UnOIn3sSC37/O76OQCnKujgWTM5Dng2Mrtbwaznve7E=; b=NiRANZyFnxZ4/jGKrt0k9hhQQGiyLyjqQlX9hU61FjYTfe5CVGNg97Kgokb1tuByv2 JUcocil2WgOVtS/ypnQfQnhsRDbD50joKzteEZaLwFuct0BpxxuQn4ils651C7LbjHcz mSVmO+px1XO1uXYUPTIdXSkT1rG+V7QRBrUSBWQ71uvrls/5I5xuQdoCqNQ0ZNwKZFWJ mH+uR5ugXrqQsb0A9OAmvSSAoq/17+4wISX8Mw4W4b/dT9r6W77mJBJ30eS9HptLGh47 hfpEsiNiLw4+QNdlgkRzt9aNwXAR1JMaNV3nhLrV2YZhizaE2RP499fI8H53qqMXyHHC UD9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731412751; x=1732017551; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UnOIn3sSC37/O76OQCnKujgWTM5Dng2Mrtbwaznve7E=; b=KqSx7cMtRoc9XFjRCb/jcEGVEqApk4kOGYslVTosk8d+gEt+y3h7LoMyw9iFoqwZeh xKhKtJerUl038Py3BA1NP/5XPK3i31uR+yEBE6Sqwp4qBhUSyZ8YgoIiIIrR/9pCoVeH L3XYA1uk5EbBh9U2LYPD5VMcAYbNgr8SD9DVgfjKIyPIvJYXN8OpP8tVHDmJ04HlP74M sX7r4yOEXLxWCacf2F2wtUfBOwht4MKJm57j4NQpv3nKpFlYLdumR7XmJLH7afgF4apD yeCi/bEb0/WeknLMdKAMGKIlYKfs2UIo/H2Zw54jscLGo53zYOBmsQUbaSfr/22GcqsE xGxA== X-Gm-Message-State: AOJu0Yx7Iy0WRXuTTh1nQdkJeiPTuxe1RsHL4i4bXNvOv5Rp2hleVBnU 47egtCgeu7NbaO0B65ZmUPfbWzpVhV2lm4sCXnJiK4p2/doA6MutaBEza5kj X-Google-Smtp-Source: AGHT+IF6w+c5o0GypoKq3bLU8OlMSdsmUng7RWiTOqUA2h6Mdb0EsA7QBLf0SbH2bd8rhzHCvCQmGw== X-Received: by 2002:a17:903:2ce:b0:20c:f27f:fcc with SMTP id d9443c01a7336-21183d7203emr210895275ad.44.1731412751434; Tue, 12 Nov 2024 03:59:11 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21177e58531sm91763955ad.174.2024.11.12.03.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 03:59:10 -0800 (PST) From: Maxim Cournoyer To: Jakub =?utf-8?B?S8SFZHppb8WCa2E=?= Subject: Re: [bug#40267] [WIP PATCH v2 2/2] gnu: Add python-pwntools. In-Reply-To: <20200607201941.5044-2-kuba@kadziolka.net> ("Jakub =?utf-8?B?S8SFZHppb8WCa2EiJ3M=?= message of "Sun, 7 Jun 2020 22:19:41 +0200") References: <20200607201941.5044-1-kuba@kadziolka.net> <20200607201941.5044-2-kuba@kadziolka.net> Date: Tue, 12 Nov 2024 20:59:03 +0900 Message-ID: <87frnw4q9k.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40267-done Cc: 40267-done@debbugs.gnu.org, leo@famulari.name X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi, Jakub K=C4=85dzio=C5=82ka writes: > * gnu/packages/cybersecurity.scm (python-pwntools): New variable. We already have 'pwntools', added 4 years ago in 018e09d4c8be98224f04fbeb5c105b42eefb4f10. There now appears to also be a unicorn-next in our packages, at version 22. Closing. --=20 Thanks, Maxim From unknown Fri Jun 20 07:16:05 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 10 Dec 2024 12:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator