Copyright © 2006 IEEE. All rights reserved.
Interpretation Number: 021
Topic: locale
Relevant Sections: STDOUTThe Shell and Utilities Volume of IEEE Std 1003.1-2001
------------------------------------------------------------------------
8 Qualifier (e.g. error, omission, clarification required):
3. Clarification required
------------------------------------------------------------------------
9 References in document (e.g. page, clause, figure, and/or table numbers):
Edition of Specification (Year): 2003 Page: 554 Line: 21345 Section: locale STDOUT
Reference XCU Latest ERN 15
------------------------------------------------------------------------
10 Nature of defect (complete, concise explanation of the perceived problem):
( Page: 554 Line: 21345 Section: locale STDOUT 2003 Ed)
There's an unclarity in the STDOUT section of the "setlocale" utility: http://www.opengroup.org/onlinepubs/007904975/utilities/locale.html Here's the relevant text: If locale is invoked without any options or operands, the names and values of the LANG and LC_* environment variables described in this volume of IEEE Std 1003.1-2001 shall be written to the standard output, one variable per line, with LANG first, and each line using the following format. Only those variables set in the environment and not overridden by LC_ALL shall be written using this format:
"%s=%s\n", <variable_name>, <value>
The names of those LC_* variables associated with locale categories< defined in this volume of IEEE Std 1003.1-2001 that are not set in the environment or are overridden by LC_ALL shall be written in the following format:
"%s=\"%s\"\n", <variable_name>, <implied value>
It is unclear should the value of LANG be output if it's not set in the environment, or if both LANG and LC_ALL are set in the environment, and it's unclear which format should be used to output LANG.
------------------------------------------------------------------------
11 Solution proposed by the submitter (optional):
After some research on different operating systems, I think the intent is to always output the value of the LANG variable (even if unset), regardless of whether LC_ALL is set or not, using the first format.
I suggest to change the text as follows:
If locale is invoked without any options or operands, the names and values of the LANG and LC_* environment variables described in this volume of IEEE Std 1003.1-2001 shall be written to the standard output, one variable per line, with LANG first, and each line using the following format.
The LANG variable, and only those LC_* variables set in the environment and not overridden by LC_ALL shall be written using this format:
"%s=%s\n", <variable_name>, <value>
If LANG is not set, it shall be written as:
"LANG=\n"
The names of those LC_* variables associated with locale categories defined in this volume of IEEE Std 1003.1-2001 that are not set in the environment or are overridden by LC_ALL shall be written in the following format:
"%s=\"%s\"\n", <variable_name>, <implied value>
------------------------------------------------------------------------
Interpretation response ------------------------
The standard is unclear on this issue about LANG when it has no value, and no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.
Rationale:
None.
Back to IEEE Standards Interpretations for IEEE Std 1003.1-2001