unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: "Ricardo G. Herdt" <r.herdt@posteo.de>
Cc: 41131-done@debbugs.gnu.org
Subject: bug#41131: Bug in hash-table-merge! (and patch)
Date: Fri, 12 Mar 2021 22:32:38 +0100	[thread overview]
Message-ID: <87o8foxdl5.fsf@pobox.com> (raw)
In-Reply-To: <ff3f98118ceb25811284e08551ec3771@posteo.de> (Ricardo G. Herdt's message of "Fri, 08 May 2020 01:50:01 +0200")

Applied, thanks!

On Fri 08 May 2020 01:50, "Ricardo G. Herdt" <r.herdt@posteo.de> 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" <r.herdt@posteo.de>
> 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





      reply	other threads:[~2021-03-12 21:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 23:50 bug#41131: Bug in hash-table-merge! (and patch) Ricardo G. Herdt
2021-03-12 21:32 ` Andy Wingo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8foxdl5.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=41131-done@debbugs.gnu.org \
    --cc=r.herdt@posteo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).