From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KHPyDdzdFGP60wAAbAwnHQ (envelope-from ) for ; Sun, 04 Sep 2022 19:18:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id OGXmDdzdFGMSQgAAauVa8A (envelope-from ) for ; Sun, 04 Sep 2022 19:18:20 +0200 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 CD1049B96 for ; Sun, 4 Sep 2022 19:18:19 +0200 (CEST) Received: from localhost ([::1]:51922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUtGE-00077n-52 for larch@yhetil.org; Sun, 04 Sep 2022 13:18:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUtFy-00077d-N6 for guix-patches@gnu.org; Sun, 04 Sep 2022 13:18:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUtFy-00034v-Er for guix-patches@gnu.org; Sun, 04 Sep 2022 13:18:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUtFy-0006wS-AQ for guix-patches@gnu.org; Sun, 04 Sep 2022 13:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57496] [PATCH v3 3/3] gnu: bootloader: Add a friendly error message of menu-entry. Resent-From: tiantian Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 04 Sep 2022 17:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57496 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Julien Lepiller Cc: 57496@debbugs.gnu.org Received: via spool by 57496-submit@debbugs.gnu.org id=B57496.166231182826624 (code B ref 57496); Sun, 04 Sep 2022 17:18:02 +0000 Received: (at 57496) by debbugs.gnu.org; 4 Sep 2022 17:17:08 +0000 Received: from localhost ([127.0.0.1]:45593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUtF6-0006vL-1z for submit@debbugs.gnu.org; Sun, 04 Sep 2022 13:17:08 -0400 Received: from out162-62-57-137.mail.qq.com ([162.62.57.137]:37121) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUtF1-0006ui-If for 57496@debbugs.gnu.org; Sun, 04 Sep 2022 13:17:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1662311813; bh=IopPz9JzKGz/Nw3bPeE+VRY0TwCZW/hrLqURuEQtK0c=; h=References:From:To:Cc:Subject:Date:In-reply-to; b=UjYvDX/73QJGgHqSjSl2YW6Fq+IrgkyuqUAE+a7Rtg2/6u26LWQMvdWNBfbm3CEVF zmJpf679Tqz/OG1i05MAgAvxtDQ9L8JR3ySq5mTFo6PQhhlHUHFjhpj8fdXKjNEl/9 kkmxjSbosqTBvzdYK7vh7TaTS20th2i/cm14504Y= Received: from guix-pc ([240e:398:28a4:3121:5ae1:85dd:ab7b:103f]) by newxmesmtplogicsvrszc8.qq.com (NewEsmtp) with SMTP id 43418C8E; Mon, 05 Sep 2022 01:16:52 +0800 X-QQ-mid: xmsmtpt1662311812t566gmmoc Message-ID: X-QQ-XMAILINFO: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mail.com> <20220904173755.5be9efa0@sybil.lepiller.eu> User-agent: mu4e 1.8.9; emacs 28.1 From: tiantian Date: Mon, 05 Sep 2022 00:15:12 +0800 In-reply-to: <20220904173755.5be9efa0@sybil.lepiller.eu> Message-ID: <7x7d2jt5z0.fsf@foxmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1662311900; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id: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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=IopPz9JzKGz/Nw3bPeE+VRY0TwCZW/hrLqURuEQtK0c=; b=I1XH0DJgwF8y3Q+BO0Df0ry28VIWmnep0GXzy89bcGJFsJef1kIB7JfR4+HcpxphDSHXSe szv6wIlK8LVw4zPX67HvqVEZuvxL8QLecTJp1+T+MvY8WxLbA9QJu0WEB8yKWCQqd4a09R fyuijnjNOSG1NifQsZt0cGFJ/5+XYG9waV6ch7M0zqvevqNj6/yxxsF8Ds/0AnyNYlpFCw Mg1PB4d9quP/vUb1BpKJzBu+CjbTa4WAVYA1UhohN+o8XmthTNt2mFVxIoqNqS2cu1wmfz e4sJfbIIke11yHDopphc4jsXEuLqvRQieMsoamYfYwTNZOdpsBXwbmEE+Cv3wQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662311900; a=rsa-sha256; cv=none; b=TnSFSVvCtFOFmto+n0OOpnS8N4fWgz2aEYU+J/AgD5BsMHU7zltJJQQUnwPhxAMUrIglcA bC3N8KBYDzfhksZ0nTiOWecJPMy7Ph/DP+12204qc6yKkTLx3Ysz4SLgbQ8AqHzhBufCo9 jEbEICR6qDXgomtyzvDnM+/mOEDjKAoxwSCsssyBp4ByUAaXeb5BPeLxLtgerrAF3woQa/ wcchu11Uj2wrGoRiVecvgIW55s/U+3LgGAkIvA2QtPBWl8MIRDzad6hiO3Bv2p5t5ryAZk hICWno3Xiw9KQ3EStcRYS12dIcFBLYuTn8HJuL+vu/AVYCjeJ8fHgrnC265X7w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=foxmail.com header.s=s201512 header.b="UjYvDX/7"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=foxmail.com (policy=none); 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: 9.72 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=foxmail.com header.s=s201512 header.b="UjYvDX/7"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=foxmail.com (policy=none); 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: CD1049B96 X-Spam-Score: 9.72 X-Migadu-Spam: Yes X-Migadu-Scanner: scn0.migadu.com X-TUID: L6okYIIKNt8C Julien Lepiller writes: > Hi tiantian, > > I think the first two patches are good now, so let me focus on this one > :) > > Le Sun, 4 Sep 2022 22:04:31 +0800, > typ22@foxmail.com a =C3=A9crit : > >> From: tiantian >>=20 >> + (define (set-field? field) >> + "If the field is the default value, return #f." >> + (and field ; not default value #f >> + (not (null? field)))) ; not default value '() > > I don't think this set-field? is necessary. In the following, I don't > think you need the null? case at all because I think all the lists may > be empty without triggering an error. You don't necessarily want to > load modules or have arguments on the linux command line. > > In any case, it should be called field-set? instead :) > My English is not good. To be honest, I tried set-value?, value-set?, default-value?, not-default-value?, field-set? and set-field?. Finally, I select the 'set-field?'. But it seems that I didn't choose well. But it doesn't matter. The procedure is no longer needed. >> (match entry >> + ;; Modify the pattern to achieve more strict matching and prevent >> + ;; wrong matching, which ensures the output of error information >> + ;; when menu-entry is wrong. >> + >> + ;; The linux-arguments is optional and the test code for >> boot-parameters >> + ;; does not set it, so don't check it here. >> (($ label device mount-point >> - (? identity linux) linux-arguments initrd >> + (? set-field? linux) >> + linux-arguments >> + (? set-field? initrd) > > The could still be identity > >> #f () () #f) >> `(menu-entry (version 0) >> (label ,label) >> @@ -131,8 +162,10 @@ (define (menu-entry->sexp entry) >> (linux-arguments ,linux-arguments) >> (initrd ,initrd))) >> (($ label device mount-point #f () #f >> - (? identity multiboot-kernel) >> multiboot-arguments >> - multiboot-modules #f) >> + (? set-field? multiboot-kernel) >> + (? set-field? multiboot-arguments) >> + (? set-field? multiboot-modules) > > Some users might want to not use any modules or arguments I think, so > these fields should not be mandatory. For multiboot-kernel, identity is > enough. > >> + #f) >> `(menu-entry (version 0) >> (label ,label) >> (device ,(device->sexp device)) >> @@ -141,12 +174,13 @@ (define (menu-entry->sexp entry) >> (multiboot-arguments ,multiboot-arguments) >> (multiboot-modules ,multiboot-modules))) >> (($ label device mount-point #f () #f #f () () >> - (? identity chain-loader)) >> + (? set-field? chain-loader)) > > Same here, identity is fine. > I don't know multiboot very well, so I don't know if multiboot-arguments and multiboot-modules are necessary. Then I check them. It turns out that they are not necessary. I will not check them. I will change to use identify. Honestly, It's much easier for me to use only `identify'. :) >> `(menu-entry (version 0) >> (label ,label) >> (device ,(device->sexp device)) >> (device-mount-point ,mount-point) >> - (chain-loader ,chain-loader))))) >> + (chain-loader ,chain-loader))) >> + (else (report-menu-entry-error entry)))) > > Since this is a match, it is more common to use: > > (_ (report-menu-entry-error entry)) > Thank you for reminding me. I will correct it. > Also, it feels weird to patch the code you modified in a previous patch > of the same series. If you're not happy with the code you wrote in a > previous patch, you need to change it in the previous patch, not in a > new one :) > As I understood earlier, these changes about matching are related to the error reporting information, so I put these modifications in this submission. My knowledge of contribution is still too little. I will pay attention to it later. Thank you for reminding me. Thanks, tiantian