Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000302 [1003.1(2008)/Issue 7] Base Definitions and Headers Objection Error 2010-08-05 13:46 2013-04-16 13:06
Reporter geoffclare View Status public  
Assigned To ajosey
Priority normal Resolution Accepted  
Status Closed  
Name Geoff Clare
Organization The Open Group
User Reference
Section 7.1
Page Number 135
Line Number 3820-3822
Interp Status Approved
Final Accepted Text See Note: 0000558
Summary 0000302: Changes needed to account for uselocale()
Description The introduction of uselocale() and per-thread locales has an
effect on many other parts of the standard. Unfortunately a large
number of those parts have not been updated to take account of
that effect. For example there are still uses of "locale of the
process" and similar, and parts that only refer to setlocale()
when discussing locales. In particular XBD 7.1 says:

    The behavior of some of the C-language functions defined in the
    System Interfaces volume of POSIX.1-2008 shall also be modified
    based on the current locale, as defined by the last call to
    setlocale().

Some of these places (those that use the word "process" or refer only
to setlocale()) contradict the description of uselocale() where it
says:

    Once the uselocale() function has been called to install a
    thread-local locale, the behavior of every interface using data
    from the current locale shall be affected for the calling thread.

Other places in need of updating represent less serious problems and
the suggested changes mainly attempt to clarify the whole subject of
locale selection.

Desired Action At page 127 line 3583 section 6.1 change

    if an application accesses any pair of locales where the character
    encodings differ, or accesses data from an application running in
    a locale which has different encodings from the application's
    current locale, the results are unspecified.

to

    if an application uses any pair of locales where the character
    encodings differ, or accesses data from an application using
    a locale which has different encodings from the locales used by
    the application, the results are unspecified.

At page 135 line 3820 section 7.1 change

    The behavior of some of the C-language functions defined in the
    System Interfaces volume of POSIX.1-2008 shall also be modified
    based on the current locale, as defined by the last call to
    setlocale().

to

    The behavior of some of the C-language functions defined in the
    System Interfaces volume of POSIX.1-2008 shall also be modified
    based on a locale selection. The locale to be used by these
    functions can be selected in the following ways:

    1. For functions such as isalnum_l() that take a locale object
       as an argument, a locale object can be obtained from newlocale()
       or duplocale() and passed to the function.

    2. For functions that do not take a locale object as an argument,
       the current locale for the thread can be set by calling
       uselocale() or the global locale for the process can be set by
       calling setlocale(). Such functions shall use the current
       locale of the calling thread if one has been set for that
       thread, otherwise they shall use the global locale.

At page 135 line 3839 section 7.1 change

    Applications can select the desired locale by invoking the
    setlocale() function (or equivalent) with the appropriate value.
    If the function is invoked with an empty string, such as:

    setlocale(LC_ALL, "");

    the value of the corresponding environment variable is used.

to

    Applications can select the desired locale by calling the
    newlocale() or setlocale() function with the appropriate value.
    If the function is invoked with an empty string, such as:

    newlocale(LC_ALL_MASK, "", (locale_t)0);

    or

    setlocale(LC_ALL, "");

    the value of the corresponding environment variable is used.
    
At page 177 line 5636 section 8.2 change

    At runtime, these values are bound to the locale of a process by
    calling the setlocale() function

to

    These environment variables are used by the newlocale() and
    setlocale() functions, and by the standard utilities.

Cross-volume changes to XSH...

At page 779 line 25987 section exec change

    Applications that require other than the default POSIX locale
    should call setlocale() with the appropriate parameters to
    establish the locale of the new process.

to

    Applications that require other than the default POSIX locale
    as the global locale in the new process image should call
    setlocale() with the appropriate parameters.

At page 894 line 29763 section fprintf change

    the process' locale

to

    the current locale

At page 929 line 31097 section fscanf,
page 973 line 32590 section fwprintf,
page 983 line 32955 section fwscanf,
page 1375 line 45090 section nl_langinfo,
page 2004 line 63413 section strfmon,
page 2036 line 64492 section strtod,
page 2052 line 64969 section strxfrm,
page 2131 line 67442 section towlower,
page 2133 line 67491 section towupper,
page 2224 line 69988 section wcstod,
page 2242 line 70463 section wcsxfrm,
page 2243 line 70486 section wcsxfrm,
page 2247 line 70616 section wctrans,
page 2249 line 70672 section wctype change

    the locale of the process

to

    the current locale

At page 1135 line 37918 section isalnum,
page 1137 line 37961 section isalpha,
page 1142 line 38097 section isblank,
page 1143 line 38138 section iscntrl,
page 1145 line 38181 section isdigit,
page 1148 line 38254 section isgraph,
page 1156 line 38515 section islower,
page 1160 line 38666 section isprint,
page 1162 line 38709 section ispunct,
page 1164 line 38752 section isspace,
page 1167 line 38833 section isupper,
page 1169 line 38876 section iswalnum,
page 1171 line 38924 section iswalpha,
page 1173 line 38972 section iswblank,
page 1174 line 39013 section iswcntrl,
page 1178 line 39147 section iswdigit,
page 1180 line 39195 section iswgraph,
page 1182 line 39243 section iswlower,
page 1184 line 39291 section iswprint,
page 1186 line 39339 section iswpunct,
page 1188 line 39387 section iswspace,
page 1190 line 39435 section iswupper,
page 1192 line 39483 section iswxdigit,
page 1194 line 39531 section isxdigit,
page 1985 line 62813 section strcasecmp,
page 2129 line 67386 section towctrans,
page 2202 line 69364 section wcscoll
change

    current locale of the process

to

    current locale

At page 1156 line 38530 section islower change

    the locale of the user

to

    the current locale

At page 1601 line 51456 section pthread_create change

    [XSI]The alternate stack shall not be inherited.[/XSI]

to

    The thread-local current locale [XSI]and the alternate stack[/XSI]
    shall not be inherited.

At page 1868 line 59590 section setlocale change

    The setlocale() function selects the appropriate piece of the
    locale of the process, as specified by the category and locale
    arguments, and may be used to change or query the entire locale of
    the process or portions thereof. The value LC_ALL for category
    names the entire locale of the process; other values for category
    name only a part of the locale of the process:

to

    The setlocale() function selects the appropriate piece of the
    global locale, as specified by the category and locale
    arguments, and can be used to change or query the entire global
    locale or portions thereof. The value LC_ALL for category
    names the entire global locale; other values for category
    name only a part of the global locale:

At page 1868 line 59608 section setlocale change

    If setlocale() is not invoked, the POSIX locale is the default
    at entry to main().

to

    The POSIX locale is the default global locale at entry to main().

At page 1868 line 59615 section setlocale change

    Used to direct setlocale() to query the current internationalized
    environment and return the name of the locale.

to

    Directs setlocale() to query the current global locale setting
    and return the name of the locale if category is not LC_ALL, or
    a string which encodes the locale name(s) for all of the
    individual categories if category is LC_ALL.

At page 1868 line 59617 section setlocale change

    Setting all of the categories of the locale of the process is
    similar to successively setting each individual category of the
    locale of the process, except that all error checking is done
    before any actions are performed. To set all the categories of the
    locale of the process, setlocale() is invoked as:

to

    Setting all of the categories of the global locale is
    similar to successively setting each individual category of the
    global locale, except that all error checking is done
    before any actions are performed. To set all the categories of the
    global locale, setlocale() can be invoked as:

At page 1869 line 59625 section setlocale change

    the locale of the process
    
to

    the global locale

At page 1869 line 59629 section setlocale change

    The locale state is common to all threads within a process.

to

    [CX]The global locale established using setlocale() shall only
    be used in threads for which no current locale has been set using
    uselocale() or whose current locale has been set to the global
    locale using uselocale(LC_GLOBAL_LOCALE).[/CX]

At page 1869 line 59632 section setlocale change

    the locale of the process is not changed
    
to

    the global locale shall not be changed

At page 1869 line 59634 section setlocale change

    A null pointer for locale causes setlocale() to return a pointer
    to the string associated with the category for the current locale
    of the process. The locale of the process shall not be changed.

to

    A null pointer for locale shall cause setlocale() to return a
    pointer to the string associated with the specified category for
    the current global locale. The global locale shall not be changed.

At page 1869 line 59637 section setlocale,
page 1869 line 59645 section setlocale change

    the locale of the process
    
to

    the global locale

At page 1869 line 59649 section setlocale change

    Internationalized programs must call setlocale() to initiate a
    specific language operation. This can be done by calling
    setlocale() as follows:

to

    Internationalized programs can initiate language operation
    according to environment variable settings (see [xref to XBD 8.2])
    by calling setlocale() as follows:

At page 1869 line 59655 section setlocale insert a new paragraph
at the beginning of the RATIONALE section

    References to the international environment or locale in the
    following text relate to the global locale for the process.
    This can be overridden for individual threads using uselocale().

Cross-volume changes to XRAT...

At page 3468 line 116554 section A.8.2 change

    the locale of the process
    
to

    the global locale

Tags tc1-2008
Attached Files

- Relationships
related to 0000582Closedajosey uselocale(0) is poorly specified 

-  Notes
(0000521)
geoffclare (manager)
2010-08-05 15:25
edited on: 2010-08-12 10:21

On reflection the change proposed for XBD 6.1 might not be appropriate.

I had in mind the concurrent use of locales with encodings such as Latin1 and UTF-8, but these have the same encodings for the portable character set.

Update (2010-08-12): I have updated the description and desired action such that XBD 6.1 is just treated as the same type of problem as the others.

(0000558)
nick (manager)
2010-09-23 15:42

Interpretation response
------------------------
The standard is unclear on this issue, and no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.

Rationale:
-------------
These changes were overlooked during the revision when per-thread locales were added.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
See Desired Action above.
(0000597)
ajosey (manager)
2010-11-04 14:48

Interpretation proposed. Comments due back by December 4th 2010

- Issue History
Date Modified Username Field Change
2010-08-05 13:46 geoffclare New Issue
2010-08-05 13:46 geoffclare Status New => Under Review
2010-08-05 13:46 geoffclare Assigned To => ajosey
2010-08-05 13:46 geoffclare Name => Geoff Clare
2010-08-05 13:46 geoffclare Organization => The Open Group
2010-08-05 13:46 geoffclare Section => 7.1
2010-08-05 13:46 geoffclare Page Number => 135
2010-08-05 13:46 geoffclare Line Number => 3820-3822
2010-08-05 13:46 geoffclare Interp Status => ---
2010-08-05 15:25 geoffclare Note Added: 0000521
2010-08-12 10:19 geoffclare Description Updated
2010-08-12 10:19 geoffclare Desired Action Updated
2010-08-12 10:21 geoffclare Note Edited: 0000521
2010-09-23 15:42 nick Note Added: 0000558
2010-09-23 15:44 nick Final Accepted Text => See Note: 0000558
2010-09-23 15:44 nick Status Under Review => Interpretation Required
2010-09-23 15:44 nick Resolution Open => Accepted
2010-09-23 15:45 nick Interp Status --- => Pending
2010-09-23 15:48 nick Tag Attached: tc1-2008
2010-11-04 14:48 ajosey Interp Status Pending => Proposed
2010-11-04 14:48 ajosey Note Added: 0000597
2010-11-29 10:47 geoffclare Desired Action Updated
2010-12-09 16:24 ajosey Interp Status Proposed => Approved
2012-06-28 20:03 eblake Relationship added related to 0000582
2013-04-16 13:06 ajosey Status Interpretation Required => Closed


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker