From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id cLocHSr/pGVNJQEAqHPOHw:P1 (envelope-from ) for ; Mon, 15 Jan 2024 10:47:22 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id cLocHSr/pGVNJQEAqHPOHw (envelope-from ) for ; Mon, 15 Jan 2024 10:47:22 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=ZrjLTZ++; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-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=1705312042; 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=FqjAtI8tHogsl0r72qjE2ELleX+/G/Osq0aV3TlTZdU=; b=V29aU61OSXpLUNwKNbWeVOdIQw/fZJC/VphPvs+VmYDT7azXlHduaCLX2m7nD6DSvzO7H7 Ix10wEvxcX7EnP2f11bx0jYI2naecebd6YxIzLPuYJOY1eQ/1/IgM5/izhWtATAW2C+pIN 64uS4E2XTwQemyF3Nxd93HtnXXcGUdpuvM4Z9S0PK7G6tm4J0Cg9cwpaJTswpwayLrbdNf Kzeybty1QCFZ1KdsqWFbQZfPU5h/sCDJYp7RMrLTo95bTlDe73iAYWJ7l5dgpR+dfxiLd7 RLjbafmsP9a2cRlESsALzaoUXIoTtVhH4PZKYaRUl91YSRZAM3rlN7QnseKOIQ== 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=ZrjLTZ++; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705312042; a=rsa-sha256; cv=none; b=SxpiAMHzj8XDMWZLrbEpREyq+pjG3w31aB5L3WyAxb/fbHpAcnj3m4nXqc0zHJeoy12aWD pR6hFRpuHCBORWKYIf/t0gtA0XDfht7mOu9TK3I9ZlkJVH+Po4UQEOvE8121316Pb8EePy qNbMmd+xdGCNnrPqkV17yTZDV/+rZwxvyus9qkxJNgvOFK4HoipMDlFWJAnCeAleTEvuiC XNiB5fIB3/2rSTxHNNAh1wo+lXFKum8YsBVtdst1qfr3L5eTgUkUsaUv9SlGL/0rTcB3yO +EDnAoU8U3GpAyydM8J+wuq7g1khph06O4rvB7TkFS39z5LUdIusofIY7JAG6g== 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 11544509A2 for ; Mon, 15 Jan 2024 10:47:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPJYi-0004dh-3l; Mon, 15 Jan 2024 04:47:08 -0500 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 1rPJYd-0004dL-De for bug-guix@gnu.org; Mon, 15 Jan 2024 04:47:03 -0500 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 1rPJYd-0001hy-2O for bug-guix@gnu.org; Mon, 15 Jan 2024 04:47:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rPJYc-0006tc-7V for bug-guix@gnu.org; Mon, 15 Jan 2024 04:47:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#68413: Ungexp doesn't work on deep lists Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 15 Jan 2024 09:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68413 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Josselin Poiret Cc: Justin Veilleux , 68413@debbugs.gnu.org Received: via spool by 68413-submit@debbugs.gnu.org id=B68413.170531201226492 (code B ref 68413); Mon, 15 Jan 2024 09:47:02 +0000 Received: (at 68413) by debbugs.gnu.org; 15 Jan 2024 09:46:52 +0000 Received: from localhost ([127.0.0.1]:44733 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPJYS-0006sy-8D for submit@debbugs.gnu.org; Mon, 15 Jan 2024 04:46:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPJYQ-0006oK-En for 68413@debbugs.gnu.org; Mon, 15 Jan 2024 04:46:51 -0500 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 1rPJYK-0001g5-2f; Mon, 15 Jan 2024 04:46:44 -0500 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=FqjAtI8tHogsl0r72qjE2ELleX+/G/Osq0aV3TlTZdU=; b=ZrjLTZ++4UZUkIuP3ASe Yd1IN1nVumriG5QS10W+h+VZTBfd2s2WRsAA8H7aYKNH/Q/CHhQnYQFVs7NpGR4TuIlUPAWjkfTC2 BrmGc90kQpuEeT1b32DsdFc5sy1lIoKz3RFshFufH2xfKIKHzg9mLahOA0dL4xflTNFsng7ty4x5L fbWbUo3sU2ydCOYB8Tp0MArjyaL83BgjlPvaOnLtKlHbc5rIijzgl4omtYJ1AXZ8uE7nLfZyn0gzB Mn9Qg8s1ODro5ilW9JJPU8IUGgnI1b0FQ5S09pipCLM79m+1EsHZzGl3Sb+/DMxHPsyvvS7uyAdrn nkz4/nFPFygdAA==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <87ttnhh39d.fsf@jpoiret.xyz> (Josselin Poiret's message of "Sat, 13 Jan 2024 12:38:38 +0100") References: <87v87yvw2y.fsf@cock.li> <87ttnhh39d.fsf@jpoiret.xyz> Date: Mon, 15 Jan 2024 10:46:42 +0100 Message-ID: <87le8rj5dp.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: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 11544509A2 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -5.51 X-Spam-Score: -5.51 X-TUID: YM7Wu6nFV/3e Hi, Josselin Poiret skribis: > Justin Veilleux writes: > >>> (define packages >>> (list >>> (cons "coreutils" coreutils) >>> (cons "make" gnu-make) >>> ...)) >>> >>> #~(for-each >>> (lambda (f) >>> ... do-something) >>> '#$packages) >> >> If I send a patch to "fix" this, will it be usefull or is there a reason >> for this behavior? > > I think IMO that it's a bug, but it's also quite tricky to properly > traverse deep structures like this. The bug comes from the fact that in > gexp->sexp, we traverse lists by matching the reference with (refs ...), > but that doesn't match if the reference is a pair instead. Then, it > tries to match with ($ (? self-quoting? x)), which does > match since self-quoting? apparently returns #t on a pair, whether or > not its constituents are also self-quoting. Actually, what bug are we talking about? It seems to work for me with this example: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (define packages `(("coreutils" ,coreutils) ("make" ,g= nu-make))) scheme@(guile-user)> ,build (scheme-file "foo" #~(begin '#$packages)) building /gnu/store/lq9gvbilv0y2nph00zxk6bn3lvcgdxqq-foo.drv... $7 =3D "/gnu/store/9ryh6v80jvjv3kwx0q782h26h9gbaclj-foo" scheme@(guile-user)> (call-with-input-file $7 get-string-all) $8 =3D "(begin (quote ((\"coreutils\" \"/gnu/store/mppp9hwxizx9g9pikwcvvshb= 2ffxyq7p-coreutils-9.1\") (\"make\" \"/gnu/store/9fadhs5qmwl5x7f669a0v39b3r= yrmmf1-make-4.3\"))))" --8<---------------cut here---------------end--------------->8--- One of the design decisions for gexps was to ensure that substituting a file-like object by its file name would be O(1) in most cases. Substitution in lists as in the example above is supported, but primarily for backward compatibility. It should be avoided when possible because it=E2=80=99s inefficient: =E2=80=98gexp->sexp=E2=80=99 nee= ds to traverse the whole list/tree in search of potential candidates. Thanks, Ludo=E2=80=99.