Bug 581397

Summary: Updating zero-length PO files causes Publican to create corrupted PO files
Product: [Community] Publican Reporter: Ruediger Landmann <rlandman>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 1.6CC: jfearn, mmcallis, publican-list, r.landmann
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: publican-1.6.3-0.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-17 14:56:54 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Ruediger Landmann 2010-04-12 02:18:28 EDT
Description of problem:
If you run "publican update_po" and a zero-length file exists with the same name as one of the PO files that Publican would normally create or update, Publican updates the zero-length file with the correct msgid and (empty) msgstr entries, but without the normal PO file headers, making the file unusable.

Additionally, if the XML contained non-ASCII characters, these characters are simply dropped from the corresponding msgid entries.

Version-Release number of selected component (if applicable):
1.6.2

How reproducible:
100%

Steps to Reproduce:
1. Create a document and include a non-ASCII character in the XML somewhere
2. run "publican update_pot"
3. run "publican update_po --langs de-DE" 
4. open one of the PO files in the de-DE directory and delete the contents of the file (but not the file itself)
5. run "publican update_po --langs de-DE"
  
Actual results:
Publican updates the PO file that you emptied out in step 4, but the PO file contains no headers. Additionally, any UTF-8 characters in the XML file are simply dropped. (For example, the German word "für" ("for") becomes "fr"). During PO merging, Publican displays a warning similar to:

pot/Revision_History.pot:23: warning: The following msgid contains non-ASCII characters.
                                      This will cause problems to translators who use a character encoding
                                      different from yours. Consider using a pure ASCII msgid instead.
                                      für
pot/Revision_History.pot:23: invalid multibyte sequence
pot/Revision_History.pot:23: invalid multibyte sequence
pot/Revision_History.pot:23: invalid multibyte sequence
pot/Revision_History.pot:23: invalid multibyte sequence

Expected results:
Publican creates a valid PO file and does not drop content from the XML file.
Comment 1 Jeff Fearn 2010-04-12 02:42:27 EDT
Will now overwrite zero length PO files with POT file
Comment 2 Ruediger Landmann 2010-05-06 00:56:15 EDT
Confirmed working on version 1.6.3.t122
Comment 3 Fedora Update System 2010-05-13 18:20:40 EDT
publican-1.6.3-0.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/publican-1.6.3-0.fc13
Comment 4 Fedora Update System 2010-05-13 18:21:57 EDT
publican-1.6.3-0.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/publican-1.6.3-0.fc12
Comment 5 Fedora Update System 2010-05-15 16:36:19 EDT
publican-1.6.3-0.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update publican'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/publican-1.6.3-0.fc12
Comment 6 Fedora Update System 2010-05-15 16:45:35 EDT
publican-1.6.3-0.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update publican'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/publican-1.6.3-0.fc13
Comment 7 Fedora Update System 2010-05-17 14:55:32 EDT
publican-1.6.3-0.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 8 Fedora Update System 2010-05-17 14:59:24 EDT
publican-1.6.3-0.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.