Bug 600384 - Japanese locale specific time style not used in 'ls -l' output
Japanese locale specific time style not used in 'ls -l' output
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: coreutils (Show other bugs)
6.0
All Linux
medium Severity medium
: rc
: ---
Assigned To: Ondrej Vasik
Jan Ščotka
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-04 11:35 EDT by Jeff Bastian
Modified: 2017-02-27 22:35 EST (History)
3 users (show)

See Also:
Fixed In Version: coreutils-8.4-8.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 600390 (view as bug list)
Environment:
Last Closed: 2010-11-10 15:02:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
remove fuzzy option from time style (622 bytes, patch)
2010-06-04 17:25 EDT, Jeff Bastian
no flags Details | Diff

  None (edit)
Description Jeff Bastian 2010-06-04 11:35:08 EDT
Description of problem:
The 'ls -l' output for the ja_JP.UTF-8 locale uses the long-iso time style instead of the Japanese style.
    $ LANG=ja_JP.UTF-8 ls -l
    合計 0
    -rw-rw-r--. 1 jbastian jbastian 0 2010-06-04 10:19 timestamp

In RHEL 5, it used a Japanese locale time style:
    $ LANG=ja_JP.UTF-8 ls -l
    合計 4
    -rw-rw-r-- 1 jbastian jbastian 0  6月  4 10:19 timestamp


Version-Release number of selected component (if applicable):
coreutils-8.4-7.el6.x86_64

How reproducible:
every time

Steps to Reproduce:
1. touch timestamp
2. LANG=ja_JP.UTF-8 ls -l timestamp
  
Actual results:
Long ISO time style is used to display the file's timestamp, e.g., 2010-06-04 10:19

Expected results:
Japanese locale time style is used, e.g., 6月  4 10:19

Additional info:
The coreutils-8.4/po/ja.po source contains a translation for the time styles:
    $ nl -ba ja.po
    ...
      5061  msgid "%b %e  %Y"
      5062  msgstr "%b %e %H:%M %Y"
       ...
      5071  msgid "%b %e %H:%M"
      5072  msgstr "%b %e %H:%M %Y"

However, these do not appear in the compiled mo files:
    $ msgunfmt /usr/share/locale/ja/LC_MESSAGES/coreutils.mo | grep -A1 '%b %e'
    $ msgunfmt /usr/share/locale/ja/LC_TIME/coreutils.mo | grep -A1 '%b %e'
    $ 

They do, however, appear for other locales.  For example, French:
    $ msgunfmt /usr/share/locale/fr/LC_MESSAGES/coreutils.mo | grep -A1 '%b %e'
    msgid "%b %e  %Y"
    msgstr "%e %b  %Y"
    --
    msgid "%b %e %H:%M"
    msgstr "%e %b %H:%M"
    $ msgunfmt /usr/share/locale/fr/LC_TIME/coreutils.mo | grep -A1 '%b %e'
    msgid "%b %e  %Y"
    msgstr "%e %b  %Y"
    --
    msgid "%b %e %H:%M"
    msgstr "%e %b %H:%M"
Comment 1 Jeff Bastian 2010-06-04 11:38:38 EDT
I should add that it works for French as well:
    $ LANG=fr_FR.UTF-8 ls -l
    total 0
    -rw-rw-r--. 1 jbastian jbastian 0  4 juin  10:19 timestamp


Also, you can manually specify the time style for Japanese and it works:
    $ LANG=ja_JP.UTF-8 ls -l --time-style="+%b %e %H:%M %Y"
    合計 0
    -rw-rw-r--. 1 jbastian jbastian 0  6月  4 10:19 2010 timestamp
Comment 2 Jeff Bastian 2010-06-04 13:17:05 EDT
It appears you have to enable the -f (fuzzy) flag when compiling the po files.

The translations are missing with a simple compile:
    $ msgfmt -o /tmp/coreutils.mo ja.po
    $ msgunfmt /tmp/coreutils.mo | grep '%b %e'
    $ 

But with fuzzy enabled, they are included (along with lots of errors):
    $ msgfmt -f -o /tmp/coreutils.mo ja.po
    ja.po:39: `msgid' and `msgstr' entries do not both end with '\n'
    ja.po:269: `msgid' and `msgstr' entries do not both end with '\n'
    ...
    msgfmt: found 43 fatal errors
    $ msgunfmt /tmp/coreutils.mo | grep '%b %e'
    msgid "%b %e  %Y"
    msgstr "%b %e %H:%M %Y"
    msgid "%b %e %H:%M"
    msgstr "%b %e %H:%M %Y"


Overwriting the system coreutils.mo files with this fresh fuzzy version fixes the problem:
    $ sudo cp /tmp/coreutils.mo /usr/share/locale/ja/LC_MESSAGES/coreutils.mo
    $ sudo cp /tmp/coreutils.mo /usr/share/locale/ja/LC_TIME/coreutils.mo
    $ LANG=ja_JP.UTF-8 ls -l timestamp                        
    -rw-rw-r--. 1 jbastian jbastian 0  6月  4 10:19 2010 timestamp
Comment 3 Jeff Bastian 2010-06-04 16:23:34 EDT
A better fix would be to just remove the fuzzy flag from the ja.po file:

diff --git a/po/ja.po b/po/ja.po
index 99faa91..6c411fa 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -5057,7 +5057,6 @@ msgstr "%s: 無効な番号です"
 #. Note also that specifying a width as in %5b is erroneous as strftime
 #. will count bytes rather than characters in multibyte locales.
 #: src/ls.c:733
-#, fuzzy
 msgid "%b %e  %Y"
 msgstr "%b %e %H:%M %Y"
 
@@ -5067,7 +5066,6 @@ msgstr "%b %e %H:%M %Y"
 #. Note also that specifying a width as in %5b is erroneous as strftime
 #. will count bytes rather than characters in multibyte locales.
 #: src/ls.c:746
-#, fuzzy
 msgid "%b %e %H:%M"
 msgstr "%b %e %H:%M %Y"
Comment 4 Jeff Bastian 2010-06-04 17:22:28 EDT
I applied the above patch and re-built coreutils and that fixed the problem!

$ sudo rpm -Uvh coreutils-8.4-7.el6.bz600384.i686.rpm \
                coreutils-libs-8.4-7.el6.bz600384.i686.rpm
Preparing...                ########################################### [100%]
   1:coreutils-libs         ########################################### [ 50%]
   2:coreutils              ########################################### [100%]
$ LANG=ja_JP.UTF-8 ls -l timestamp
-rw-r--r--. 1 jbastian jbastian 0  6月  4 10:19 2010 timestamp
Comment 5 Jeff Bastian 2010-06-04 17:25:03 EDT
Created attachment 421357 [details]
remove fuzzy option from time style
Comment 6 RHEL Product and Program Management 2010-06-05 13:42:58 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.
Comment 11 Jan Ščotka 2010-09-08 09:57:12 EDT
new version is Okay, it shows japanese date format 

# LANG=ja_JP.UTF-8 ls -l /
合計 94
dr-xr-xr-x.   2 root root  4096  9月  7 06:28 2010 bin
dr-xr-xr-x.   5 root root  1024  9月  7 05:18 2010 boot
drwxr-xr-x.   2 root root  4096  7月 14 07:45 2010 cgroup
drwxr-xr-x.  18 root root  3660  9月  7 05:18 2010 dev
drwxr-xr-x.  91 root root  4096  9月  8 03:41 2010 etc
drwxr-xr-x.   4 root root  4096  9月  7 05:15 2010 home
dr-xr-xr-x.  11 root root  4096  9月  7 05:12 2010 lib
dr-xr-xr-x.   9 root root 12288  9月  8 03:41 2010 lib64
drwx------.   2 root root 16384  9月  7 05:07 2010 lost+found
drwxr-xr-x.   2 root root  4096 12月  4 08:33 2009 media
drwxr-xr-x.   5 root root  4096  9月  7 05:18 2010 mnt
drwxr-xr-x.   2 root root  4096 12月  4 08:33 2009 opt
dr-xr-xr-x. 214 root root     0  9月  7 01:17 2010 proc
dr-xr-x---.   3 root root  4096  9月  8 09:55 2010 root
dr-xr-xr-x.   2 root root 12288  9月  7 06:28 2010 sbin
drwxr-xr-x.   7 root root     0  9月  7 01:17 2010 selinux
drwxr-xr-x.   2 root root  4096 12月  4 08:33 2009 srv
drwxr-xr-x.  13 root root     0  9月  7 01:17 2010 sys
drwxrwxrwt.  23 root root  4096  9月  8 06:39 2010 tmp
drwxr-xr-x.  13 root root  4096  9月  7 05:09 2010 usr
drwxr-xr-x.  21 root root  4096  9月  7 05:18 2010 var
Comment 12 releng-rhel@redhat.com 2010-11-10 15:02:02 EST
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.

Note You need to log in before you can comment on or make changes to this bug.