Bug 24162 - ja_JP LC_TIME: era offset for Taisho GanNen and BC direction
Summary: ja_JP LC_TIME: era offset for Taisho GanNen and BC direction
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: localedata (show other bugs)
Version: 2.29
: P2 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-04 10:15 UTC by junji morimitsu
Modified: 2019-03-22 02:01 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description junji morimitsu 2019-02-04 10:15:43 UTC
Dear glibc maintainers,
Thank you for your work.
I would like to request update of 3 lines of ja_JP as follows.

        file: glibc-2.29/localedata/locales/ja_JP


1:  email bug-glibc-locales@gnu.org is not available.  Email was forwarded to libc-locales@sources.redhat.com and I got a deliverly error.  Please remove the obsolete email address.
(Also it is listed on https://sourceware.org/glibc/wiki/Bugzilla%20Procedures)


2:  The offset of Taisho Gan Nen (1912) is '2', but it should be '1'.  Gan Nen means the 1st year, Taisho started on 1912-07-30.  
////
morimi@vms$ uname -ov
#166-Ubuntu SMP Wed Nov 14 20:09:47 UTC 2018 GNU/Linux
morimi@vms$ date -d"1912-07-29" +%EY
明治45年
morimi@vms$ date -d"1912-07-29" +%Ey
45
morimi@vms$ date -d"1912-07-30" +%EY
大正元年
morimi@vms$ date -d"1912-07-30" +%Ey
2                                       <<<<wrong
morimi@vms$ date -d"1913-07-30" +%EY
大正2年
morimi@vms$ date -d"1913-07-30" +%Ey
2
////
(I found this bug was listed as bug#11310)


3:  The direction of BC is '+', but it should be '-'.  The start_date (-1/12/31) is the last day of BC.  The direction is backward.  However I cannot show how to use this flag.  Only decoration?


----Patch data----
begin--------

--- glibc-2.29/localedata/locales/ja_JP	2019-01-29 13:23:57.691603804 +0900
+++ glibc-2.29/localedata/locales/ja_JP-fix	2019-02-04 14:16:18.444557801 +0900
@@ -18,7 +18,7 @@
 source     "HANATAKA, Shinya, hanataka@abyss.rim.or.jp"
 address    ""
 contact    ""
-email      "bug-glibc-locales@gnu.org"
+email      ""
 tel        ""
 fax        ""
 language   "Japanese"
@@ -14951,10 +14951,10 @@
 	"+:2:1927//01//01:1989//01//07:<U662D><U548C>:%EC%Ey<U5E74>";/
 	"+:1:1926//12//25:1926//12//31:<U662D><U548C>:%EC<U5143><U5E74>";/
 	"+:2:1913//01//01:1926//12//24:<U5927><U6B63>:%EC%Ey<U5E74>";/
-	"+:2:1912//07//30:1912//12//31:<U5927><U6B63>:%EC<U5143><U5E74>";/
+	"+:1:1912//07//30:1912//12//31:<U5927><U6B63>:%EC<U5143><U5E74>";/
 	"+:6:1873//01//01:1912//07//29:<U660E><U6CBB>:%EC%Ey<U5E74>";/
 	"+:1:0001//01//01:1872//12//31:<U897F><U66A6>:%EC%Ey<U5E74>";/
-	"+:1:-0001//12//31:-*:<U7D00><U5143><U524D>:%EC%Ey<U5E74>"
+	"-:1:-0001//12//31:-*:<U7D00><U5143><U524D>:%EC%Ey<U5E74>"
 
 era_d_fmt	"%EY%m<U6708>%d<U65E5>"
 

end--------


Thank you and best regards,
Junji
Comment 1 Carlos O'Donell 2019-02-04 14:47:09 UTC
(In reply to junji morimitsu from comment #0)
> 1:  email bug-glibc-locales@gnu.org is not available.  Email was forwarded
> to libc-locales@sources.redhat.com and I got a deliverly error.  Please
> remove the obsolete email address.
> (Also it is listed on
> https://sourceware.org/glibc/wiki/Bugzilla%20Procedures)

This was a mistake, it should be libc-locales@sourceware.org, fixed, thank you for the report.
Comment 2 Carlos O'Donell 2019-02-04 15:25:14 UTC
(In reply to Carlos O'Donell from comment #1)
> (In reply to junji morimitsu from comment #0)
> > 1:  email bug-glibc-locales@gnu.org is not available.  Email was forwarded
> > to libc-locales@sources.redhat.com and I got a deliverly error.  Please
> > remove the obsolete email address.
> > (Also it is listed on
> > https://sourceware.org/glibc/wiki/Bugzilla%20Procedures)
> 
> This was a mistake, it should be libc-locales@sourceware.org, fixed, thank
> you for the report.

The bug-glibc-locales@gnu.org address is in the process of being fixed, but I think I've fixed all the broken references in manuals and wiki pages to the sources.redhat.com domain.
Comment 3 junji morimitsu 2019-02-05 14:09:49 UTC
Hi ,

(In reply to Carlos O'Donell from comment #2)
> The bug-glibc-locales@gnu.org address is in the process of being fixed, but

Thank you.  So the address will be available again, I cancel the item 1:.


About 2: and 3:, I think they are simple typos.  Is there anyone who can confirm the fixes?

Thank you very much.  
I'm testing Japanese era data because the new era name will be announce on April 1.  (logged as Bug#22964)
Comment 4 Carlos O'Donell 2019-02-06 04:29:04 UTC
(In reply to junji morimitsu from comment #3)
> Hi ,
> 
> (In reply to Carlos O'Donell from comment #2)
> > The bug-glibc-locales@gnu.org address is in the process of being fixed, but
> 
> Thank you.  So the address will be available again, I cancel the item 1:.
> 
> 
> About 2: and 3:, I think they are simple typos.  Is there anyone who can
> confirm the fixes?
> 
> Thank you very much.  
> I'm testing Japanese era data because the new era name will be announce on
> April 1.  (logged as Bug#22964)

TAMUKI-san,

Given that you are looking at the Japanese era name change in detail, do you have any comments on the correctness of the existing data?
Comment 5 TAMUKI Shoichi 2019-02-07 06:17:42 UTC
Hello Morimitsu-san,

(In reply to junji morimitsu from comment #0)
> 2:  The offset of Taisho Gan Nen (1912) is '2', but it should be '1'.
>     Gan Nen means the 1st year, Taisho started on 1912-07-30.

Yes, you are right.  Probably, this typo was introduced when creating
ja_JP localedata, but it has been overlooked so far.  I think it sould
be corrected.

> 3:  The direction of BC is '+', but it should be '-'.  The start_date
>     (-1/12/31) is the last day of BC.  The direction is backward.
>     However I cannot show how to use this flag.  Only decoration?

There is no need to change this:

$ date -d "2016 years ago" +"%EY"
西暦03年
$ date -d "2017 years ago" +"%EY"
西暦02年
$ date -d "2018 years ago" +"%EY"
西暦01年
$ date -d "2019 years ago" +"%EY"
紀元前01年
$ date -d "2020 years ago" +"%EY"
紀元前02年
$ date -d "2021 years ago" +"%EY"
紀元前03年

If you change '+' to '-', it will be as follows:

$ date -d "2016 years ago" +"%EY"
西暦03年
$ date -d "2017 years ago" +"%EY"
西暦02年
$ date -d "2018 years ago" +"%EY"
西暦01年
$ date -d "2019 years ago" +"%EY"
紀元前01年
$ date -d "2020 years ago" +"%EY"
紀元前00年
$ date -d "2021 years ago" +"%EY"
紀元前-1年

Regards,
TAMUKI Shoichi
Comment 6 junji morimitsu 2019-02-07 13:03:55 UTC
Hello TAMUKI-san,

Thank you very much for checking.

(In reply to TAMUKI Shoichi from comment #5)
> > 2:  The offset of Taisho Gan Nen (1912) is '2', but it should be '1'.
> >     Gan Nen means the 1st year, Taisho started on 1912-07-30.
> 
> Yes, you are right.  Probably, this typo was introduced when creating
> ja_JP localedata, but it has been overlooked so far.  I think it sould
> be corrected.

Thanks.  I hope the update can be checked in before April Fool.  :) 


> > 3:  The direction of BC is '+', but it should be '-'.  

> If you change '+' to '-', it will be as follows:
...
> $ date -d "2018 years ago" +"%EY"
> 西暦01年
> $ date -d "2019 years ago" +"%EY"
> 紀元前01年
> $ date -d "2020 years ago" +"%EY"
> 紀元前00年
> $ date -d "2021 years ago" +"%EY"
> 紀元前-1年

Very good example!  Thank you.  The offset counts are wrong at '-' direction.  
This shows there is a bug in localedef or strftime() using the 'direction'.  
'direction' is the 'era' direction, not 'offset' direction.  
'offset' count (%Ey) should be increasing from 'start_date' to the 'end_date'.  
Please check the LC_TIME definition about this.

So I understand that using '+' for BC era is a workaround for a bug.

>There is no need to change this:

I agree with you as of now.  
1st, to fix the 'direction' bug, then to use '-' for BC era, I think.
And I'm not so interested in BC era this year.  
(Temporary) I want cancel item 3:.

Thank you,
Junji
Comment 7 TAMUKI Shoichi 2019-02-08 08:49:32 UTC
I sent the patch to libc-alpha:
https://sourceware.org/ml/libc-alpha/2019-02/msg00202.html
Comment 8 cvs-commit@gcc.gnu.org 2019-03-02 12:04:15 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  31effacee2fc1b327bedc9a5fcb4b83f227c6539 (commit)
      from  f0eaf86276547f4f1984469b651b3e9968858b85 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=31effacee2fc1b327bedc9a5fcb4b83f227c6539

commit 31effacee2fc1b327bedc9a5fcb4b83f227c6539
Author: TAMUKI Shoichi <tamuki@linet.gr.jp>
Date:   Sat Mar 2 21:00:28 2019 +0900

    ja_JP: Change the offset for Taisho gan-nen from 2 to 1 [BZ #24162]
    
    The offset in era-string format for Taisho gan-nen (1912) is currently
    defined as 2, but it should be 1.  So fix it.  "Gan-nen" means the 1st
    (origin) year, Taisho started on July 30, 1912.
    
    Reported-by: Morimitsu, Junji <junji.morimitsu@hpe.com>
    Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com>
    
    ChangeLog:
    
    	[BZ #24162]
    	* localedata/locales/ja_JP (LC_TIME): Change the offset for Taisho
    	gan-nen from 2 to 1.  Problem reported by Morimitsu, Junji.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                |    6 ++++++
 localedata/locales/ja_JP |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)
Comment 9 TAMUKI Shoichi 2019-03-18 05:53:15 UTC
Hello Morimitsu-san,

(In reply to junji morimitsu from comment #6)
> Very good example!  Thank you.  The offset counts are wrong at '-' direction.
> This shows there is a bug in localedef or strftime() using the 'direction'.
> 'direction' is the 'era' direction, not 'offset' direction.
> 'offset' count (%Ey) should be increasing from 'start_date' to the 'end_date'.
> Please check the LC_TIME definition about this.

Regarding BC direction, I still think there is no need to change this.

I checked the LC_TIME definition about this:

[LC_TIME Category for the Locale Definition Source File Format]
https://sites.ualberta.ca/dept/chemeng/AIX-43/share/man/info/C/a_doc_lib/files/aixfiles/LC_TIME.htm

According to the reference above, there is the following description:

| era	Defines how the years are counted and displayed for each era
| 	(or emperor's reign) in a locale, corresponding to the %E
| 	field descriptor modifier.  For each era, there must be one
| 	string in the following format:
| 
| 	direction:offset:start_date:end_date:name:format
| 
| 	The variables for the era-string format are defined as follows:
| 
| 	[...]
| 	end_date	Specifies the ending date of the era in the
| 			same form used for the start_date variable or
| 			one of the two special values -* or +*.  A -*
| 			value indicates that the ending date of the
| 			era extends backward to the beginning of time.
| 			A +* value indicates that the ending date of
| 			the era extends forward to the end of time.
| 			Therefore, the ending date can be
| 			chronologically before or after the starting
| 			date of the era.  For example, the strings for
| 			the Christian eras AD and BC would be entered
| 			as follows:
| 
| 			+:0:0000/01/01:+*:AD:%o %N
| 			+:1:-0001/12/31:-*:BC:%o %N
| 	[...]

The following series of references have similar descriptions:

[ロケール・ファイルの形式]
http://odl.sysworks.biz/disk$axpdocjun002/japanese/jovms721/xpg4/64940003.htm

[Locale - The Open Group Library]
http://pubs.opengroup.org/onlinepubs/7908799/xbd/locale.html

[Compaq C Run-Time Library Utilities Reference Manual]
http://h30266.www3.hpe.com/odl/axpos/opsys/vmsos84/6494/6494pro_003.html

Regards,
TAMUKI Shoichi
Comment 10 cvs-commit@gcc.gnu.org 2019-03-22 02:01:31 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.29/master has been updated
       via  e28ad442e73b00ae2047d89c8cc7f9b2a0de5436 (commit)
      from  6eb48fe80cb6dd3ef536e86d005976d1c22b170e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e28ad442e73b00ae2047d89c8cc7f9b2a0de5436

commit e28ad442e73b00ae2047d89c8cc7f9b2a0de5436
Author: TAMUKI Shoichi <tamuki@linet.gr.jp>
Date:   Sat Mar 2 21:00:28 2019 +0900

    ja_JP: Change the offset for Taisho gan-nen from 2 to 1 [BZ #24162]
    
    The offset in era-string format for Taisho gan-nen (1912) is currently
    defined as 2, but it should be 1.  So fix it.  "Gan-nen" means the 1st
    (origin) year, Taisho started on July 30, 1912.
    
    Reported-by: Morimitsu, Junji <junji.morimitsu@hpe.com>
    Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com>
    
    ChangeLog:
    
    	[BZ #24162]
    	* localedata/locales/ja_JP (LC_TIME): Change the offset for Taisho
    	gan-nen from 2 to 1.  Problem reported by Morimitsu, Junji.
    
    (cherry picked from commit 31effacee2fc1b327bedc9a5fcb4b83f227c6539)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                |    6 ++++++
 localedata/locales/ja_JP |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)