On Tue, 09 Mar 2010 23:00:21 +0100
Miroslaw Zalewski <mini...@gmail.com> wrote:

> As you can see, my default locales are pl_PL.UTF-8. But vnstat without
> --locale option specified and with it outputs dates in completely
> different format.

If the "Locale" setting in the configuration file is set to "-" then vnstat
will use the value in the LC_ALL variable as described in the configuration
file comment and the man page. Your 'locale' output shows that LC_ALL isn't
set so vnstat will use an empty value resulting in some default formatting.

osid:~# locale
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=en_US
osid:~# vnstat | awk 'NR==11 {print}'
       Mar '10     95.98 MiB |    3.20 MiB |   99.17 MiB |    0.95 kbit/s
osid:~# export LC_ALL="fi_FI"
osid:~# locale
LANG=en_US
LC_CTYPE="fi_FI"
LC_NUMERIC="fi_FI"
LC_TIME="fi_FI"
LC_COLLATE="fi_FI"
LC_MONETARY="fi_FI"
LC_MESSAGES="fi_FI"
LC_PAPER="fi_FI"
LC_NAME="fi_FI"
LC_ADDRESS="fi_FI"
LC_TELEPHONE="fi_FI"
LC_MEASUREMENT="fi_FI"
LC_IDENTIFICATION="fi_FI"
LC_ALL=fi_FI
osid:~# vnstat | awk 'NR==11 {print}'
     maalis '10    95,98 MiB |    3,20 MiB |   99,17 MiB |    0,95 kbit/s
osid:~# vnstat --locale en_US | awk 'NR==11 {print}'
       Mar '10     95.99 MiB |    3.21 MiB |   99.19 MiB |    0.95 kbit/s
osid:~# vnstat --locale fi_FI | awk 'NR==11 {print}'
     maalis '10    95,99 MiB |    3,21 MiB |   99,19 MiB |    0,95 kbit/s

> I am not programmer, so I could not find where the bug is. I thought
> that maybe vnstat reads config only once, while starting the deamon
> (and locale are set to C at that time, and are changed later), but
> adding LC_ALL=pl_PL.UTF-8 to /etc/init.d/vnstat and restarting the
> daemon does not changes anything.

The daemon doesn't care about the locale setting. It only collects the data
and saves it to the database without any locale information. That's why
modifying the locale setting in /etc/init.d/vnstat will not affect the
output of the vnstat command itself.

-- 
- Teemu Toivola



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to