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 yA9WBKwUlWGZBAEAgWs5BA (envelope-from ) for ; Wed, 17 Nov 2021 15:41:48 +0100 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 uHaVO6sUlWFYIAAA1q6Kng (envelope-from ) for ; Wed, 17 Nov 2021 14:41:47 +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 7AD511780C for ; Wed, 17 Nov 2021 15:41:47 +0100 (CET) Received: from localhost ([::1]:49934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnM8A-00078n-9r for larch@yhetil.org; Wed, 17 Nov 2021 09:41:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnM7S-0006tc-6M for guix-patches@gnu.org; Wed, 17 Nov 2021 09:41:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnM7R-00089j-Tt for guix-patches@gnu.org; Wed, 17 Nov 2021 09:41:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mnM7R-0005PN-Rg for guix-patches@gnu.org; Wed, 17 Nov 2021 09:41:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51922] [PATCH 0/2] Improve the reported location of configuration warnings Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 17 Nov 2021 14:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51922 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51922@debbugs.gnu.org Cc: Josselin Poiret X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163716005920772 (code B ref -1); Wed, 17 Nov 2021 14:41:01 +0000 Received: (at submit) by debbugs.gnu.org; 17 Nov 2021 14:40:59 +0000 Received: from localhost ([127.0.0.1]:60572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnM7G-0005Om-Qg for submit@debbugs.gnu.org; Wed, 17 Nov 2021 09:40:59 -0500 Received: from lists.gnu.org ([209.51.188.17]:50804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnM7D-0005OY-BJ for submit@debbugs.gnu.org; Wed, 17 Nov 2021 09:40:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnM7D-0006b6-2N for guix-patches@gnu.org; Wed, 17 Nov 2021 09:40:47 -0500 Received: from jpoiret.xyz ([206.189.101.64]:36850) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnM7B-00085J-2f for guix-patches@gnu.org; Wed, 17 Nov 2021 09:40:46 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id E4FC9184C99; Wed, 17 Nov 2021 14:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1637160041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ui9ejPcUFxQ3fkf/AUBSxZV9RHC6ZpvgXAeSGomSKzo=; b=H3+2+OGgah7x/prmHbQhBClNHYkem4XYCU0iNIdczrPgU1KsiNLNyZdjQ3dm+7hLFhgKwj ib8azC+CTtjBq7VT2s89EtrqKHJqu/FRovDqzZBRHI34dXaszKfx62U5kDN2mSA5cUGjDY 5Iptbhbbxd9NI9yBItmgcbNG+oPyOVAyF/B1kCSYF+4rWMO45V6qyf+h3OYgvIRs+5cF+8 xq9Fi7wtjUfsACbMMTdBfYDSOWhYj+ypY5QfQ0f3aQ5qOmTQpCCft1+IUvWLerzSRxGqYV reLKVBU8/tRs5Du3tq3a6SgvGbkTa+RxmtMJ4jLLqpuV75h+/OfKqNx0DVSLiQ== Date: Wed, 17 Nov 2021 14:40:28 +0000 Message-Id: <20211117144028.16722-1-dev@jpoiret.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Bar: ++++ Received-SPF: pass client-ip=206.189.101.64; envelope-from=dev@jpoiret.xyz; helo=jpoiret.xyz X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.001, FROM_SUSPICIOUS_NTLD_FP=1.999, PDS_OTHER_BAD_TLD=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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" Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches From: Josselin Poiret via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1637160107; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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:dkim-signature; bh=ui9ejPcUFxQ3fkf/AUBSxZV9RHC6ZpvgXAeSGomSKzo=; b=Ll5B14HvXXxurqJdhXpVHnmZX6qho/qHXdoZ+sYqvkyOpapbhB2579O20kYKHaYmegywhM RFVI1VJyG6lwFmsqzXHbW3cKAlQX/Z6AA+Cuclbov8KI63HKnc+wvrUoIwRzObnmn1tsDE eC60UDNggd1eqEjB9/kyhfLdkfjC9v+mgdO9O78aIQm5f9Gsovt5hXgZKhPn5W82ykGvIG XG2vp/k5/XRgPCG5yZZuQvID9ba573lttUzXRHftsCSk5yaHSVEA4lwL/dh2lhjcWQ8yMz rTx205JBjUbK2Xra98oRPVtRLTJaj/rRnm4WKc7BbWdBXS2xBQieXDI/7wcG7g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637160107; a=rsa-sha256; cv=none; b=U+SKRmLLBm6sgjAK2K/yk/PA+WLW2R6Va6+EtshnLQdi4PC1fFxEzx6CW9dm8VoyvpxXPt wRHLGRcwzKxVd8dGH7E4cXqX8DuxT0AIRhwvNVaegRgXHASymT2PKkDsgBlJ3XV0IaVCXG JC1SCYqyR2PfJnDOXZRKMPaqc8D12rp2/BWhmS4xIpJUCEoY4neu6lk5Pyy9Rm7d94LpIL lUZpvYO1nr2CHKN02HPzf6aQCJS0vU/SDCIQf1o8yaqFnvO/jzOS5f/ZmrsBnE1vb60MYB kfmQKndriIYiuLTDL3ruIXK6yZItasWxtP5mdGNr9EQgAhQBeD7x4hp2xPOJNA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=H3+2+OGg; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.55 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=H3+2+OGg; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 7AD511780C X-Spam-Score: -1.55 X-Migadu-Scanner: scn0.migadu.com X-TUID: AeqmdionZscL Hello everyone, While working on the swap-space patch, I noticed that currently, warnings about deprecated fields in guix records use the location of the record definition macro, rather than of the invalid value. For some records such as 'operating-system', this makes it rather user unfriendly and confusing. This patchset first adds the syntax 'define-with-syntax-properties', which helps avoid boilerplate code to define sanitizers with proper location reporting. I put it in guix/diagnostics.scm as I thought this was the place that was most likely to be use-module'd for warning messages, as this is quite tied to that use. The second patch makes use of this new helper to update two warnings: the one about 'target' to 'targets' in bootloader.scm, and the one about setuid-programs. In both cases, a `guix system reconfigure` now reports the exact location of the incriminating values, rather than of the 'bootloader-configuration' or 'operating-system' lines respectively. The approach I've taken for the helper was to make something simple and general enough for most uses. It should correctly report syntax errors with custom errors messages rather than the generic "source expression failed to match any pattern ...". Note although that it isn't possible to do any defines in the body of the macro, as this doesn't use any lambda-like macros (see the second case for an example). I can see two drawbacks to this macro: 1) This macro will not help you write expand-time checkers. This would introduce too much complexity, and I'm not sure the end-user would notice a significant change. 2) It doesn't deconstruct values such as lists to get the individual list values's properties. This would also introduce too much complexity (eg. checking if the list is literal, deconstructing it, and falling back to a generic source location if the list is only available at eval-time). Best, Josselin Poiret Josselin Poiret (2): guix: Add syntax to capture arguments' syntax-properties. gnu: system: Improve location of some configuration warnings. gnu/bootloader.scm | 16 +++++++--------- gnu/system.scm | 11 ++++++----- guix/diagnostics.scm | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 15 deletions(-) -- 2.33.1