From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Taylan Kammer Newsgroups: gmane.lisp.guile.bugs Subject: bug#72372: srfi-64: test-approximate evaluates test-name multiple times Date: Tue, 1 Oct 2024 23:59:40 +0200 Message-ID: <21f17cd9-38d4-4fa3-8578-1dce6c0e58f3@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25931"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: Tomas Volf <~@wolfsden.cz>, 72372@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Wed Oct 02 00:01:30 2024 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1svkvx-0006Yo-NY for guile-bugs@m.gmane-mx.org; Wed, 02 Oct 2024 00:01:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svkvc-0003fE-0d; Tue, 01 Oct 2024 18:01:08 -0400 Original-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 1svkvY-0003ei-L7 for bug-guile@gnu.org; Tue, 01 Oct 2024 18:01:04 -0400 Original-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 1svkvX-000179-3T for bug-guile@gnu.org; Tue, 01 Oct 2024 18:01:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=RC8qo1e33qbuB7rpR9AOxnHDK3xExelGDHJm0OQETn0=; b=GrqRnL89wREOqMAYReFASW9U3e5HuPaPmpK6A9LDjHiLu1Od9UA9L9eyUgIgCCsTMo75GxKmQNIi/rOijpfHTWNsVUaB9gd5QZwKbp+bO/MwA2ccfsCpShA/yS+YMPwdcZeg6ibq/TmDWfO6sr7i1nRcWazo3MKWB2z9kBrdHjXDFx+BTGYzP8RjFUBLNDfdXA05dwUbJFhuuhc9cAN1yTqfueEotLmemJ3ZxrHEYDnqL81VyrLxmrNyCP0xWQPyqCb5TtlE0vB5CKmBUStzYBGVVXFby2StDF9LHw+COl/SgwnW0MIbkDOQQlZCugYfN6alUByzcrwiTNIuNCqRyg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1svkvW-00054Y-6E for bug-guile@gnu.org; Tue, 01 Oct 2024 18:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Taylan Kammer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 01 Oct 2024 22:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72372 X-GNU-PR-Package: guile Original-Received: via spool by 72372-submit@debbugs.gnu.org id=B72372.172782005019477 (code B ref 72372); Tue, 01 Oct 2024 22:01:02 +0000 Original-Received: (at 72372) by debbugs.gnu.org; 1 Oct 2024 22:00:50 +0000 Original-Received: from localhost ([127.0.0.1]:53931 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svkvJ-000545-Ky for submit@debbugs.gnu.org; Tue, 01 Oct 2024 18:00:49 -0400 Original-Received: from mail-wm1-f46.google.com ([209.85.128.46]:40001) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svkvI-00053x-St for 72372@debbugs.gnu.org; Tue, 01 Oct 2024 18:00:49 -0400 Original-Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-42cae563348so8057575e9.0 for <72372@debbugs.gnu.org>; Tue, 01 Oct 2024 15:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727819983; x=1728424783; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=RC8qo1e33qbuB7rpR9AOxnHDK3xExelGDHJm0OQETn0=; b=NA8fuwEg4L866e336p3kwLymVwdEivJsB1z/Boqrhr7xHNfSH1rUDaTO/vkUtspBoX y262W6ZY2lJjn7FK21pS8X9zTpOnh556W3tm6xvphDahQu28baZ8hSA8S8so387j7LH7 xuwuJdZ4m4XOtiXhY3HBc3dX2LjON61GVDFhhMcxx2xzrkR+Sxz81+rJD/Ea13WSdsfN iQNNeTYsErDEdF59fwSmoIzWWHEPtOZz3cMrmbXTG1asCdoEaCDIktRrlHTAyUYneMDn BNkxZQYXnpbu3BF7ScSkCDQLleMItLTNXoUXH7kU0qpGUuwv0QvfWcBdTKHOthNLw+LT 2Rmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727819983; x=1728424783; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RC8qo1e33qbuB7rpR9AOxnHDK3xExelGDHJm0OQETn0=; b=MKAes5pAGHPGY+iNWDYokX/aTB0zZvFneR2CwM3sJmb1QlpYgU14P7ZY5eVvoThq8h qADIkcCDLhcuP11OnHyYSefCpq2a0LUKvIA99W8TLs3+r3ffdD+gR7PCrYmGL+YzfKS2 cAh0WFrHGXM7S9h9eca1ctN1/IL8X365hyUQBbw/iRjasBxN6KDONxoizuBXIT9c2U1I j2t2dLMyDWzHpTP97lxf2W30thu5VU4Ibyrac3P7bXRvlK59B19JzhSJt9kvS3UdZHRk 09oBj5Pmwnn3nKIhpOmrEb88X5rcPeRPzDwrFpivP0/p+qv6VcDhk/m9kz2+ndGVOH29 Ipqw== X-Forwarded-Encrypted: i=1; AJvYcCX8cMT6+aXyt+sgnA3Of8Rbjw71Dh0f+8vB5Cd6u0A+UmZfjxvs6QIK0AapoVgH+FY8BrZybg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyQol+jbS195x+e/SuJLOm/wp6PdpQBUUxbqIsjFVlQkxlH8Kmj dQ3okdPDefozmnfKzQrbQnfoRkG0YF9Szm2frRi6uOVqh3YlNjzs X-Google-Smtp-Source: AGHT+IGliP1g/Ssf7093LteuQJcvBEJ7Xqcj9Tl8JvDRkw+OQ6lAWBviN9sf3ab5CHRQXAaKy7VWXQ== X-Received: by 2002:a05:600c:4f4f:b0:427:9f71:16ba with SMTP id 5b1f17b1804b1-42f777ed6e4mr2906875e9.5.1727819983174; Tue, 01 Oct 2024 14:59:43 -0700 (PDT) Original-Received: from ?IPV6:2003:106:8f04:c300:95ac:529d:6db3:196b? (p200301068f04c30095ac529d6db3196b.dip0.t-ipconnect.de. [2003:106:8f04:c300:95ac:529d:6db3:196b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f79fc90fdsm1495085e9.26.2024.10.01.14.59.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Oct 2024 14:59:41 -0700 (PDT) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:11003 Archived-At: On 30.07.2024 21:51, Tomas Volf wrote: > Hello, > > I think I found a bug in (srfi srfi-64) module shipped with GNU Guile. > > The specification says the following regarding the test-approximate: > >> This is equivalent to (except that each argument is only evaluated once): >> >> >> (test-assert [test-name] >> (and (>= test-expr (- expected error)) >> (<= test-expr (+ expected error)))) > However the test-name is evaluated multiple times: > > (use-modules (srfi srfi-64)) > (test-begin "x") > (test-approximate (pk "t") 1 1 0) > > Leading to: > > ;;; ("t") > > ;;; ("t") > > Have a nice day > Tomas Volf > > Looks like a bug in the reference implementation that Guile uses. It specifically evaluates the macro input `tname` at the beginning, binding it to the variable `name`, but then never uses `name` and just uses `tname` again, leading to it being evaluated twice. If someone wants to fix it upstream, it should be easy: Just change `tname` to `name` on line 788. My implementation already seems to have this fixed, because the affected section of the code was entirely rewritten. (In case someone is missing the context: I've explained in a previous email that I don't want to work on the reference implementation / the one shipped with Guile, because I find it too unreadable and difficult to work with, although in this particular case it looks like a trivial bug.) - Taylan