[Django] #26670: makemessages' plural form handling helper function can insert extra empty line in PO file

3 views
Skip to first unread message

Django

unread,
May 26, 2016, 10:12:56 PM5/26/16
to django-...@googlegroups.com
#26670: makemessages' plural form handling helper function can insert extra empty
line in PO file
------------------------------------------------+------------------------
Reporter: ramiro | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Internationalization | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
When it copieds the plural form formula header line from Django
translations it can insert a line with a triling newline:

https://github.com/django/django/blob/4731e9d82ea72b6d793fb06713d11d228eb89ace/django/core/management/commands/makemessages.py#L624

This is mostly a correctness issue rarely seen in final PO files as
makemessages usually runs
the resulting PO file through additional invocations of gettext tools
which can correct the issue in case the plural forms formula PO header
line is the last one.

--
Ticket URL: <https://code.djangoproject.com/ticket/26670>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 26, 2016, 10:13:18 PM5/26/16
to django-...@googlegroups.com
#26670: makemessages' plural form handling helper function can insert extra empty
line in PO file
-------------------------------------+-------------------------------------
Reporter: ramiro | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by ramiro:

Old description:

> When it copieds the plural form formula header line from Django
> translations it can insert a line with a triling newline:
>
> https://github.com/django/django/blob/4731e9d82ea72b6d793fb06713d11d228eb89ace/django/core/management/commands/makemessages.py#L624
>
> This is mostly a correctness issue rarely seen in final PO files as
> makemessages usually runs
> the resulting PO file through additional invocations of gettext tools
> which can correct the issue in case the plural forms formula PO header
> line is the last one.

New description:

When it copies the plural form formula header line from Django


translations it can insert a line with a triling newline:

https://github.com/django/django/blob/4731e9d82ea72b6d793fb06713d11d228eb89ace/django/core/management/commands/makemessages.py#L624

This is mostly a correctness issue rarely seen in final PO files as
makemessages usually runs
the resulting PO file through additional invocations of gettext tools
which can correct the issue in case the plural forms formula PO header
line is the last one.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/26670#comment:1>

Django

unread,
May 26, 2016, 10:13:36 PM5/26/16
to django-...@googlegroups.com
#26670: makemessages' plural form handling helper function can insert extra empty
line in PO file
-------------------------------------+-------------------------------------
Reporter: ramiro | Owner: ramiro
Type: | Status: assigned

Cleanup/optimization |
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ramiro):

* owner: nobody => ramiro
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/26670#comment:2>

Django

unread,
May 27, 2016, 5:32:22 PM5/27/16
to django-...@googlegroups.com
#26670: makemessages' plural form handling helper function can insert extra empty
line in PO file
-------------------------------------+-------------------------------------
Reporter: ramiro | Owner: ramiro
Type: | Status: assigned
Cleanup/optimization |
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1
* stage: Unreviewed => Ready for checkin


Comment:

Fixed by [https://github.com/django/django/pull/6645 PR 6645] according to
the commit message there.

--
Ticket URL: <https://code.djangoproject.com/ticket/26670#comment:3>

Django

unread,
May 27, 2016, 8:03:49 PM5/27/16
to django-...@googlegroups.com
#26670: makemessages' plural form handling helper function can insert extra empty
line in PO file
-------------------------------------+-------------------------------------
Reporter: ramiro | Owner: ramiro
Type: | Status: closed

Cleanup/optimization |
Component: | Version: master
Internationalization |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ramiro Morales <cramm0@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"6ab0d1358fc78077064aab88a4fb0a47ca116391" 6ab0d13]:
{{{
#!CommitTicketReference repository=""
revision="6ab0d1358fc78077064aab88a4fb0a47ca116391"
Fixed #26645 -- Fixed potential makemessages failures on Windows.

This was reflected by 27 i18n test errors (not failures) on such
platform caused by corrupt intermediate PO catalog files fed to
`msgmerge(1)`.

Made it handle in-memory PO/POT file contents with normalized line
separators (`'\n'`).

We need to perform manually this after using `subprocess.Popen` as we
can't pass it `universal_newlines=True`.

Also fixes #26670 in the process as this commit refactors the same code
section.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26670#comment:4>

Django

unread,
May 28, 2016, 8:42:19 AM5/28/16
to django-...@googlegroups.com
#26670: makemessages' plural form handling helper function can insert extra empty
line in PO file
-------------------------------------+-------------------------------------
Reporter: ramiro | Owner: ramiro
Type: | Status: closed
Cleanup/optimization |
Component: | Version: master
Internationalization |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"fc644076cdb45b8c227ff3041540f281a2c0b007" fc64407]:
{{{
#!CommitTicketReference repository=""
revision="fc644076cdb45b8c227ff3041540f281a2c0b007"
[1.10.x] Fixed #26645 -- Fixed potential makemessages failures on Windows.

This was reflected by 27 i18n test errors (not failures) on such
platform caused by corrupt intermediate PO catalog files fed to
`msgmerge(1)`.

Made it handle in-memory PO/POT file contents with normalized line
separators (`'\n'`).

We need to perform manually this after using `subprocess.Popen` as we
can't pass it `universal_newlines=True`.

Also fixes #26670 in the process as this commit refactors the same code
section.

Backport of 6ab0d1358fc78077064aab88a4fb0a47ca116391 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26670#comment:5>

Reply all
Reply to author
Forward
0 new messages