Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Oct 2012 15:45:16 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   standards/172215: localeconv() grouping appears not to match POSIX
Message-ID:  <201210011545.q91FjGSc086482@freefall.freebsd.org>
Resent-Message-ID: <201210011550.q91Fo25F087104@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         172215
>Category:       standards
>Synopsis:       localeconv() grouping appears not to match POSIX
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 01 15:50:02 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Ed Maste
>Release:        FreeBSD 9.0-STABLE i386
>Organization:
FreeBSD
>Environment:
System: FreeBSD freefall.freebsd.org 9.0-STABLE FreeBSD 9.0-STABLE #6 r235139: Tue May 8 21:19:03 UTC 2012 simon@freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL i386

>Description:

I can find two references to the expected return from localeconv() for
grouping / mon_grouping.  First, the behaviour in SUSv2
http://pubs.opengroup.org/onlinepubs/007908799/xbd/locale.html matches what
FreeBSD currently does -- { CHAR_MAX, '\0' }:

  The third column shows the equivalent string in the ISO C standard that
  would be used by the localeconv() function to accommodate this grouping

  mon_grouping   Formatted Value   ISO C String
  -1             123456789         "\177" 

In 1003.1 (2004) for POSIX Locale
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html
it suggests that the return should be empty string:

               langinfo   POSIX Locale   localeconv()   localedef
Item           Constant      Value           Value        Value
mon_grouping       -          N/A             ""           -1

This came up on the gnulib mailing list recently, which has a testcase
for localeconv that contains #ifdef'd-out cases for l->grouping and
l->mon_gropuing on FreeBSD.

http://lists.gnu.org/archive/html/bug-gnulib/2012-08/msg00142.html

>How-To-Repeat:
	
>Fix:

I suspect this could be accomplished with the following patch:

Index: lib/libc/locale/fix_grouping.c
===================================================================
--- fix_grouping.c      (revision 240919)
+++ fix_grouping.c      (working copy)
@@ -31,7 +31,7 @@
 #include <limits.h>
 #include <stddef.h>
 
-static const char nogrouping[] = { CHAR_MAX, '\0' };
+static const char nogrouping[] = { '\0' };
 
 /*
  * Internal helper used to convert grouping sequences from string

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210011545.q91FjGSc086482>