[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1498947 - /subversion/trunk/tools/dev/po-merge.py

From: Dongsheng Song <dongsheng.song_at_gmail.com>
Date: Wed, 03 Jul 2013 14:20:09 +0800

On 2013/7/3 4:05, Andreas Stieger wrote:
> Hi There,
>
> On 02/07/13 16:00, Dongsheng Song wrote:
>> Today, when I merge zh_CN.po from trunk to 1.8.x, I had encounter the
>> following error:
>>
>> $ python ../../../../trunk/tools/dev/po-merge.py <
>> ../../../../trunk/subversion/po/zh_CN.po zh_CN.po
>> Traceback (most recent call last):
>> File "../../../../trunk/tools/dev/po-merge.py", line 196, in <module>
>> main(sys.argv)
>> File "../../../../trunk/tools/dev/po-merge.py", line 181, in main
>> for m in msgstr:
>> TypeError: 'NoneType' object is not iterable
>>
>> Then I found in the line 39-40 of po-merge.py return None as msgstr:
>>
>> if line.strip() == '' or line[:2] == '#~':
>> return comments, None, None, None
>>
>> So we should not do iteration on msgstr without make sure msgstr is
>> not None.
>>
>> This happened because zh_CN.po have msgmerged po comments like this:
>>
>> #~ msgid "Uncommitted local addition, copy or move%s"
>> #~ msgstr "未提交的本地增加,复制或移动 %s"
>>
>> As your judgement, this is not "obvious fix", should I revert this
>> commit ?
> I cannot make sense of this change other than when malformed input files
> are concerned. Your example "^#~" requires msgstr == None == msgid as
> per the return of parse_translation(). That, then, means that comments
> evaluates to true (has entries) for the break in line 153 not to trigger.
>
> Can you give to input files (URl/revisions) that trigger this? So far
> this is my best guess:
>
> #SOMETHING
> #~ msgid "some msgid"
> #~ msgstr "some msgstr"
>
> I agree that msgstr == None should not be iterated, however I don't see
> how we get to this case.
>
> Andreas

I lost the intermediate file at yesterday, but I can reproduce it by another way.

$ cd subversion/branches/1.8.x/subversion/po

$ cat << EOF >> zh_CN.po

#, fuzzy
#~ msgid ""
#~ "use format compatible with Subversion versions\n"
#~ " earlier than 1.8"
#~ msgstr "使用与1.4之前版本兼容的格式"
EOF

$ python ../../../../trunk/tools/dev/po-merge.py < ../../../../trunk/subversion/po/zh_CN.po zh_CN.po
0 strings updated. 179 fuzzy strings. 138 of 2546 strings are still untranslated (5%).
$ tail zh_CN.po
msgid "'%s' is of unknown type\n"
msgstr "“%s” 的类型未知\n"

#. Local uncommitted modifications, no revision info was found.
#: ../svnversion/svnversion.c:273
#, c-format
msgid "Uncommitted local addition, copy or move%s"
msgstr "未提交的本地增加,复制或移动 %s"

#, fuzzy

!!! got a malformed po file !!!

Received on 2013-07-03 08:21:11 CEST

This is an archived mail posted to the Subversion Dev mailing list.