From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.bugs Subject: bug#13838: [PATCH] Fix duplicate removal of with-fluids Date: Thu, 28 Feb 2013 10:40:16 +0100 Message-ID: <1362044416-8464-1-git-send-email-dak@gnu.org> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1362044534 11095 80.91.229.3 (28 Feb 2013 09:42:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Feb 2013 09:42:14 +0000 (UTC) Cc: David Kastrup To: 13838@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Feb 28 10:42:37 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UB00Z-0000LE-IT for guile-bugs@m.gmane.org; Thu, 28 Feb 2013 10:42:35 +0100 Original-Received: from localhost ([::1]:39692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UB00E-0003MI-KC for guile-bugs@m.gmane.org; Thu, 28 Feb 2013 04:42:14 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UB00A-0003Ji-FP for bug-guile@gnu.org; Thu, 28 Feb 2013 04:42:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UB007-0006yH-8C for bug-guile@gnu.org; Thu, 28 Feb 2013 04:42:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UB007-0006xQ-4R for bug-guile@gnu.org; Thu, 28 Feb 2013 04:42:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UB01x-0008U5-UX for bug-guile@gnu.org; Thu, 28 Feb 2013 04:44:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: David Kastrup Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 28 Feb 2013 09:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13838 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.136204458132513 (code B ref -1); Thu, 28 Feb 2013 09:44:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Feb 2013 09:43:01 +0000 Original-Received: from localhost ([127.0.0.1]:55151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB00y-0008SF-M8 for submit@debbugs.gnu.org; Thu, 28 Feb 2013 04:43:01 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36482) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB00v-0008S5-02 for submit@debbugs.gnu.org; Thu, 28 Feb 2013 04:42:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAzz2-0006UA-H4 for submit@debbugs.gnu.org; Thu, 28 Feb 2013 04:41:01 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:47988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAzz2-0006Tq-ER for submit@debbugs.gnu.org; Thu, 28 Feb 2013 04:41:00 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAzz1-0002cq-9E for bug-guile@gnu.org; Thu, 28 Feb 2013 04:41:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAzz0-0006SH-1L for bug-guile@gnu.org; Thu, 28 Feb 2013 04:40:59 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53602) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAzyz-0006S9-Jy for bug-guile@gnu.org; Thu, 28 Feb 2013 04:40:57 -0500 Original-Received: from localhost ([127.0.0.1]:58186 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAzyy-0001oZ-2C; Thu, 28 Feb 2013 04:40:56 -0500 Original-Received: by lola (Postfix, from userid 1000) id E0CAA201C09; Thu, 28 Feb 2013 10:40:28 +0100 (CET) X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6805 Archived-At: The following code displayed #f: (define a (make-fluid)) (define b (make-fluid)) (with-fluids ((a 3) (a 1) (b 2)) (display (fluid-ref b))) In general, removing any duplicate that is not right at the end of the (remaining) list will exhibit this problem. The fluids and vals arguments are modified in situ; the previous code only modified vals. --- libguile/fluids.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libguile/fluids.c b/libguile/fluids.c index f1c09cb..bd59e26 100644 --- a/libguile/fluids.c +++ b/libguile/fluids.c @@ -326,6 +326,8 @@ scm_i_make_with_fluids (size_t n, SCM *fluids, SCM *vals) { vals[i] = vals[j]; /* later bindings win */ n--; + fluids[j] = fluids[n]; + vals[j] = vals[n]; break; } } -- 1.7.10.4