From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aNn7DaaxcmGtmgAAgWs5BA (envelope-from ) for ; Fri, 22 Oct 2021 14:42:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id EC+ZCaaxcmGcOQAA1q6Kng (envelope-from ) for ; Fri, 22 Oct 2021 12:42:14 +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 392892ED13 for ; Fri, 22 Oct 2021 14:42:13 +0200 (CEST) Received: from localhost ([::1]:56744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdtsB-00029G-O7 for larch@yhetil.org; Fri, 22 Oct 2021 08:42:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdts2-00028j-K2 for guix-patches@gnu.org; Fri, 22 Oct 2021 08:42:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48104) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdts2-0005Je-AU for guix-patches@gnu.org; Fri, 22 Oct 2021 08:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mdts1-00035m-UU for guix-patches@gnu.org; Fri, 22 Oct 2021 08:42:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51332] [PATCH 0/2] Detect early and gracefully handle invalid Texinfo Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Oct 2021 12:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51332 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51332@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163490647811816 (code B ref -1); Fri, 22 Oct 2021 12:42:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 Oct 2021 12:41:18 +0000 Received: from localhost ([127.0.0.1]:59650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdtrC-00034L-IA for submit@debbugs.gnu.org; Fri, 22 Oct 2021 08:41:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:60132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdtr8-000349-A5 for submit@debbugs.gnu.org; Fri, 22 Oct 2021 08:41:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdtr3-00024Q-Hf for guix-patches@gnu.org; Fri, 22 Oct 2021 08:41:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42844) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdtr2-0004w6-HM; Fri, 22 Oct 2021 08:41:00 -0400 Received: from [193.50.110.110] (port=53678 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdtr2-0002WN-6r; Fri, 22 Oct 2021 08:41:00 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 22 Oct 2021 14:40:52 +0200 Message-Id: <20211022124052.28197-1-ludo@gnu.org> X-Mailer: git-send-email 2.33.0 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634906533; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nOJ2PlRfiYynIPZY1TtFB8lsj+DLKgHf+Aa2aFF4RTo=; b=FQE6pNun5CAjtEAL9oDPObqSHA/guz40vUzm6jat9mqZWQb68oKLR5+17X9O1WzY2ZG2k6 iQYyYPqxIhhLLzhTU3kt7/SFfQa/K+j5An0QL20E3wT5qnr2r3QjfjTb5tib2NxIx1Tjt2 eNLgBM0ml0otem/xj1nhQr4YCcxk8J7J/vBL7xXFRDr8K7ddo5TX4lACtBBzJOg2FR/5nk rTSn1k8//k3GsVweQefFELbPNw2P+vgpkSj+pzYb61lE0U2HpDze1dg2t2ZNHpw8oTSIpl NEbO0eC7c6kFIxWUX9yguwYuRLukRePFGiDQuIKvWG1hA66k8n8vXLaZlqs1Vg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634906533; a=rsa-sha256; cv=none; b=DpZCQ+LC/QwxkrhR7Zw48Qj7j5K2B6VHQX77T5KYqSLgA9s7ygEe+Q7jSfU+2uzEvqzgH+ jXXZkP5AXAVSdehntpQJF0frvGZdNqlaSQ/7EflR4sXux4lCQWiWN33PgIL9Bx6awpjP7k N6d07Y/TCPQtP31zD/A74t9jA7lxVzjP0h7lkaapUYSHaqfMaSL8bY24nfzgVtOwsoDgAf SQTBbPPEaHq/PYYECZBDr01DUUh2XeQUyxwMGl9cg+NjIimdviSeFg/7LY18I1942oJGKS ogNgEVo3r1swJE749isPFN7YbU8koHHAY6LYfvsOmeLAoyKX3ctIIsO94+MNHA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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-Migadu-Spam-Score: -1.93 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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-Migadu-Queue-Id: 392892ED13 X-Spam-Score: -1.93 X-Migadu-Scanner: scn0.migadu.com X-TUID: ve2Yvgg7V4jq Hello! It’s a fact that we occasionally push invalid Texinfo markup in package descriptions/synopses, probably even more so in external channels, and despite the fact that ‘guix lint’ flags it. The problem is that some of the tools were designed around the idea that invalid Texinfo “does not happen”. For example, if a single package contains invalid markup, ‘guix search’ and ‘guix show’ crash badly: --8<---------------cut here---------------start------------->8--- $ guix search ghc citations name: ghc-citeproc version: 0.4.0.1 outputs: out systems: x86_64-linux i686-linux dependencies: ghc-aeson-pretty@0.8.8 ghc-aeson@1.5.6.0 ghc-attoparsec@0.13.2.5 + ghc-base-compat@0.11.2 ghc-case-insensitive@1.2.1.0 ghc-data-default@0.7.1.1 ghc-diff@0.4.0 + ghc-file-embed@0.0.15.0 ghc-pandoc-types@1.22 ghc-safe@0.3.19 ghc-scientific@0.3.7.0 + ghc-timeit@2.0 ghc-unicode-collation@0.1.3 ghc-uniplate@1.6.13 ghc-vector@0.12.3.0 + ghc-xml-conduit@1.9.1.1 location: gnu/packages/haskell-xyz.scm:15823:2 homepage: https://hackage.haskell.org/package/citeproc license: FreeBSD synopsis: Generate citations and bibliography from CSL styles Backtrace: 13 (primitive-load "/home/ludo/.config/guix/current/bin/gu…") In guix/ui.scm: 2185:7 12 (run-guix . _) 2148:10 11 (run-guix-command _ . _) In ice-9/boot-9.scm: 1752:10 10 (with-exception-handler _ _ #:unwind? _ # _) In guix/scripts/package.scm: 896:9 9 (_) In ice-9/boot-9.scm: 1747:15 8 (with-exception-handler # …) In guix/ui.scm: 1677:23 7 (call-with-paginated-output-port _ #:less-options _) 1712:11 6 (_ #) 1558:14 5 (package->recutils _ # _ # _ …) 1432:23 4 (texi->plain-text _) In texinfo.scm: 1132:22 3 (parse _) 967:36 2 (loop # (*fragment*) # …) 92:2 1 (command-spec _) In ice-9/boot-9.scm: 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Throw to key `parser-error' with args `(#f "Unknown command" urefhttps)'. --8<---------------cut here---------------end--------------->8--- (This one was fixed in c3c502896b1454b345ee9f17d20063853652a35a.) This series does two things: 1. Emit a warning when invalid markup is encountered but keep going. 2. Raise a syntax error, at macro-expansion time, when invalid markup is encountered. Obviously #2 incurs some overhead, since it parses Texinfo strings at expansion time, so it’s enabled only when ‘GUIX_UNINSTALLED’ is set—that is, when working on a checkout with ./pre-inst-env. The expanded code is exactly the same as before though, without any overhead. Concretely, that means that ‘make’ fail and you just don’t see the package until the error has been fixed: --8<---------------cut here---------------start------------->8--- $ make […] [ 78%] LOAD gnu/packages/haskell-xyz.scm ;;; note: source file ./gnu/packages/haskell-xyz.scm ;;; newer than compiled /home/ludo/src/guix/gnu/packages/haskell-xyz.go ;;; note: source file ./gnu/packages/haskell-xyz.scm ;;; newer than compiled /home/ludo/src/guix/gnu/packages/haskell-xyz.go gnu/packages/haskell-xyz.scm:15855:5: error: "@code{ghc-citeproc} parses @acronym{Citation Style Language, CSL} style files\nand uses them to generate a list of formatted citations and bibliography\nentries. For more information about CSL, see @urefhttps://citationstyles.org/}.": invalid Texinfo markup make[2]: *** [Makefile:7131: make-packages-go] Error 1 --8<---------------cut here---------------end--------------->8--- Feedback welcome! Ludo’. Ludovic Courtès (2): ui: Gracefully handle invalid Texinfo markup in package blurbs. packages: Optionally validate Texinfo markup at expansion time. guix/packages.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++--- guix/ui.scm | 17 ++++++++++++++-- 2 files changed, 64 insertions(+), 5 deletions(-) base-commit: e1261ddd38cf02a0f046f3a5360502d659b4e7d4 -- 2.33.0