Message ID | 20221001161911.8116-1-ludo@gnu.org |
---|---|
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B6EBD27BBEB; Sat, 1 Oct 2022 17:20:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8880C27BBEA for <patchwork@mira.cbaines.net>; Sat, 1 Oct 2022 17:20:24 +0100 (BST) Received: from localhost ([::1]:50352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org>) id 1oefDz-0005Na-Fr for patchwork@mira.cbaines.net; Sat, 01 Oct 2022 12:20:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oefDf-0005Mb-Pl for guix-patches@gnu.org; Sat, 01 Oct 2022 12:20:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oefDe-0005cH-PV for guix-patches@gnu.org; Sat, 01 Oct 2022 12:20:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oefDe-0003jv-LG for guix-patches@gnu.org; Sat, 01 Oct 2022 12:20:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58231] [PATCH 0/2] Checking the 'license' field of packages Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 01 Oct 2022 16:20:02 +0000 Resent-Message-ID: <handler.58231.B.166464116614321@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58231 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58231@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166464116614321 (code B ref -1); Sat, 01 Oct 2022 16:20:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Oct 2022 16:19:26 +0000 Received: from localhost ([127.0.0.1]:45621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1oefD4-0003iv-DK for submit@debbugs.gnu.org; Sat, 01 Oct 2022 12:19:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:47482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@gnu.org>) id 1oefD2-0003in-DD for submit@debbugs.gnu.org; Sat, 01 Oct 2022 12:19:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1oefD2-0005Cu-7X for guix-patches@gnu.org; Sat, 01 Oct 2022 12:19:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1oefD1-0005an-Uh; Sat, 01 Oct 2022 12:19:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=D0VaQ5FZtSqQcqV0tL1H4vviN/5uOJXgqNNleppnInM=; b=LR896TbkgKOOPO D6EPypu7Ca8GsMVGPnshsqLpu+ujXvCjRvqsZLI7u05gJdhtXGjYz8S9trm/3XxrmDTOzbq7kcZ4x fIsR404bgkYjS/2Aqr5sJhUGptuTiWsTCyhpc8E5071uggWZs4b4vi5NHhOqXb8kbKS9p9m4WOGLJ K7S+IGeyh0yiuJIi0arXL72Ux5hJAI8jtjVyAww6bA95wKBdRRSnVNYpwxAaPSd4q3gVcn7VuJszN C+r2cNakwTDT3nDdGz9i6/Gx8e6OcRcQMhgDf35yVHajzZsFEXqM7UD+ZfGOP57leVK6guh5lk66w mEZ6qbQ497al5vI/fpvw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:62741 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1oefD1-0007vT-C6; Sat, 01 Oct 2022 12:19:23 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> Date: Sat, 1 Oct 2022 18:19:11 +0200 Message-Id: <20221001161911.8116-1-ludo@gnu.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-getmail-retrieved-from-mailbox: Patches |
Series |
Checking the 'license' field of packages
|
|
Message
Ludovic Courtès
Oct. 1, 2022, 4:19 p.m. UTC
Hello Guix! We already have ‘guix lint -c license’ but that hasn’t prevented us from occasionally having invalid licenses committed. This patch adds add a ‘sanitize’ option to the ‘license’ field of <package> to detect invalid licenses early on, as zimoun suggested at: https://lists.gnu.org/archive/html/guix-devel/2022-09/msg00067.html The funny part of this patch is that the license validation expands to #t in the majority of cases, meaning that it comes without run-time overhead (there is macro-expansion overhead, but I didn’t measure it). Kinda like static type checking, except that we can only tell when a value is definitely a valid license and cannot conclude in other cases. Feedback welcome! Thanks, Ludo’. Ludovic Courtès (2): licenses: Let 'license?' expand to #t in trivial cases. packages: Raise an exception for invalid 'license' values. guix/licenses.scm | 58 +++++++++++++++++++++++++++++++++++++++------- guix/packages.scm | 40 +++++++++++++++++++++++++++++++- tests/packages.scm | 7 ++++++ 3 files changed, 95 insertions(+), 10 deletions(-) base-commit: d9b7982ba58fdea0934b60a81f507440a56c82ee
Comments
Thank you! This is good. Just to let you know though; when reverting e61c581805b2338ea8feaac86617c5d7bff41c41 and guix pull’ing, there is no error location. Doesn’t matter to me though. Computing Guix derivation for 'x86_64-linux'... -Backtrace: In ice-9/boot-9.scm: 222:29 19 (map1 _) 222:29 18 (map1 _) 222:29 17 (map1 _) 222:29 16 (map1 _) 222:29 15 (map1 _) 222:29 14 (map1 _) 222:29 13 (map1 _) 222:17 12 (map1 (((gnu packages qt)) ((gnu packages sqlite)) ((gnu packages web)) ((gnu packages xml)) ((gnu ?)) ?)) 3326:17 11 (resolve-interface (gnu packages qt) #:select _ #:hide _ #:prefix _ #:renamer _ #:version _) In ice-9/threads.scm: 390:8 10 (_ _) In ice-9/boot-9.scm: 3252:13 9 (_) In ice-9/threads.scm: 390:8 8 (_ _) In ice-9/boot-9.scm: 3536:20 7 (_) 2835:4 6 (save-module-excursion _) 3556:26 5 (_) In unknown file: 4 (primitive-load-path "gnu/packages/qt" #<procedure 7fded2ddefc0 at ice-9/boot-9.scm:3543:37 ()>) In ice-9/eval.scm: 619:8 3 (_ #f) 626:19 2 (_ #<directory (gnu packages qt) 7fded3df5780>) 293:34 1 (_ #(#(#(#(#(#(#(#(#(#(#<directory (gnu packages qt) 7fded3df5780> "qtshad?") #) #) #) #) #) #) #) #) #)) 619:8 0 (_ #(#(#(#(#(#(#(#(#(#(#<directory (gnu packages qt) 7fded3df5780> "qtshad?") #) #) #) #) #) #) #) #) #)) ice-9/eval.scm:619:8: ERROR: 1. &error-location: #f 2. &package-license-error: package: #f license: "https://www.qt.io/" 3. &formatted-message: format: "~s: invalid package license~%\n" arguments: ("https://www.qt.io/") guix pull: Fehler: You found a bug: the program '/gnu/store/vbk7jc9w4808cn7697bc3h24g2kl78wx-compute-guix-derivation' failed to compute the derivation for Guix (version: "4b2ae06e49fc7bd41856b02604b5f277a6df06ce"; system: "x86_64-linux"; host version: "0dec41f329c37a4293a2a8326f1fe7d9318ec455"; pull-version: 1). Please report the COMPLETE output above by email to <bug-guix@gnu.org>.
Hi, "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis: > Thank you! This is good. Just to let you know though; when reverting > e61c581805b2338ea8feaac86617c5d7bff41c41 and guix pull’ing, there is > no error location. Doesn’t matter to me though. > > Computing Guix derivation for 'x86_64-linux'... -Backtrace: [...] > 1. &error-location: #f > 2. &package-license-error: > package: #f > license: "https://www.qt.io/" > 3. &formatted-message: > format: "~s: invalid package license~%\n" > arguments: ("https://www.qt.io/") It may be that there’s no location info because during the “Computing Guix derivation” step, things are being evaluated. However, most likely the invalid license wouldn’t have been committed in the first place because the committer would have been unable to test the package. (There is location info when running Guix from one’s checkout.) Thanks for checking! Ludo’.
Ludovic Courtès <ludo@gnu.org> skribis: > The funny part of this patch is that the license validation expands > to #t in the majority of cases, meaning that it comes without > run-time overhead (there is macro-expansion overhead, but I didn’t > measure it). A quick measurement of the time taken by the “Computing Guix derivation” step¹ (most of which is macro expansion) suggests it’s going from ~1m34s to ~1m44s on my laptop—so roughly a 10% slowdown on this stage. I guess that’s the price to pay. That phase has always been very slow though, mostly due to psyntax, and we need to do something about it anyway. Ludo’. ¹ I ran ‘time guix time-machine --branch=wip-license-checks --url=$PWD’ and similar for the commit before those changes.
Hi, Ludovic Courtès <ludo@gnu.org> skribis: > licenses: Let 'license?' expand to #t in trivial cases. > packages: Raise an exception for invalid 'license' values. I pushed these two patches as b6bc4c109b807c646e99ec40360e681122d85b2c (see <https://issues.guix.gnu.org/58231> for context). Now we all need to run “make clean-go && make”! Thank you for your understanding. :-) Ludo’.