Bug #153

date(1) output doesn't obey locale setting

Added by antencek almost 9 years ago. Updated 3 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:marino% Done:

0%

Category:Userland
Target version:4.2.x

Description

Hello all.

I am wondering if anyone else got this problem.

I was trying different locale settings and tested it with date output.

For the selected locale sl_SI.ISO8859-2 the right date output is:
Pon 24 Apr 2006 13:52:17 CEST (weekday name of the day is Pon as
abbreviated Ponedeljek).

It seems like something about locale got broken between 1.2.6-RELEASE
and 1.4.3-RELEASE+.

There are my tests:

root@SRV# uname -a
DragonFly hostname 1.2.5-RELEASE DragonFly 1.2.5-RELEASE #1: Fri Aug 26
10:53:30 CEST 2005
root@hostname:/usr/obj/usr/src-stable-20050617/sys/SRV i386
root@SRV# echo $SHELL
/bin/tcsh
root@SRV# ls /usr/share/locale/ | grep -i sl_si
sl_SI.ISO8859-2
sl_SI.ISO_8859-2
sl_SI.UTF-8
root@SRV# setenv LC_ALL sl_SI.ISO_8859-2
root@SRV# date
Pon 24 Apr 2006 13:52:17 CEST
---> above OK <---

root@www# uname -a
DragonFly hostname 1.2.6-RELEASE DragonFly 1.2.6-RELEASE #1: Wed Oct 26
10:26:58 CEST 2005 root@hostname:/usr/obj/usr/src/sys/WWW i386
root@www# echo $SHELL
/bin/tcsh
root@www# ls /usr/share/locale/ | grep -i sl_si
sl_SI.ISO8859-2
sl_SI.ISO_8859-2
sl_SI.UTF-8
root@www# setenv LC_ALL sl_SI.ISO_8859-2
root@www# date
Pon 24 Apr 2006 13:48:46 CEST
---> above OK <---

root@web# uname -a
FreeBSD hostname 4.11-STABLE FreeBSD 4.11-STABLE #0: Sun Oct 9 00:32:20
CEST 2005 root@hostname:/usr/obj/usr/src/sys/WEB i386
root@web# echo $SHELL
/bin/csh
root@web# ls /usr/share/locale/ | grep -i sl_si
sl_SI.ISO8859-2
sl_SI.ISO_8859-2
root@web# setenv LC_ALL sl_SI.ISO_8859-2
root@web# date
Pon 24 Apr 2006 13:50:47 CEST
---> above OK <---

> uname -a
FreeBSD hostname 5.2.1-RELEASE-p13 FreeBSD 5.2.1-RELEASE-p13 #0: Wed Dec
29 00:40:10 CET 2004
root@hostname:/usr/obj/usr/src-5.2.1-latest/sys/HOST i386
> echo $SHELL
/bin/tcsh
> ls /usr/share/locale/ | grep -i sl_si
sl_SI.ISO8859-2
sl_SI.ISO_8859-2
> setenv LC_ALL sl_SI.ISO_8859-2
> date
Pon 24 Apr 2006 13:55:24 CEST
---> above OK <---

root@web1# uname -a
DragonFly hostname 1.4.3-RELEASE DragonFly 1.4.3-RELEASE #0: Wed Apr 12
23:50:27 CEST 2006 root@hostname:/usr/obj/usr/src/sys/DRAGONFLY i386
root@web1# echo $SHELL
/bin/tcsh
root@web1# ls /usr/share/locale/ | grep -i sl_si
sl_SI.ISO8859-2
sl_SI.ISO_8859-2
sl_SI.UTF-8
root@web1# setenv LC_ALL sl_SI.ISO_8859-2
root@web1# date
Mon Apr 24 13:53:18 CEST 2006
---> above NOT OK <---

root@web3# uname -a
DragonFly hostname 1.5.3-PREVIEW DragonFly 1.5.3-PREVIEW #0: Mon Apr 24
13:44:27 GMT 2006 root@hostname:/usr/obj/usr/src/sys/GENERIC i386
root@web3# echo $SHELL
/bin/csh
root@web3# ls /usr/share/locale/ | grep -i sl_SI
sl_SI.ISO8859-2
sl_SI.ISO_8859-2
sl_SI.UTF-8
root@web3# setenv LC_ALL sl_SI.ISO8859-2
root@web3# date
Mon Apr 24 14:25:27 GMT 2006
---> above NOT OK <---

History

#1 Updated by joerg almost 9 years ago

On Mon, Apr 24, 2006 at 09:17:49PM +0100, Stefan Krüger wrote:
> Tomaž Borštnar wrote:
> >Sascha Wildner pravi:
> >> wrote:
> >>>On Mon, Apr 24, 2006 at 02:31:31PM +0200, Tomas wrote:
> >>>>I am wondering if anyone else got this problem.
> >>>>
> >>>>I was trying different locale settings and tested it with date output.
> >>>
> >>>/me mumbles something about forgotten unfinished work and crawls back to
> >>>pkgsrc work.
> >>
> >>What about fixing it?
> >
> >how can we help?

Contact me off-list if you want to implement it. Relatively easy task,
it just got lost.

> sync dragonfly's citrus-code with netbsd's

No, that doesn't help.

Joerg

#2 Updated by tuxillo almost 7 years ago

Seems still broken?

> uname -a
DragonFly builder. 1.12.0-RELEASE DragonFly 1.12.0-RELEASE #0: Mon Feb 25
13:59:18 PST 2008 root@:/usr/obj/usr/src/sys/GENERIC i386
> echo $SHELL
/bin/tcsh
> ls /usr/share/locale/ | grep -i es_ES
es_ES.ISO8859-1
es_ES.ISO8859-15
es_ES.ISO_8859-1
es_ES.ISO_8859-15
es_ES.UTF-8
> setenv LC_ALL es_ES.ISO8859-15
> date
Thu May 15 23:54:11 CEST 2008

Maybe this problem is related only with configuration. See output in linux:

tuxillo@smash64 ~ $ uname -a
Linux smash64 2.6.24-gentoo-r4 #6 SMP Mon Apr 28 01:25:57 CEST 2008 x86_64 AMD
Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux
tuxillo@smash64 ~ $ echo $LC_ALL
es_ES.ISO8859-15
tuxillo@smash64 ~ $ date
Fri May 16 00:06:20 CEST 2008

Should be "vie 16 Mayo 00:06:20 CEST 2008" in spanish

#3 Updated by alexh about 6 years ago

To me it seems that the problem lies in libc's strftime, as date relies on
strftime to print locale specific dates.
Actually when comparing libc's strftime.c in DragonFlyBSD to the one in OpenBSD,
for example, you can see that DragonFly doesn't try to find the locale but by
default uses a built-in locale, which is obviously the english one.

#4 Updated by tuxillo 3 months ago

  • Description updated (diff)
  • Category set to Userland
  • Status changed from New to Closed
  • Assignee changed from 0 to marino
  • Target version set to 4.2.x

Hi,

No longer the case in our current stable/master:

antonioh@nas:~/irclogs$ env LANG="fr_FR.UTF-8" date
jeu 15 jan 2015 16:29:32 CET
antonioh@nas:~/irclogs$ env LANG="en_EN.UTF-8" date
Thu Jan 15 16:29:39 CET 2015
antonioh@nas:~/irclogs$ env LANG="es_ES.UTF-8" date
jueves, 15 de enero de 2015, 16:29:47 CET
antonioh@nas:~/irclogs$ env LANG="de_DE.UTF-8" date
Do 15 Jan 2015 16:29:58 CET

Cheers,
Antonio Huete

Also available in: Atom PDF