Bug 1329549

Summary: pybabel compile crashes with empty po-revision-date
Product: [Fedora] Fedora Reporter: Patrick Uiterwijk <puiterwijk>
Component: babelAssignee: Jeffrey C. Ollie <jeff>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: fschwarz, jeff, nphilipp, pnemade
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-12 10:49:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Patrick Uiterwijk 2016-04-22 08:20:07 UTC
Description of problem:
If I have a file with "PO-Revision-Date: \n", so empty revision-date (because it wasn't translated yet), and I run pybabel compile, it ends with a traceback.

Version-Release number of selected component (if applicable):
babel-1.3-12.fc24

How reproducible:
Consistently

Steps to Reproduce:
1. Get a po file that has an empty revision-date
2. Run pybabel compile

Actual results:
Traceback (most recent call last):
  File "releaseutils.py", line 216, in <module>
    SUBCOMMANDS[sys.argv[1]][0]()
  File "releaseutils.py", line 101, in build_catalogs
    cmd.run(compile_args)
  File "/usr/lib/python2.7/site-packages/babel/messages/frontend.py", line 665, in run
    return getattr(self, cmdname)(args[1:])
  File "/usr/lib/python2.7/site-packages/babel/messages/frontend.py", line 765, in compile
    catalog = read_po(infile, locale)
  File "/usr/lib/python2.7/site-packages/babel/messages/pofile.py", line 211, in read_po
    _add_message()
  File "/usr/lib/python2.7/site-packages/babel/messages/pofile.py", line 164, in _add_message
    catalog[msgid] = message
  File "/usr/lib/python2.7/site-packages/babel/messages/catalog.py", line 618, in __setitem__
    self.mime_headers = _parse_header(message.string).items()
  File "/usr/lib/python2.7/site-packages/babel/messages/catalog.py", line 414, in _set_mime_headers
    value, tzoffset, _ = re.split('([+-]\d{4})$', value, 1)
ValueError: need more than 1 value to unpack


Expected results:
A compiled locale file.

Additional info:
If in catalog.py line 414, I add something like "if value == '': continue", it will work correctly and do what it's supposed to do.
So it can process the file further without a parsed date, it's just the parsing that fails.

Comment 1 Nils Philippsen 2016-04-22 13:05:48 UTC
That looks as if it would be solved if we upgraded to the current version, the code in question has changed significantly (and seems to catch the missing date).

Comment 2 Nils Philippsen 2016-04-25 14:15:00 UTC
Hmm, 2.3.4 seems to just raise the exception elsewhere:

Traceback (most recent call last):
  File "/usr/bin/pybabel", line 9, in <module>
    load_entry_point('Babel==2.3.4', 'console_scripts', 'pybabel')()
  File "/usr/lib/python3.5/site-packages/babel/messages/frontend.py", line 911, in main
    return CommandLineInterface().run(sys.argv)
  File "/usr/lib/python3.5/site-packages/babel/messages/frontend.py", line 836, in run
    return cmdinst.run()
  File "/usr/lib/python3.5/site-packages/babel/messages/frontend.py", line 178, in run
    self._run_domain(domain)
  File "/usr/lib/python3.5/site-packages/babel/messages/frontend.py", line 218, in _run_domain
    catalog = read_po(infile, locale)
  File "/usr/lib/python3.5/site-packages/babel/messages/pofile.py", line 217, in read_po
    _add_message()
  File "/usr/lib/python3.5/site-packages/babel/messages/pofile.py", line 165, in _add_message
    catalog[msgid] = message
  File "/usr/lib/python3.5/site-packages/babel/messages/catalog.py", line 601, in __setitem__
    self.mime_headers = _parse_header(message.string).items()
  File "/usr/lib/python3.5/site-packages/babel/messages/catalog.py", line 420, in _set_mime_headers
    self.revision_date = _parse_datetime_header(value)
  File "/usr/lib/python3.5/site-packages/babel/messages/catalog.py", line 46, in _parse_datetime_header
    tt = time.strptime(match.group('datetime'), '%Y-%m-%d %H:%M')
  File "/usr/lib64/python3.5/_strptime.py", line 494, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "/usr/lib64/python3.5/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data '' does not match format '%Y-%m-%d %H:%M'

Comment 3 Jan Kurik 2016-07-26 04:23:43 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 4 Fedora End Of Life 2017-11-16 19:07:25 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2017-12-12 10:49:13 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.