Debian Bug report logs - #284260
manpages-dev: wcrtomb function returns incorrect value

Package: glibc; Maintainer for glibc is (unknown);

Reported by: dickey@his.com

Date: Sun, 5 Dec 2004 00:18:01 UTC

Severity: normal

Tags: upstream

Done: Aurelien Jarno <aurelien@aurel32.net>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#284260; Package glibc. Full text and rfc822 format available.

Acknowledgement sent to dickey@his.com:
New Bug report received and forwarded. Copy sent to GNU Libc Maintainers <debian-glibc@lists.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Thomas Dickey <tom@invisible-island.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: glibc: wcrtomb function returns incorrect value
Date: Sat, 04 Dec 2004 19:03:04 -0500
Package: glibc
Severity: normal


see the manpage - it says this (and the code behaves that way). But that is
incorrect.  The standard behavior does not ignore the wc parameter when s is
NULL:

       A  third  case  is  when s is NULL. In this case wc is ignored, and the
       function effectively returns  wcrtomb(buf,L'\0',ps)  where  buf  is  an
       internal anonymous buffer.

(And because it's used in ncursesw, that breaks some things that I'll have
to work around ;-)

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.27-td2
Locale: LANG=C, LC_CTYPE=C



Information forwarded to debian-bugs-dist@lists.debian.org, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#284260; Package glibc. Full text and rfc822 format available.

Acknowledgement sent to GOTO Masanori <gotom@debian.or.jp>:
Extra info received and forwarded to list. Copy sent to GNU Libc Maintainers <debian-glibc@lists.debian.org>. Full text and rfc822 format available.

Message #10 received at 284260@bugs.debian.org (full text, mbox):

From: GOTO Masanori <gotom@debian.or.jp>
To: dickey@his.com, 284260@bugs.debian.org
Cc: control@bugs.debian.org, Thomas Dickey <tom@invisible-island.net>
Subject: Re: Bug#284260: glibc: wcrtomb function returns incorrect value
Date: Wed, 26 Jan 2005 23:23:24 +0900
reassign 284260 manpages-dev
retitle 284260 wcrtomb function returns incorrect value
thanks

At Sat, 04 Dec 2004 19:03:04 -0500,
Thomas Dickey wrote:
> Package: glibc
> Severity: normal
> 
> seethe manpage - it says this (and the code behaves that way). But that is
> incorrect.  The standard behavior does not ignore the wc parameter when s is
> NULL:
> 
>        A  third  case  is  when s is NULL. In this case wc is ignored, and the
>        function effectively returns  wcrtomb(buf,L'\0',ps)  where  buf  is  an
>        internal anonymous buffer.
> 
> (And because it's used in ncursesw, that breaks some things that I'll have
> to work around ;-)

Glibc does not provide such manpage.  I reassigned it to manpages-dev.

Regards,
-- gotom



Bug reassigned from package `glibc' to `manpages-dev'. Request was from GOTO Masanori <gotom@debian.or.jp> to control@bugs.debian.org. Full text and rfc822 format available.

Changed Bug title. Request was from GOTO Masanori <gotom@debian.or.jp> to control@bugs.debian.org. Full text and rfc822 format available.

Message sent on to dickey@his.com:
Bug#284260. Full text and rfc822 format available.

Message #17 received at 284260-submitter@bugs.debian.org (full text, mbox):

From: Thomas Dickey <dickey@his.com>
To: 284260-submitter@bugs.debian.org
Subject: Re: Bug#284260: glibc: wcrtomb function returns incorrect value
Date: Wed, 26 Jan 2005 09:54:05 -0500 (EST)
On Wed, 26 Jan 2005, GOTO Masanori wrote:

> reassign 284260 manpages-dev
> retitle 284260 wcrtomb function returns incorrect value
> thanks
>
> At Sat, 04 Dec 2004 19:03:04 -0500,
> Thomas Dickey wrote:
>> Package: glibc
>> Severity: normal
>>
>> seethe manpage - it says this (and the code behaves that way). But that is
>> incorrect.  The standard behavior does not ignore the wc parameter when s is
>> NULL:
>>
>>        A  third  case  is  when s is NULL. In this case wc is ignored, and the
>>        function effectively returns  wcrtomb(buf,L'\0',ps)  where  buf  is  an
>>        internal anonymous buffer.
>>
>> (And because it's used in ncursesw, that breaks some things that I'll have
>> to work around ;-)
>
> Glibc does not provide such manpage.  I reassigned it to manpages-dev.

The function, which is incorrect, is part of glibc.  This is not simply
a documentation problem.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net



Bug reassigned from package `manpages-dev' to `manpages-dev,glibc'. Request was from Justin Pryzby <justinpryzby@users.sourceforge.net> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#284260; Package manpages-dev,glibc. Full text and rfc822 format available.

Acknowledgement sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>, GNU Libc Maintainers <debian-glibc@lists.debian.org>. Full text and rfc822 format available.

Message #24 received at 284260@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: 284260@bugs.debian.org
Subject: clone
Date: Tue, 20 Dec 2005 20:20:32 -0500
clone 284260 -1
reassign -1 manpages-dev
reassign 284260 glibc
retitle 284260 glibc: wcrtomb function returns incorrect value
retitle 284260 manpages-dev: wcrtomb function returns incorrect value
tag 284260 upstream
thanks

glibc apparently needs to change its code, and manpages-dev needs to
document the old behaviour, and the new behaviour too, when its
implemented.

-- 
Clear skies,
Justin



Bug 284260 cloned as bug 344232. Request was from Justin Pryzby <justinpryzby@users.sourceforge.net> to control@bugs.debian.org. Full text and rfc822 format available.

Bug reassigned from package `manpages-dev,glibc' to `glibc'. Request was from Justin Pryzby <justinpryzby@users.sourceforge.net> to control@bugs.debian.org. Full text and rfc822 format available.

Changed Bug title. Request was from Justin Pryzby <justinpryzby@users.sourceforge.net> to control@bugs.debian.org. Full text and rfc822 format available.

Changed Bug title. Request was from Justin Pryzby <justinpryzby@users.sourceforge.net> to control@bugs.debian.org. Full text and rfc822 format available.

Tags added: upstream Request was from Justin Pryzby <justinpryzby@users.sourceforge.net> to control@bugs.debian.org. Full text and rfc822 format available.

Reply sent to Aurelien Jarno <aurelien@aurel32.net>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to dickey@his.com:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #39 received at 284260-done@bugs.debian.org (full text, mbox):

From: Aurelien Jarno <aurelien@aurel32.net>
To: Thomas Dickey <dickey@his.com>
Cc: 284260-done@bugs.debian.org
Subject: Re: Bug#284260: glibc: wcrtomb function returns incorrect value
Date: Sun, 27 Aug 2006 20:15:14 +0200
On Wed, Jan 26, 2005 at 09:54:05AM -0500, Thomas Dickey wrote:
> On Wed, 26 Jan 2005, GOTO Masanori wrote:
> 
> >reassign 284260 manpages-dev
> >retitle 284260 wcrtomb function returns incorrect value
> >thanks
> >
> >At Sat, 04 Dec 2004 19:03:04 -0500,
> >Thomas Dickey wrote:
> >>Package: glibc
> >>Severity: normal
> >>
> >>seethe manpage - it says this (and the code behaves that way). But that is
> >>incorrect.  The standard behavior does not ignore the wc parameter when s 
> >>is
> >>NULL:
> >>
> >>       A  third  case  is  when s is NULL. In this case wc is ignored, 
> >>       and the
> >>       function effectively returns  wcrtomb(buf,L'\0',ps)  where  buf  
> >>       is  an
> >>       internal anonymous buffer.
> >>
> >>(And because it's used in ncursesw, that breaks some things that I'll have
> >>to work around ;-)
> >
> >Glibc does not provide such manpage.  I reassigned it to manpages-dev.
> 
> The function, which is incorrect, is part of glibc.  This is not simply
> a documentation problem.
> 

Both the documentation and the code are correct, see the corresponding 
POSIX definition below (page 1658). It clearly says that when s is NULL,
the function shall return wcrtomb(buf, L'\0', ps), which mean wc is
ignored.

I am therefore closing the bug.

|       NAME
| 50238
|             wcrtomb -- convert a wide-character code to a character (restartable)
| 50239
|       SYNOPSIS
| 50240
|             #include <stdio.h>
| 50241
|             size_t wcrtomb(char *restrict s, wchar_t wc, mbstate_t *restrict ps);
| 50242
| 50243 DESCRIPTION
|             The functionality described on this reference page is aligned with the ISO C standard.           Any
| 50244 CX
|             conflict between the requirements described here and the ISO C standard is unintentional.        This
| 50245
|             volume of IEEE Std 1003.1-2001 defers to the ISO C standard.
| 50246
|             If s is a null pointer, the wcrtomb( ) function shall be equivalent to the call:
| 50247
|             wcrtomb(buf, L'\0', ps)
| 50248
|             where buf is an internal buffer.
| 50249
|             If s is not a null pointer, the wcrtomb( ) function shall determine the number of bytes needed to
| 50250
|             represent the character that corresponds to the wide character given by wc (including any shift
| 50251
|             sequences), and store the resulting bytes in the array whose first element is pointed to by s. At
| 50252
|             most {MB_CUR_MAX} bytes are stored. If wc is a null wide character, a null byte shall be stored,
| 50253
|             preceded by any shift sequence needed to restore the initial shift state. The resulting state
| 50254
|             described shall be the initial conversion state.
| 50255
|             If ps is a null pointer, the wcrtomb( ) function shall use its own internal mbstate_t object, which is
| 50256
|             initialized at program start-up to the initial conversion state. Otherwise, the mbstate_t object
| 50257
|             pointed to by ps shall be used to completely describe the current conversion state of the
| 50258
|             associated character sequence. The implementation shall behave as if no function defined in this
| 50259
|             volume of IEEE Std 1003.1-2001 calls wcrtomb( ).
| 50260
|             If the application uses any of the _POSIX_THREAD_SAFE_FUNCTIONS or _POSIX_THREADS
| 50261 CX
|             functions, the application shall ensure that the wcrtomb( ) function is called with a non-NULL ps
| 50262
|             argument.
| 50263
|             The behavior of this function shall be affected by the LC_CTYPE category of the current locale.
| 50264
|       RETURN VALUE
| 50265
|             The wcrtomb( ) function shall return the number of bytes stored in the array object (including any
| 50266
|             shift sequences). When wc is not a valid wide character, an encoding error shall occur. In this
| 50267
|             case, the function shall store the value of the macro [EILSEQ] in errno and shall return (size_t)-1;
| 50268
|             the conversion state shall be undefined.


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net



Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 18 Jun 2007 11:00:22 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 18:43:05 2014; Machine Name: beach.debian.org

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