From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id mOZCDEQyNmXHiAAAauVa8A:P1 (envelope-from ) for ; Mon, 23 Oct 2023 10:43:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mOZCDEQyNmXHiAAAauVa8A (envelope-from ) for ; Mon, 23 Oct 2023 10:43:48 +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 1AB9734E73 for ; Mon, 23 Oct 2023 10:43:48 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=glEBUPb7; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698050628; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=yFaqefMbOj9y4QzPzuUB/iOf3Y2ZEGGGVRDoBy9qa3M=; b=twH9nPWqMuaXYc0/5KAIf02ha+hM+7Ni5/7uwExbTTSLm+vyTmou3jZh7KrfCDVey+5oLF 63YDW6Yu6NQDxd9ePBWfwSDNLATI+ewNTNqeOtdzxS5VyQ2UmA9UY9aPzuxcOXKlys6DoB GiRA4miJQDHykx3BrySoM2PzsUgmvRa2lqKMvSfMv0O5kQhOkqeCt20K21j6wmXKqyx+io gKAxbb98yhgfELx2aPI4Eit3pjlEGINpin1sSXBkibBdMePxP03B2MBue1SvqyUYeh06j1 ceyzRUuQMa7DEhlMFxbNAwJpquYiKd6pAFQk9xhe3wl8vxGDofjrZwMwpWefbQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=glEBUPb7; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698050628; a=rsa-sha256; cv=none; b=XCveJc/auRlvfkwVB2/KVV768xrZhg+GWXtAfdlwoQpo9VCWg6veb+BU/+E79B2NYSLe+1 d5inPYM9tqIvTYXmEe+wR2JyAGfQ09uRXBlNSP5cei4rLEsECsq/Axbre5Hr0GAe7h5ij5 A20QAQFEM+jVqC93V5F99HX+ePYORyaDMRcJ6yOvLU/+fM6q3a9217XKEa7cnkkNPMXw4r WqWf6JO10yPVt+SOP3PgEcSkmML7LVnsODiEMZ0tJ7UoFwqyJgyiRloW83xsPzuYsjJw8e GspqS5Xd5ui568mRToZ7FMbzLZRgsQ5js+Y/31cca7Qy/QQzu5QXB2LVJ7Kh0Q== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quqXA-0002X9-C4; Mon, 23 Oct 2023 04:43:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quqX8-0002X1-7n for guix-patches@gnu.org; Mon, 23 Oct 2023 04:43:34 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quqX7-00043M-7C for guix-patches@gnu.org; Mon, 23 Oct 2023 04:43:33 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1quqXa-0002tC-1G for guix-patches@gnu.org; Mon, 23 Oct 2023 04:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42146] [PATCH core-updates 1/?] build: substitute: Don't fail silently. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 23 Oct 2023 08:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42146 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= , 42146@debbugs.gnu.org Received: via spool by 42146-submit@debbugs.gnu.org id=B42146.169805058411010 (code B ref 42146); Mon, 23 Oct 2023 08:44:02 +0000 Received: (at 42146) by debbugs.gnu.org; 23 Oct 2023 08:43:04 +0000 Received: from localhost ([127.0.0.1]:49008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quqWd-0002rW-J8 for submit@debbugs.gnu.org; Mon, 23 Oct 2023 04:43:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38464) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quqWb-0002qn-Uf for 42146@debbugs.gnu.org; Mon, 23 Oct 2023 04:43:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quqW3-0003wG-3H; Mon, 23 Oct 2023 04:42:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=yFaqefMbOj9y4QzPzuUB/iOf3Y2ZEGGGVRDoBy9qa3M=; b=glEBUPb7YeHmTKTTMlDB F/t5wNLDsGMtYA4XobF3nZUHLTak5vVGW3puzGxGlzYn3aef7BGSH9n3jSt3E4U0hSdnCbMfuKdi2 KQVwxrsE3I3/v41CLzXqRRyLO07Jv04E+zi59iAWi3NMSLsExa7tXUTamNrFWpQZIVLhiVW2W8It9 5+Jzlbm1EvRLmd8aIBGRkCKK2GqVRhjuS6CQ9nZ0qEzMQMCPQd/8fvhbeay8ztZkfvI8N9MZJmoWV E1mGG2UbURq2+8FM46XDPlZQkcYkaYBb56T0hz9NXoLNnN3cHuzCug/Nm6GT5CIKilqYtZCUsS6VN eDMLk90Cfk5OkA==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <87pm1anp6a.fsf_-_@gmail.com> (Maxim Cournoyer's message of "Thu, 19 Oct 2023 19:54:53 -0400") References: <20200630220913.14665-1-kuba@kadziolka.net> <87lebyxs4y.fsf_-_@gnu.org> <87pm1anp6a.fsf_-_@gmail.com> Date: Mon, 23 Oct 2023 10:42:08 +0200 Message-ID: <875y2xivbz.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -6.78 X-Spam-Score: -6.78 X-Migadu-Queue-Id: 1AB9734E73 X-Migadu-Scanner: mx2.migadu.com X-TUID: ICYJxHXLQyXt Hi Maxim, Maxim Cournoyer skribis: > Ludovic Court=C3=A8s writes: [...] >>> +;;; Extend regexp objects with a pattern field. >>> +;;; >>> +(define-record-type >>> + (%make-regexp* pat flag rx) >>> + regexp*? >>> + (pat regexp*-pattern) ;the regexp pattern, a string >>> + (flag regexp*-flag) ;regexp flags >>> + (rx regexp*-rx)) ;the compiled regexp object >>> + >>> +;;; Work around regexp implementation. >>> +;;; This record allows to track the regexp pattern and then display it. >>> +(define* (make-regexp* pat #:optional (flag regexp/extended)) >> >> I=E2=80=99m skeptical about the concrete benefits. I would not include = it in >> (guix build utils), or at least not in this patch series. [...] > The benefit is concrete: it makes it possible to show which regexp > pattern failed to match (its textual representation), instead of > something much less useful such as a generic placeholder such as > " (regexp)". Yes, okay. Can we keep the interface private, then? To me it=E2=80=99s an implementation detail and perhaps a bit of a hack that I=E2=80=99d rather n= ot commit to maintaining. The cost might be to duplicate it in teams.scm, but that=E2=80=99s an accep= table cost IMO. > It's in actual use if you look at the definition of substitute: > > > (let ((rx+proc (map (match-lambda > (((or (? regexp? pattern) (? regexp*? pattern)) .= proc) > (cons pattern proc)) > ((pattern . proc) > (cons (make-regexp* pattern regexp/extended) pro= c))) > pattern+procs))) > > The previous version followed a different approach, annotating the > rx+proc list with the raw pattern; I think the approach here is a bit > cleaner, and it should also enable users to pass pre-computed regexp* > objects to substitute* and have useful error messages produced. Note that =E2=80=98substitute*=E2=80=99 only takes string literals as patte= rns, not regexp objects. The pattern part of clauses has sometimes been abused to pass code, typically =E2=80=98string-append=E2=80=99 calls, but that=E2= =80=99s definitely not the spirit. Another approach would have been, in =E2=80=98substitute*=E2=80=99, to capt= ure the regexp-as-string as well as other useful debugging info, such as its source location. Thanks, Ludo=E2=80=99.