This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix libstdc++/7811


> I'm unsure about the following points: in case LC_ALL is not set is the 
> fallback to LANG  really needed (PR submitter implicitly expected this 
> to be the case)? Also, if neither are set is always correct that "" -> "C"?

The standards specify looking at LC_ALL, then at the variable for the 
particular category if setting just one, then at LANG.  Note that a variable
that is present but empty (e.g. getenv("LC_ALL") => "") is treated as not
present.  Off hand I am not sure if the behavior when none are set is
specified or is implementation-defined.  Defaulting to "C" is safe and
consistent.

Another thing to note if you want to match the selection behavior of
setlocale is that if the name contains a slash and the program is setuid
then the name will be ignored and "C" used instead.  (It doesn't check
this on each variable, just on the name chosen from any.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]