After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 606282 - Race condition .xml2po.mo
Race condition .xml2po.mo
Status: RESOLVED DUPLICATE of bug 593175
Product: gnome-doc-utils
Classification: Deprecated
Component: build utils
0.18.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-doc-utils maintainers
gnome-doc-utils maintainers
Depends on:
Blocks:
 
 
Reported: 2010-01-07 02:12 UTC by Dima
Modified: 2010-01-07 21:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dima 2010-01-07 02:12:40 UTC
Possibly related to Bug 552158.

In the help/LL/ subdirs a .xml2po.mo file is produced with each invocation of xml2po with -p flag. During the same invocation translations from that file get merged into the target xml.

Now running make -j5 a race condition exists where one make job can overwrite .xml2po.mo in the lang directory if more than one source file exists (multiple mallard pages or multiple docbook_includes / entities).

This error is reproducible with random results. All depends on whether make managed or not overwrite .xml2po.mo or not and at what stage of xml2po run.

Possible solutions:

1) Create LL/.xml2po.LL.mo and reuse it in all subsequent xml2po invocation with -t flag instead of -p flag (more efficient as long as all translations are aggregated from all entities/pages)

2) Use mktemp for aneming .xml2po.mo (then the bug is in xml2po)

I'm not sure which one is better. I'm not an expert. And sorry I can't provide a patch make is very scary language. I use waf ;-) and discovered same issue cause I was mimicking make behaiviour except that waf runs in parallel by default hence I discovered this issue.

Sorry I'm behind low bandwidth and can't clone git repo to test using head.
Example errors using gnome-doc-utils 0.18 of two different projects:

With docbook:

if ! test -d fr/; then mkdir fr/; fi
if [ -f "C/onlinehelp.xml" ]; then d="../"; else d="/home/dmitrij/src/upstream/xiphos/trunk/help/"; fi; \
	po="fr/fr.po"; \
	if [ -f "${po}" ]; then po="../${po}"; else po="/home/dmitrij/src/upstream/xiphos/trunk/help/${po}"; fi; \
	(cd fr/ && \
	  `which xml2po` -m docbook -e -p "${po}" \
	    "${d}C/onlinehelp.xml" > onlinehelp.xml.tmp && \
	    cp onlinehelp.xml.tmp onlinehelp.xml && rm -f onlinehelp.xml.tmp)
Traceback (most recent call last):
  • File "/usr/bin/xml2po", line 185 in <module>
    main(sys.argv[1:])
  • File "/usr/bin/xml2po", line 171 in main
    xml2po_main.merge(mofile, filenames[0])
  • File "/usr/lib/pymodules/python2.6/xml2po/__init__.py", line 601 in merge
    self.gt = gettext.GNUTranslations(mfile)
  • File "/usr/lib/python2.6/gettext.py", line 180 in __init__
    self._parse(fp)
  • File "/usr/lib/python2.6/gettext.py", line 293 in _parse
    raise IOError(0, 'File is corrupt', filename)
IOError: [Errno 0] File is corrupt: '.xml2po.mo'

Or with mallard:

if ! test -d el/; then mkdir el/; fi
if [ -f "C/geolocation-supported.page" ]; then d="../"; else d="/home/dmitrij/src/empathy/help/"; fi; \
	po="el/el.po"; \
	if [ -f "${po}" ]; then po="../${po}"; else po="/home/dmitrij/src/empathy/help/${po}"; fi; \
	(cd el/ && \
	  `which xml2po` -m mallard -e -p "${po}" \
	    "${d}C/geolocation-supported.page" > geolocation-supported.page.tmp && \
	    cp geolocation-supported.page.tmp geolocation-supported.page && rm -f geolocation-supported.page.tmp)
Traceback (most recent call last):
  File "/usr/bin/xml2po", line 185, in <module>
    main(sys.argv[1:])
  File "/usr/bin/xml2po", line 171, in main
    xml2po_main.merge(mofile, filenames[0])
  File "/usr/lib/pymodules/python2.6/xml2po/__init__.py", line 601, in merge
    self.gt = gettext.GNUTranslations(mfile)
  File "/usr/lib/python2.6/gettext.py", line 180, in __init__
    self._parse(fp)
  File "/usr/lib/python2.6/gettext.py", line 273, in _parse
    magic = unpack('<I', buf[:4])[0]
struct.error: unpack requires a string argument of length 4
make: *** [el/audio-call.page] Error 1
make: *** Waiting for unfinished jobs....
Comment 1 Claude Paroz 2010-01-07 21:14:37 UTC
Thanks for taking the time to report this bug.
This particular bug has already been reported into our bug tracking system, but we are happy to tell you that the problem has already been fixed. It should be solved in the next software version. You may want to check for a software upgrade.

*** This bug has been marked as a duplicate of bug 593175 ***