11615 should handle locale charmap aliases

Review Request #2293 — Created Sept. 11, 2019 and submitted

yuripv
illumos-gate
master
11615
bc2d759...
general

Translate charmap aliases in libc.

$ locale
LANG=C
LC_CTYPE=C
LC_NUMERIC=C
LC_TIME=C
LC_COLLATE=C
LC_MONETARY=C
LC_MESSAGES=C
LC_ALL=C
$ LD_LIBRARY_PATH=~/ws/il11615/proto/root_i386/lib LC_ALL=en_US.utf8 locale
LANG=C
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=en_US.utf8
$ LD_LIBRARY_PATH=~/ws/il11615/proto/root_i386/lib LC_ALL=ru_RU.utf8 date
11 сентября 2019 г., 03:06:23 MSK
  • 0
  • 0
  • 1
  • 1
  • 2
Description From Last Updated
tsoome
  1. Ship It!
  2. 
      
yuripv
tsoome
  1. Ship It!
  2. 
      
yuripv
tsoome
  1. Ship It!
  2. 
      
rm
  1. 
      
  2. usr/src/lib/libc/port/locale/localeimpl.c (Diff revision 3)
     
     
     
    If the first half of the name doesn't fit, should we really try and continue using it in an alias construction?
    1. Oops, sorry, thought I had deleted this when I added the follow up.
  3. usr/src/lib/libc/port/locale/localeimpl.c (Diff revision 3)
     
     
     
     
     
     
     
    So in all of these, if we can't actually fit the full new name and we would instead end up truncating the resulting name somehow, shouldn't we not use it? For example, if someone passes us a rather long locale name, feels like we shouldn't just end up trying to load some partial name instead.
    1. I don't think it really matters, we could just break here instead, yes, if you prefer; I was just following what code above did. In any case, it's user problem if they supply us with bogus data :)

    2. I think it makes a bit more sense to break out when the user gives us bad data than transforming that bad data into something else bad, if we can. At least that way we can say, hey we don't know the locale rather than we have guessed your locale is something entirely different due to implicit truncation.
    3. Added check if new name won't fit.

  4. 
      
yuripv
rm
  1. Ship It!
  2. 
      
yuripv
Review request changed

Status: Closed (submitted)

Loading...