Skip Menu |

This queue is for tickets about the Locale-PO CPAN distribution.

Report information
The Basics
Id: 107039
Status: open
Priority: 0/
Queue: Locale-PO

People
Owner: Nobody in particular
Requestors: ayanokouz [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.27
Fixed in: (no value)



Subject: Invalid formatting of obsolete entries
When one entry is obsoleted and have multiple lines of msgctxt/msgid/msgid_plural/msgstr/msgstr[*], save_file_fromarray and save_file_fromhash will generate invalid file: GNU gettext tools like megcat and msgattrib will abnormally be terminated with "fatal errors" and "inconsistent use of #~" messages.
Il Ven 11 Set 2015 10:09:20, AYANOKOUZ ha scritto: Show quoted text
> When one entry is obsoleted and have multiple lines > of msgctxt/msgid/msgid_plural/msgstr/msgstr[*], > save_file_fromarray and save_file_fromhash will generate > invalid file: GNU gettext tools like megcat and msgattrib > will abnormally be terminated with "fatal errors" and > "inconsistent use of #~" messages.
Hi, can you please provide an example file, before the save, after the save, and the same file saved correctly? Thanks,
Dear authors, I just send pull request via github[1]. I would like to merge my work on your master branch. [1] https://github.com/cosimo/perl5-locale-po/pull/4 Sincerely yours, Ryuunosuke Ayanokouzi
Il Ven 11 Set 2015 10:30:53, AYANOKOUZ ha scritto: Show quoted text
> Dear authors, > > I just send pull request via github[1]. > I would like to merge my work on your master branch. > > [1] https://github.com/cosimo/perl5-locale-po/pull/4 > > Sincerely yours, > Ryuunosuke Ayanokouzi
A patch with a new test case, fantastic! Thank you very much. I will look at it soon.
Dear authors, Show quoted text
> can you please provide an example file, before the save, after the > save, and the same file saved correctly?
I attached files for reproducing this bug. Please check the files. The source po file[1] is not identical with result po file[2]. But important point is that the result po file cannot be post-processed by GNU gettext tools. [1] source po file (for example): RT107039.po [2] do-nothing-filter: echo.pl [3] result po file by v0.27 : RT107039-v0.27.po [4] result po file by patched v0.27[*]: RT107039-v0.27-patch.po [*] https://github.com/l/perl5-locale-po/commit/7f6d303b2b8a16ae39ac9be93bd1f5933d534bed You will reproduce the bug by following procedure. $ perl echo.pl RT107039.po RT107039-v0.27-patch.po $ msgcat RT107039-v0.27.po RT107039-v0.27.po:29: inconsistent use of #~ RT107039-v0.27.po:31: inconsistent use of #~ RT107039-v0.27.po:43: inconsistent use of #~ RT107039-v0.27.po:45: inconsistent use of #~ RT107039-v0.27.po:47: inconsistent use of #~ RT107039-v0.27.po:49: inconsistent use of #~ msgcat: found 6 fatal errors $ perl -I/path/to/v0.27-patch-repository echo.pl RT107039.po RT107039-v0.27-patch.po $ msgcat RT107039-v0.27-patch.po # Japanese translations for test package # test パッケージに対する英訳. # Copyright (C) 2015 THE test'S COPYRIGHT HOLDER # This file is distributed under the same license as the test package. # Automatically generated, 2015. # msgid "" msgstr "" "Project-Id-Version: test version\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-09-11 09:00+0900\n" "PO-Revision-Date: 2015-09-11 09:00+0900\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: test.c:13 #~ msgid "TEST: msgid singleline" #~ msgstr "TEST: msgstr singleline" #: test.c:14 #~ msgid "" #~ "TEST: msgid multi\n" #~ "line" #~ msgstr "" #~ "TEST: msgstr multi\n" #~ "line" #: test.c:17 #~ msgctxt "TEST: mgsctxt singleline" #~ msgid "TEST: msgid singleline" #~ msgid_plural "TEST: msgid_plural singleline" #~ msgstr[0] "TEST: msgstr[0] singleline" #: test.c:20 #~ msgctxt "" #~ "TEST: mgsctxt multi\n" #~ "line" #~ msgid "" #~ "TEST: msgid multi\n" #~ "line" #~ msgid_plural "" #~ "TEST: msgid_plural multi\n" #~ "line" #~ msgstr[0] "" #~ "TEST: msgstr[0] multi\n" #~ "line" $ diff -u RT107039.po RT107039-v0.27.po --- RT107039.po 2015-09-11 23:12:59.320620805 +0900 +++ RT107039-v0.27.po 2015-09-11 23:41:47.228846861 +0900 @@ -26,9 +26,9 @@ #: test.c:14 #, c-format #~ msgid "TEST: msgid multi\n" -#~ "line" +"line" #~ msgstr "TEST: msgstr multi\n" -#~ "line" +"line" #: test.c:17 #, c-format @@ -40,11 +40,11 @@ #: test.c:20 #, c-format #~ msgctxt "TEST: mgsctxt multi\n" -#~ "line" +"line" #~ msgid "TEST: msgid multi\n" -#~ "line" +"line" #~ msgid_plural "TEST: msgid_plural multi\n" -#~ "line" +"line" #~ msgstr[0] "TEST: msgstr[0] multi\n" -#~ "line" +"line" Sincerely yours, Ryuunosuke Ayanokouzi
Subject: RT107039-v0.27-patch.po
Download RT107039-v0.27-patch.po
application/octet-stream 1.2k

Message body not shown because it is not plain text.

Subject: RT107039-v0.27.po
Download RT107039-v0.27.po
application/octet-stream 1.2k

Message body not shown because it is not plain text.

Subject: RT107039.po
Download RT107039.po
application/octet-stream 1.2k

Message body not shown because it is not plain text.

Subject: echo.pl
#!/usr/bin/perl # $ perl ~/bk/perl/perl5-locale-po/obsolete-multiline-test.pl | msgattrib --set-obsolete use strict; use warnings; use Data::Dumper; # use lib qw(/home/my/bk/github/cosimo/perl5-locale-po/lib); use Locale::PO; my $po_file_in = shift; #'ja-JP/00a_preface.po'; my $po_file_out = shift; #'ja-JP/00a_preface.po'; my $aref = Locale::PO->load_file_asarray($po_file_in); Locale::PO->save_file_fromarray( $po_file_out, $aref ); exit 0;