Subject: bug#41131: closed (Re: bug#41131: Bug in hash-table-merge! (and patch))

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 12 Mar 2021 21:34:02 +0000

Your bug report

#41131: [PATCH] hash-table-merge! ignores other-ht

which was filed against the guile package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
41131: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41131
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#41131: Bug in hash-table-merge! (and patch)
From: Andy Wingo <[email-masked]>
To: "Ricardo G. Herdt" <[email-masked]>
Cc: [email-masked]
Date: Fri, 12 Mar 2021 22:32:38 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Applied, thanks!

On Fri 08 May 2020 01:50, "Ricardo G. Herdt" <[email-masked]> writes:

> Hi,
>
> I just found this bug in the hash-table-merge! function
> (modul/srfi/srfi-69.scm). Instead of merging both hash tables, it was 
> ignoring one of them (other-ht). Attached is the fix, where it now folds
> over other-ht and store its data in ht.
>
> Cheers,
>
> Ricardo G. Herdt
>
> From 180a9e14b807295aa31966a52bfd732647458ef9 Mon Sep 17 00:00:00 2001
> From: "Ricardo G. Herdt" <[email-masked]>
> Date: Fri, 8 May 2020 01:37:24 +0200
> Subject: [PATCH] Fix hash-table-merge! bug.
>
> * module/srfi/srfi-69.scm : fold over second hash table.
> ---
>  module/srfi/srfi-69.scm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/module/srfi/srfi-69.scm b/module/srfi/srfi-69.scm
> index b9486c465..91bcc77db 100644
> --- a/module/srfi/srfi-69.scm
> +++ b/module/srfi/srfi-69.scm
> @@ -330,7 +330,7 @@ Answer the final F result."
>    "Add all key/value pairs from OTHER-HT to HT, overriding HT's
>  mappings where present.  Return HT."
>    (hash-table-fold
> -   ht (lambda (k v ign) (hash-table-set! ht k v)) #f)
> +   other-ht (lambda (k v ign) (hash-table-set! ht k v)) #f)
>    ht)
>  
>  ;;; srfi-69.scm ends here

Subject: Bug in hash-table-merge! (and patch)
From: "Ricardo G. Herdt" <[email-masked]>
To: [email-masked]
Date: Fri, 08 May 2020 01:50:01 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

I just found this bug in the hash-table-merge! function 
(modul/srfi/srfi-69.scm). Instead of merging both hash tables, it was 
ignoring one of them (other-ht). Attached is the fix, where it now folds 
over other-ht and store its data in ht.

Cheers,

Ricardo G. Herdt
From 180a9e14b807295aa31966a52bfd732647458ef9 Mon Sep 17 00:00:00 2001
From: "Ricardo G. Herdt" <[email-masked]>
Date: Fri, 8 May 2020 01:37:24 +0200
Subject: [PATCH] Fix hash-table-merge! bug.

* module/srfi/srfi-69.scm : fold over second hash table.
---
 module/srfi/srfi-69.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/module/srfi/srfi-69.scm b/module/srfi/srfi-69.scm
index b9486c465..91bcc77db 100644
--- a/module/srfi/srfi-69.scm
+++ b/module/srfi/srfi-69.scm
@@ -330,7 +330,7 @@ Answer the final F result."
   "Add all key/value pairs from OTHER-HT to HT, overriding HT's
 mappings where present.  Return HT."
   (hash-table-fold
-   ht (lambda (k v ign) (hash-table-set! ht k v)) #f)
+   other-ht (lambda (k v ign) (hash-table-set! ht k v)) #f)
   ht)
 
 ;;; srfi-69.scm ends here
-- 
2.20.1