From unknown Fri Jun 20 07:17:12 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#51922 <51922@debbugs.gnu.org> To: bug#51922 <51922@debbugs.gnu.org> Subject: Status: [PATCH 0/2] Improve the reported location of configuration warnings Reply-To: bug#51922 <51922@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:17:12 +0000 retitle 51922 [PATCH 0/2] Improve the reported location of configuration wa= rnings reassign 51922 guix-patches submitter 51922 Josselin Poiret severity 51922 normal tag 51922 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 17 09:40:59 2021 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== From: Josselin Poiret To: guix-patches@gnu.org Subject: [PATCH 0/2] Improve the reported location of configuration warnings 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: ++++ Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-Spam-Level: **** 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-Spam-Score: 1.7 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 [...] Content analysis details: (1.7 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: jpoiret.xyz (xyz)] 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom; id=dev%40jpoiret.xyz; ip=209.51.188.17; r=debbugs.gnu.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.51.188.17 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 0.5 FROM_SUSPICIOUS_NTLD_FP From abused NTLD 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: submit Cc: Josselin Poiret 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.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.51.188.17 listed in wl.mailspike.net] 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: jpoiret.xyz (xyz)] 0.0 T_SPF_TEMPERROR SPF: test of record failed (temperror) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 17 09:43:57 2021 Received: (at 51922) by debbugs.gnu.org; 17 Nov 2021 14:43:58 +0000 Received: from localhost ([127.0.0.1]:60584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnMAH-0005VY-KV for submit@debbugs.gnu.org; Wed, 17 Nov 2021 09:43:57 -0500 Received: from jpoiret.xyz ([206.189.101.64]:38828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnMAF-0005VQ-UK for 51922@debbugs.gnu.org; Wed, 17 Nov 2021 09:43:56 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 7E23D184F65; Wed, 17 Nov 2021 14:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1637160235; 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: in-reply-to:in-reply-to:references:references; bh=XBVh3AsH6ej7MlLxtycFDwm5DsyqXpGTgAaB+D2Gwvk=; b=jsbpuIZHC0xqHRrSaozN9DXRNGe/LfbWXRRlxA43yp/7FKToAm8CTxI2Bie8BuvvPqSkve CIORpK2uj5eozFIUJJWs4oaHtgWVneRCWU+0NmDMEOgwZ5fNVNx/eQh5TlAaXBkdhLRUkQ t5vpxT//rMj5rW2/nbOStepyEakTmJkIQzdG/eLY7rjCadbzkpXkTzTtnB2jJdA4FT5mwh 9Zq1UDYHSt2W5HNDfJSa5ztZ4GQ2rlulqrozieru22ZcnXRFrTuBn00Rymw0yVqQeTElZP 4r9AU4bu386s/K7HocUkZLd2nERio+c/F5D1y9Npgh0oje9z4fGoyN/NBpz78w== From: Josselin Poiret To: 51922@debbugs.gnu.org Subject: [PATCH 2/2] gnu: system: Improve location of some configuration warnings. Date: Wed, 17 Nov 2021 14:43:48 +0000 Message-Id: <20211117144348.17090-2-dev@jpoiret.xyz> In-Reply-To: <20211117144348.17090-1-dev@jpoiret.xyz> References: <20211117144028.16722-1-dev@jpoiret.xyz> <20211117144348.17090-1-dev@jpoiret.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Bar: / Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * gnu/bootloader.scm (%warn-target-field-deprecation): Remove it. * gnu/bootloader.scm (warn-target-field-deprecation): Use define-with-syntax-properties. * gnu/system.scm (ensure-setuid-program-list) [...] Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: jpoiret.xyz (xyz)] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: 51922 Cc: Josselin Poiret 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.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * gnu/bootloader.scm (%warn-target-field-deprecation): Remove it. * gnu/bootloader.scm (warn-target-field-deprecation): Use define-with-syntax-properties. * gnu/system.scm (ensure-setuid-program-list) [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: jpoiret.xyz (xyz)] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager * gnu/bootloader.scm (%warn-target-field-deprecation): Remove it. * gnu/bootloader.scm (warn-target-field-deprecation): Use define-with-syntax-properties. * gnu/system.scm (ensure-setuid-program-list): Ditto. Also rename the 'location' variable to 'properties'. --- gnu/bootloader.scm | 16 +++++++--------- gnu/system.scm | 11 ++++++----- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index d1c72c0c85..9cf5457873 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -183,8 +183,13 @@ (define-record-type* ;; The record contains bootloader independant ;; configuration used to fill bootloader configuration file. -(define-syntax-rule (warn-target-field-deprecation value) - (%warn-target-field-deprecation value (current-source-location))) +(define-with-syntax-properties (warn-target-field-deprecation + (value properties)) + (when value + (warning (source-properties->location properties) + (G_ "the 'target' field is deprecated, please use 'targets' \ +instead~%"))) + value) (define-record-type* bootloader-configuration make-bootloader-configuration @@ -213,13 +218,6 @@ (define-record-type* (serial-speed bootloader-configuration-serial-speed ;integer | #f (default #f))) -(define (%warn-target-field-deprecation value location) - (when value - (warning (source-properties->location location) - (G_ "the 'target' field is deprecated, please use 'targets' \ -instead~%"))) - value) - (define-deprecated (bootloader-configuration-target config) bootloader-configuration-targets (%bootloader-configuration-target config)) diff --git a/gnu/system.scm b/gnu/system.scm index 03fb55db15..9de0f79b44 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1107,16 +1107,17 @@ (define (operating-system-environment-variables os) ;; TODO: Remove when glibc@2.23 is long gone. ("GUIX_LOCPATH" . "/run/current-system/locale"))) -(define-syntax-rule (ensure-setuid-program-list lst) - "Ensure LST is a list of records and warn otherwise." - (%ensure-setuid-program-list lst (current-source-location))) +;; Ensure LST is a list of records and warn otherwise. +(define-with-syntax-properties (ensure-setuid-program-list (lst properties)) + (%ensure-setuid-program-list lst properties)) -(define (%ensure-setuid-program-list lst location) +;; We want to be able to use defines, so define a procedure. +(define (%ensure-setuid-program-list lst properties) (define warned? #f) (define (warn-once) (unless warned? - (warning (source-properties->location location) + (warning (source-properties->location properties) (G_ "representing setuid programs with file-like objects is \ deprecated; use 'setuid-program' instead~%")) (set! warned? #t))) -- 2.33.1 From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 17 09:44:10 2021 Received: (at 51922) by debbugs.gnu.org; 17 Nov 2021 14:44:10 +0000 Received: from localhost ([127.0.0.1]:60588 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnMAT-0005Wi-US for submit@debbugs.gnu.org; Wed, 17 Nov 2021 09:44:10 -0500 Received: from jpoiret.xyz ([206.189.101.64]:38756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnMAE-0005VO-KV for 51922@debbugs.gnu.org; Wed, 17 Nov 2021 09:44:09 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 90EC7184F27; Wed, 17 Nov 2021 14:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1637160233; 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: in-reply-to:in-reply-to:references:references; bh=USvYSL062ojHkz9dUzW/1zoI/XnS8Kkpuy1Y4EwS+ps=; b=uDcOycI5hyqjnNV/7m7jqt+h2RXBdcvucm0ntlPHiW2hNaP6m9huVxfdv2Q0wWeuVIWRd5 w+3fGXpeLjBCZKJI1owNO4dJIxNXJbQkmyhRfS9X9TgrPk7XW+2GXYh3V9W0TmuSNRaZWj yEj+O8Oz0hSnWAdK09Ztiox0cThUVenJY/8978UMc3F/w8mphEeG4dbs8ATV28OK5iohmu j3HRypfaBc1WTg+GYg7ATWNnMwaHcZd+qYF0Mt/9GoTivaCkc/xGJlVkxbNvdK1NbVYn0Y bNQEnAG0eOSrEvFdUP3Uv60e4AJZmFlNZKCvvTNv4qzC+Zx058ixKvlVrdsMBA== From: Josselin Poiret To: 51922@debbugs.gnu.org Subject: [PATCH 1/2] guix: Add syntax to capture arguments' syntax-properties. Date: Wed, 17 Nov 2021 14:43:47 +0000 Message-Id: <20211117144348.17090-1-dev@jpoiret.xyz> In-Reply-To: <20211117144028.16722-1-dev@jpoiret.xyz> References: <20211117144028.16722-1-dev@jpoiret.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Bar: / Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * guix/diagnostics.scm (define-with-syntax-properties): Add it. --- guix/diagnostics.scm | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/guix/diagnostics.scm b/guix/diagnostics.scm index 6a792febd4..337a73c1a2 100644 --- a/guix/diagnostics.scm +++ b/guix/diagnostics.scm @@ -54, 7 +54, 9 @@ (define-module (guix diagnostics) c [...] Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: jpoiret.xyz (xyz)] 0.0 T_SPF_TEMPERROR SPF: test of record failed (temperror) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: 51922 Cc: Josselin Poiret 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.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * guix/diagnostics.scm (define-with-syntax-properties): Add it. --- guix/diagnostics.scm | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/guix/diagnostics.scm b/guix/diagnostics.scm index 6a792febd4..337a73c1a2 100644 --- a/guix/diagnostics.scm +++ b/guix/diagnostics.scm @@ -54,7 +54,9 @@ (define-module (guix diagnostics) c [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: jpoiret.xyz (xyz)] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager * guix/diagnostics.scm (define-with-syntax-properties): Add it. --- guix/diagnostics.scm | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/guix/diagnostics.scm b/guix/diagnostics.scm index 6a792febd4..337a73c1a2 100644 --- a/guix/diagnostics.scm +++ b/guix/diagnostics.scm @@ -54,7 +54,9 @@ (define-module (guix diagnostics) condition-fix-hint guix-warning-port - program-name)) + program-name + + define-with-syntax-properties)) ;;; Commentary: ;;; @@ -331,3 +333,37 @@ (define guix-warning-port (define program-name ;; Name of the command-line program currently executing, or #f. (make-parameter #f)) + + +(define-syntax define-with-syntax-properties + (lambda (x) + "Define BINDING to be a syntax form replacing each VALUE-IDENTIFIER and +SYNTAX-PROPERTIES-IDENTIFIER in body by the syntax and syntax-properties, +respectively, of each ensuing syntax object." + (syntax-case x () + ((_ (binding (value-identifier syntax-properties-identifier) + ...) + body ...) + (and (and-map identifier? #'(value-identifier ...)) + (and-map identifier? #'(syntax-properties-identifier ...))) + #'(define-syntax binding + (lambda (y) + (with-ellipsis ::: + (syntax-case y () + ((_ value-identifier ...) + (with-syntax ((syntax-properties-identifier + #`'#,(datum->syntax y + (syntax-source + #'value-identifier))) + ...) + #'(begin body ...))) + (_ + (syntax-violation #f (format #f + "Expected (~a~{ ~a~})" + 'binding + '(value-identifier ...)) + y))))))) + (_ + (syntax-violation #f "Expected a definition of the form \ +(define-with-syntax-properties (binding (value syntax-properties) \ +...) body ...)" x))))) -- 2.33.1 From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 17 11:58:26 2021 Received: (at 51922-done) by debbugs.gnu.org; 17 Nov 2021 16:58:26 +0000 Received: from localhost ([127.0.0.1]:33698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnOGQ-0006b8-Aj for submit@debbugs.gnu.org; Wed, 17 Nov 2021 11:58:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnOGO-0006aq-3s for 51922-done@debbugs.gnu.org; Wed, 17 Nov 2021 11:58:24 -0500 Received: from [2001:470:142:3::e] (port=39628 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnOGI-0003Ua-Q7; Wed, 17 Nov 2021 11:58:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=14UJbrLHFfnh3rfGZGFam742FQ0HeAKwHqii/kSTUh0=; b=C0DYsfTNUMoiGW8MEN5y w8DEQDvfRl8gS43khGbf7JB1916lcyA42X00CBnK/FRG+FIcbri/ySXK+lX/G3Q9Ll3FNiOkCNtkm GPeZrBLTRfsvXTVTN9vXWHt9DUtjUydUhLdoR5a5hJADwpzVMvUtJKE33q0yo8f27qyXqZ5+9xzSJ 5KzBGcQTebQcM+1u2yulExB12KAw8pMQQqZxThSV1/x24oMarkoem6nuOXu7JrB6aC2zZff0XyaaW ecfTPQJb53AUlZ6NO7KS8iLzErJBiLNCK7JayKrfQUjwmq+3D5w2w5BPV5mtmGMWexMatljxfzbkH 5NXhYc6Qu3nmSw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:52282 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnOGH-0001EN-0G; Wed, 17 Nov 2021 11:58:18 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Josselin Poiret Subject: Re: bug#51922: [PATCH 0/2] Improve the reported location of configuration warnings References: <20211117144028.16722-1-dev@jpoiret.xyz> Date: Wed, 17 Nov 2021 17:58:14 +0100 In-Reply-To: <20211117144028.16722-1-dev@jpoiret.xyz> (Josselin Poiret's message of "Wed, 17 Nov 2021 14:40:28 +0000") Message-ID: <87sfvuu3bt.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.3 (/) X-Debbugs-Envelope-To: 51922-done Cc: 51922-done@debbugs.gnu.org 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.3 (-) Hi, Josselin Poiret skribis: > 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. Neat! That=E2=80=99s a much welcome improvement. > 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 think that=E2=80=99s OK, that=E2=80=99s a reasonable approach. > 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). Again, I think that=E2=80=99s fine: this macro solves what it was designed = to address, and if we need something fancier, we can think about it later. > guix: Add syntax to capture arguments' syntax-properties. > gnu: system: Improve location of some configuration warnings. I tweaked the first commit log and applied it. Thank you! Ludo=E2=80=99. From unknown Fri Jun 20 07:17:12 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 16 Dec 2021 12:24:07 +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