NetBSD Problem Report #58618

From www@netbsd.org  Mon Aug 19 12:27:07 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C15A91A923F
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 19 Aug 2024 12:27:07 +0000 (UTC)
Message-Id: <20240819122706.AE2A61A9242@mollari.NetBSD.org>
Date: Mon, 19 Aug 2024 12:27:06 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: mbrtocN(3) fails to keep shift state
X-Send-Pr-Version: www-1.0

>Number:         58618
>Category:       lib
>Synopsis:       mbrtocN(3) fails to keep shift state
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 19 12:30:00 +0000 2024
>Last-Modified:  Tue Aug 20 17:45:02 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The mbrtoNetBSD Foundation
>Environment:
>Description:
I drafted mbrtoc8, mbrtoc16, and mbrtoc32 last week for C11/C23 compliance, but the way I did it fails to keep state to process shift sequences incrementally, as in, e.g., ISO-2022-JP.
>How-To-Repeat:
Process a shift sequence like ESC ( J, and then process subsequent input under the assumption of that shift sequence.
>Fix:
Yes, please!

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58618 CVS commit: src/tests/lib/libc/locale
Date: Mon, 19 Aug 2024 16:24:05 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Aug 19 16:24:05 UTC 2024

 Modified Files:
 	src/tests/lib/libc/locale: t_mbrtoc16.c t_mbrtoc8.c

 Log Message:
 mbrtoc8(3), mbrtoc16(3): Test consuming shift sequences with state.

 This has the side effect of testing mbrtoc32(3) because they are both
 defined in terms of it.

 PR lib/58618: mbrtocN(3) fails to keep shift state


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/locale/t_mbrtoc16.c \
     src/tests/lib/libc/locale/t_mbrtoc8.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58618 CVS commit: src
Date: Tue, 20 Aug 2024 17:43:10 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Aug 20 17:43:09 UTC 2024

 Modified Files:
 	src/lib/libc/locale: mbrtoc32.c mbrtoc32.h
 	src/tests/lib/libc/locale: t_mbrtoc16.c t_mbrtoc8.c

 Log Message:
 mbrtoc32(3): Use conversion state to handle shift sequences.

 PR lib/58618: mbrtocN(3) fails to keep shift state


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 src/lib/libc/locale/mbrtoc32.c
 cvs rdiff -u -r1.1 -r1.2 src/lib/libc/locale/mbrtoc32.h
 cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/locale/t_mbrtoc16.c \
     src/tests/lib/libc/locale/t_mbrtoc8.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58618 CVS commit: src/lib/libc/locale
Date: Tue, 20 Aug 2024 17:43:24 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Aug 20 17:43:24 UTC 2024

 Modified Files:
 	src/lib/libc/locale: mbrtoc32.c

 Log Message:
 mbrtoc32(3): Fix name and type of mbrtowc_l return value.

 This was from `int mbtowc_l(...)' in an earlier draft and I didn't
 update it to size_t when I changed the draft to mbrtowc_l.  Caught by
 lint.

 `mb_len' avoids (harmless) clash with standard C function mblen(3).

 PR lib/58618: mbrtocN(3) fails to keep shift state


 To generate a diff of this commit:
 cvs rdiff -u -r1.8 -r1.9 src/lib/libc/locale/mbrtoc32.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.