Closed Bug 672029 Opened 11 years ago Closed 10 years ago

[compare-locales] Unable to parse .properties files with lots of comments at the end

Categories

(Mozilla Localizations :: Infrastructure, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: florian, Assigned: Pike)

References

Details

Attachments

(1 file)

When attempting to read this file https://hg.instantbird.org/l10n/pt-PT/file/ccfb2f1354e3/purple/myspace.properties compare-locales makes Python take 100% of the CPU for a very long time and ends up killed by our buildbot after 20 minutes without any output.
I thought I had a bug on this, but I can't find it.

The problem is that the regular expression in http://hg.mozilla.org/l10n/compare-locales/file/15f42a0ed926/lib/Mozilla/Parser.py#l268 doesn't cope will with lengthy comments. What in

re.compile('^(\s*)((?:[#!].*?\n\s*)*)(([^#!\s\n][^=:\n]*?)\s*[:=][ \t]*((?:[^\\\\]|\\\\.)*?))([ \t]*$\n?)',re.M|re.S)

makes that thing not scale, oh I don't know.
Duplicate of this bug: 724825
Attached patch PatchSplinter Review
This solves the issue for me. AFAICS, there is no reason why re.S ought to be used for that regex (that is, no reason for . to be including '\n')
Attachment #594988 - Flags: review?(l10n)
Comment on attachment 594988 [details] [diff] [review]
Patch

Thanks for trying to patch this.

Sadly, this patch makes Mozilla/tests/unitProperties.py fail. In a rather significant way, too, seems that the value turns into the complete line.
Attachment #594988 - Flags: review?(l10n) → review-
I guess I have a patch. Will take some time to regression test this, because, well, the old parser takes ages to create the reference data :-)
Assignee: nobody → l10n
http://hg.mozilla.org/l10n/compare-locales/rev/7ad5db5f3c8c has the parser fix, http://hg.mozilla.org/l10n/compare-locales/rev/c788da422d51 landed the gecko tests before that. FIXED, and released as part of 0.9.5
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
PS: The latest bn-IN build on the dashboard took 23 seconds like the rest, instead of 3 minutes+
You need to log in before you can comment on or make changes to this bug.