[issue18216] gettext doesn't check MO versions

2014-10-28 Thread Aaron Hill

Aaron Hill added the comment:

Awesome! Thanks!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I've pushed it to 3.5 only. I don't think it's worth risking compatibility 
breakage in bugfix branches. Thank you for your contribution!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3b26a0983a3c by Antoine Pitrou in branch 'default':
Issue #18216: gettext now raises an error when a .mo file has an unsupported 
major version number.  Patch by Aaron Hill.
https://hg.python.org/cpython/rev/3b26a0983a3c

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Aaron, the patch looks fine, I'm going to commit it.

--
versions:  -Python 2.7, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-25 Thread Aaron Hill

Aaron Hill added the comment:

Is there anything that needs to be changed?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-17 Thread Aaron Hill

Aaron Hill added the comment:

I've added a second patch, which properly distinguishes between major and minor 
revisions, and updates the docs to account for the new behavior.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-17 Thread Aaron Hill

Changes by Aaron Hill :


Added file: http://bugs.python.org/file36958/gettext-mo-fixup.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-17 Thread Aaron Hill

Changes by Aaron Hill :


Removed file: 
http://bugs.python.org/file36957/gettext-mo-fix-minor-version.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-17 Thread Aaron Hill

Changes by Aaron Hill :


Added file: http://bugs.python.org/file36957/gettext-mo-fix-minor-version.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-17 Thread Aaron Hill

Aaron Hill added the comment:

Okay, then. I'll just leave it out.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The linked docs say: """an unexpected minor revision number means that the file 
can be read but will not reveal its full contents, when parsed by a program 
that supports only smaller minor revision numbers""".

Unless there an important piece of contents that can be missed, I would say a 
warning is more of a distraction here.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-17 Thread Aaron Hill

Aaron Hill added the comment:

Does anyone have any thoughts about throwing a warning for an unexpected minor 
revision?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-07 Thread Aaron Hill

Aaron Hill added the comment:

That sounds good. Should a warning be thrown for an unexpected minor revision?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-07 Thread Jakub Wilk

Jakub Wilk added the comment:

The patch hardcodes 5 as version number in the exception message.

The specifiction also says that "an unexpected minor revision number means that 
the file can be read but will not reveal its full contents, when parsed by a 
program that supports only smaller minor revision numbers". So I think a 
reasonable thing to do is to accept MO files with an expected major revision 
but an unexpected minor revision.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-06 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage:  -> patch review
type:  -> behavior
versions: +Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-06 Thread Aaron Hill

Changes by Aaron Hill :


--
keywords: +patch
nosy: +Aaron1011
Added file: http://bugs.python.org/file36828/gettext-mo-version.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-06 Thread Jakub Wilk

Jakub Wilk added the comment:

I believe so, yes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2014-10-03 Thread Mark Lawrence

Mark Lawrence added the comment:

@Jakub does this apply to all Python versions and OSes?

--
nosy: +BreamoreBoy, loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18216] gettext doesn't check MO versions

2013-06-14 Thread Jakub Wilk

New submission from Jakub Wilk:

The MO file format specification[0] reads:
"A program seeing an unexpected major revision number should stop reading the 
MO file entirely"
But Python doesn't pay attention to versions at all.

As a test-case I attached a MO file with a bogus major revision number. 
msgunfmt correcly rejects such a file:

$ msgunfmt messages.mo 
msgunfmt: file "messages.mo" is not in GNU .mo format

Yet Python opens it happily:

>>> import gettext
>>> t = gettext.GNUTranslations(open("messages.mo", "rb"))
>>> t.gettext("foo")
'bar'


[0] http://www.gnu.org/software/gettext/manual/html_node/MO-Files.html

--
components: Library (Lib)
files: messages.mo
messages: 191151
nosy: jwilk
priority: normal
severity: normal
status: open
title: gettext doesn't check MO versions
Added file: http://bugs.python.org/file30587/messages.mo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com