GNU bug report logs - #56413
[PATCH 1/1] scm_i_utf8_string_hash: compute u8 chars not bytes

Previous Next

Package: guile;

Reported by: Rob Browning <rlb <at> defaultvalue.org>

Date: Wed, 6 Jul 2022 01:25:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Rob Browning <rlb <at> defaultvalue.org>
Cc: 56413 <at> debbugs.gnu.org
Subject: bug#56413: [PATCH v2 1/1] scm_i_utf8_string_hash: compute u8 chars not bytes
Date: Mon, 06 Mar 2023 17:39:10 +0100
Hi,

Rob Browning <rlb <at> defaultvalue.org> skribis:

> Noticed while investigating a migration to utf-8 strings.  After making
> changes that routed non-ascii symbol hashing through this function,
> encoding-iso88597.test began intermittently failing because it would
> traverse trailing garbage when u8_strnlen reported 8 chars instead of 4.
>
> Change the scm_i_str2symbol and scm_i_str2uninterned_symbol internal
> hash type to unsigned long to explicitly match the scm_i_string_hash
> result type.
>
> * libguile/hash.c (scm_i_utf8_string_hash): Call u8_mbsnlen not u8_strnlen.
> * libguile/symbols.c (scm_i_str2symbol, scm_i_str2uninterned_symbol):
> Use unsigned long for scm_i_string_hash result.
> * test-suite/standalone/.gitignore: Add test-hashing.
> * test-suite/standalone/Makefile.am: Add test-hashing.
> * test-suite/standalone/test-hashing.c: Add.

LGTM, thanks!

Please update ‘NEWS’ too, under a new “Bug fixes” heading.

Ludo’.




This bug report was last modified 2 years and 65 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.