Project

General

Profile

Actions

Bug #2415

closed

setlocale() for unknown locales

Added by meand about 12 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Userland
Target version:
Start date:
08/30/2012
Due date:
% Done:

0%

Estimated time:

Description

The return value of setlocale() for LC_ALL deviates from implementations
found in FreeBSD, NetBSD, GNU libc and OpenSolaris. Other implementations
return NULL for unknown locales and the category LC_ALL, where instead
DragonflyBSD isresponding with the internal value list.

Thus an environment variable LC_ALL=fake produces

  1. setlocale(LC_ALL, "");
    C/C/fake/fake/fake/C
  1. setlocale(LC_CTYPE, "");
    (null)

The LC_ALL category is hiding the erroneous effect from the
invoking program, whereas the other categories are correctly
reporting their failures.

Actions #1

Updated by tuxillo over 10 years ago

  • Description updated (diff)
  • Category set to Userland
  • Assignee set to tuxillo
  • Target version set to 3.9.x

Hi,

Not sure if I've understood. In the case you pass the "locale" string to setlocale(3):

$ uname -a
DragonFly hammer.df.com 3.6-RELEASE DragonFly v3.6.0-RELEASE #8: Fri Nov 22 13:22:00 PST 2013 :/usr/obj/build/home/justin/src/sys/X86_64_GENERIC x86_64
$ ./t_locale
setlocale(LC_ALL, "es_ES.UTF-8")=es_ES.UTF-8
setlocale(LC_ALL, "en_EN.UTF-8")=(null)
setlocale(LC_ALL, "fake")=(null)
setlocale(LC_ALL, NULL)=es_ES.UTF-8

$ uname -a
DragonFly hammer.df.com 3.7-DEVELOPMENT DragonFly v3.7.1.1227.g566f1-DEVELOPMENT #1: Thu May 22 19:25:43 CEST 2014 root@:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64
$ ./t_locale1
setlocale(LC_ALL, "es_ES.UTF-8")=es_ES.UTF-8
setlocale(LC_ALL, "en_EN.UTF-8")=(null)
setlocale(LC_ALL, "fake")=(null)
setlocale(LC_ALL, NULL)=es_ES.UTF-8

root@testfbsd:/root # uname -a
FreeBSD testfbsd 9.1-RELEASE-p10 FreeBSD 9.1-RELEASE-p10 #0: Sun Jan 12 20:11:23 UTC 2014 :/usr/obj/usr/src/sys/GENERIC amd64
root@testfbsd:/root # cc t_locale.c -o t_locale
root@testfbsd:/root # ./t_locale
setlocale(LC_ALL, "es_ES.UTF-8")=es_ES.UTF-8
setlocale(LC_ALL, "en_EN.UTF-8")=(null)
setlocale(LC_ALL, "fake")=(null)
setlocale(LC_ALL, NULL)=es_ES.UTF-8

In the case of using "" as locale:

DFly:
$ ./t_locale1
setlocale(LC_ALL, "")=(null)
$ echo $LC_ALL
fake

FreBSD 9.1:
root@testfbsd:/root # ./t_locale
setlocale(LC_ALL, "")=(null)
root@testfbsd:/root # echo $LC_ALL
fake

I hope I'm not misunderstanding what you just said.

Best regards,
Antonio Huete

Actions #2

Updated by meand over 10 years ago

Your reading of my message was correct, but with a probability close to certainty
this issue was inadvertedly amended in commit 0d5acd74 by John Marino, whose commit
touched also the file "lib/libc/locale/setlocale.c".

For reference, the behaviour of 3.4 and 3.9:

$ uname -v
DragonFly v3.9.0.33.g96b40-DEVELOPMENT ...

setlocale(LC_ALL, "fake") = NULL

and identically for LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY,
LC_NUMERIC and LC_TIME.

$ uname -v
DragonFly v3.4.3-RELEASE ...

setlocale(LC_ALL, "fake") = "C/C/fake/fake/fake/C"

setlocale(LC_MONETARY, "fake") = "fake"
setlocale(LC_NUMERIC, "fake") = "fake"
setlocale(LC_TIME, "fake") = "fake"

but the correct value NULL is passed for LC_COLLATE, LC_CTYPE, LC_MESSAGES.

I must conclude that the issue #2415 can be closed for the current
development branch.

Best regards,
Mats Erik Andersson

Actions #3

Updated by tuxillo over 10 years ago

  • Status changed from New to Closed

Confirmed as fixed.

Actions

Also available in: Atom PDF