standards/172215: localeconv() grouping appears not to match POSIX

Ed Maste emaste at
Mon Oct 1 15:50:02 UTC 2012

>Number:         172215
>Category:       standards
>Synopsis:       localeconv() grouping appears not to match POSIX
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 01 15:50:02 UTC 2012
>Originator:     Ed Maste
>Release:        FreeBSD 9.0-STABLE i386
System: FreeBSD 9.0-STABLE FreeBSD 9.0-STABLE #6 r235139: Tue May 8 21:19:03 UTC 2012 simon at i386


I can find two references to the expected return from localeconv() for
grouping / mon_grouping.  First, the behaviour in SUSv2 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
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.


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


More information about the freebsd-standards mailing list