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 iLGRG+Fz+GBcUAEAgWs5BA (envelope-from ) for ; Wed, 21 Jul 2021 21:22:09 +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 GNpLF+Fz+GBmRQAA1q6Kng (envelope-from ) for ; Wed, 21 Jul 2021 19:22:09 +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 AE3EE6007 for ; Wed, 21 Jul 2021 21:22:07 +0200 (CEST) Received: from localhost ([::1]:58842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6HnC-0002fP-Jx for larch@yhetil.org; Wed, 21 Jul 2021 15:22:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6Hn8-0002fF-2X for guix-patches@gnu.org; Wed, 21 Jul 2021 15:22:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55319) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m6Hn7-0005H7-RO for guix-patches@gnu.org; Wed, 21 Jul 2021 15:22:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m6Hn7-0008Tx-Ke for guix-patches@gnu.org; Wed, 21 Jul 2021 15:22:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49671] [PATCH] guix: records: Improve error reporting. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 21 Jul 2021 19:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49671 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Julien Lepiller Cc: 49671@debbugs.gnu.org Received: via spool by 49671-submit@debbugs.gnu.org id=B49671.162689529132566 (code B ref 49671); Wed, 21 Jul 2021 19:22:01 +0000 Received: (at 49671) by debbugs.gnu.org; 21 Jul 2021 19:21:31 +0000 Received: from localhost ([127.0.0.1]:38632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6Hmd-0008TB-Gl for submit@debbugs.gnu.org; Wed, 21 Jul 2021 15:21:31 -0400 Received: from out0.migadu.com ([94.23.1.103]:61474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6Hma-0008T2-9h for 49671@debbugs.gnu.org; Wed, 21 Jul 2021 15:21:29 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1626895287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gdXPv+8jNSvtGV4MuiX4qeWrT3MmuIX8Wddxkkk6gcM=; b=MAGZ8S+PICWvzxfTbxhqvaNmYxNLpiyEmvfUCqeyVosPUUh6EUZOCv7GQNYWVi+aJCcYst 7NaXQgEh2dqShRHu7DiSy09Q+dIR+mYp0fe/aXcW/rVvud/U4rfM1xWzuqbzquPEHcJpj0 y/9wfkq/rvEwa3GIp52zUHPyF+Gb8So= From: Sarah Morgensen References: <20210721014047.3878a0c7@tachikoma.lepiller.eu> Date: Wed, 21 Jul 2021 12:21:23 -0700 In-Reply-To: <20210721014047.3878a0c7@tachikoma.lepiller.eu> (Julien Lepiller's message of "Wed, 21 Jul 2021 01:40:47 +0200") Message-ID: <86zgufscb0.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Auth-User: iskarian@mgsn.dev 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=1626895329; 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:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=gdXPv+8jNSvtGV4MuiX4qeWrT3MmuIX8Wddxkkk6gcM=; b=Q23ZRZrEKBucp33Wbess7u3SvH8S+fevw8QTiV3Hcx0i74RslLQdtnOJM+bv0QCSEk7svz YY0PKaYMEV8/+oXlzuJNeMwDoJr0Rd1L6tyfxpQybzoAVlEjpaC/9fiSj2KjboaUDxJvCI gU2frq9C6QmCJIjoc+Ho6v1hb11XNuqAnSiYlP5cXqWk0CTPnw1Wy0FaGOrDMfV4ZOL86R S9DJu4XksC3tftaFgJ93hw9i+AUoEh+Zq+DcdFAXkxx1UzxkX6uN+4NekuNfVKKwSpOZ6p tQMy7c0Xpf1Kf8WGK0djUiiIStN2vjzH7Mr9IVb3sQSIY4CBucBRdExybUZQyQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626895329; a=rsa-sha256; cv=none; b=t+aMtVRzSlovbxudByjmIohDbjymHKNd7TDiJZ8QKUwUU7q3v6EOWTpwpS5xMobSQiyYno 6BikmzwueQB4G+CFx/UyKsMMRTmT7EXYgMqCt4/FZHAPp38MBV9/H43Sk0LSQYrBOWr3JA Lvt2DfgldGduLynaMqey4uO4TuZaUA4gY0Pu2n5cgSFI5YiezoguEGt2lBt1q8Z3RY0y+i 0TZ/bYW147zFimmUHdVLFvOPtBgHnyuJON4JObJzWa4aR3x2hbfZd0JHxXqe6LsNcYR5gi Ci2kq1cikVwEEKflH7tinXkNSO/QYFrqWrcnINsXikCn6glfil/qhnVtnSxW1A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=MAGZ8S+P; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); 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.31 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=MAGZ8S+P; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); 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: AE3EE6007 X-Spam-Score: -1.31 X-Migadu-Scanner: scn1.migadu.com X-TUID: +rwtRMCr07QG Hi Julien, Julien Lepiller writes: > Hi Guix! > > This patch improves error reporting a bit when making mistakes in guix > records. This is motivated by a user getting "invalid field specifier" > for their whole services field in their os record. With this patches, > they would have seen: After applying your patch, I get: --8<---------------cut here---------------start------------->8--- guix/records.scm:108:19: warning: "multiple values in field specifier. Got ~a values associated with key ~a. Values are:~%~{~a~%~}": unsupported format option ~{, use (ice-9 format) instead --8<---------------cut here---------------end--------------->8--- After adding `(ice-9 format)` to imports it works as expected. I see this also applies to package records! This will be great for those starting to package in Guix. > > multiple values in field specifier. Got 2 values associated with key > services. Values are: > (append (list (service ...) ...)) > (modify-services %desktop-services ...) > > Which would have hinted them at fixing the parenthesis. Or at least, it > would have saved us some time trying to count them :) > > Here are the cases that are handled and the associated message: > > (operating-system > services) > guix system: error: services: invalid field specifier. The format of a > field is `(services value)' > > (operating-system > (services)) > test.scm:2:2: error: (services): Value missing in field specifier. The > format of a field is `(services value)'. > > (operating-system > (services 1 2 3)) > test.scm:2:2: error: (services 1 2 3): multiple values in field > specifier. Got 3 values associated with key services. Values are: ^ Wrap in `'? > 1 > 2 > 3 > > (operating-system > ()) > guix system: error: (): invalid field specifier. The format of a field > is `(field value)' > > (operating-system > ((services %desktop-services))) > test.scm:2:2: error: ((services %desktop-services)): invalid field > specifier. (services %desktop-services) is not a valid field name. ^ Should this also be wrapped in `'? Why do some of these messages lose their context and come from `guix system` instead? > > Of course, we can improve these error messages, and internationalize > them. > > WDYT? [...] > - (apply syntax-violation name "invalid field specifier" > - (if parent-form > + (syntax-case #'weird () > + (() ;the empty list > + (apply syntax-violation name > + "invalid field specifier. The format of a field is `(field value)'" > (list parent-form #'weird) > - (list #'weird))))))) > + (list #'weird))) Why the extra `(list #'weird')`? AFAICT right now this is providing `(list parent-form #:'weird)` as the parent form. And since parent-form is optional, shouldn't this be --8<---------------cut here---------------start------------->8--- (apply syntax-violation name "invalid field specifier. The format of a field is `(field value)'" (if parent-form (list parent-form #:'weird) (list weird))) --8<---------------cut here---------------end--------------->8--- (and similar for the others)? -- Sarah