Files
MINGW-packages/mingw-w64-gobject-introspection/0027-wait-for-xml-parse-too.patch
Andrew Chadwick f41f0d52b5 g-i-parser: fix race condition (#1881)
* Remove rmtree debugging patch

It is shadowing exceptions thrown from the main "try" block of
GDumpParser._execute_binary_get_tree().

There does seem to be a race condition, but it seems to be related to
subprocess.check_call() and what it does on Windows. At the point
xml.[blah].parse() is called, "dump.xml" is often absent!

* More tolerant rmtreeing

If shutil.rmtree() is failing due to some funky race condition that results
in files the walk doesn't know about being left, then don't worry about it
and continue.

This may leave uniquely named junk lying around in the build tree, but that
is by design not a problem with g-i-scanner. Just don't install the
tmp-introspectXXXXXX folder by accident.

* giscanner debugging: asserts and waits

Make absence of dump.xml or functions.txt fatal, but only after giving them
plenty of time time to appear.

Yes, this is horrible code. But it fixes broken builds almost completely on
my 64-bit Win7 with NTFS.

* Wait for XML to be parsed completely

It's possible that dump.xml might exist but be incompletely written. This
nasty sleep-till-it-parses loop covers that case.

Plus the usual logging so we can see if it's really needed ☺

* gobject-introspection: bump pkgrel
2016-11-01 08:15:28 +03:00

21 lines
983 B
Diff

diff -rU2 gobject-introspection-1.50.0.orig/giscanner/gdumpparser.py gobject-introspection-1.50.0/giscanner/gdumpparser.py
--- gobject-introspection-1.50.0.orig/giscanner/gdumpparser.py 2016-10-31 00:07:38.852765600 +0000
+++ gobject-introspection-1.50.0/giscanner/gdumpparser.py 2016-10-31 00:30:29.243390600 +0000
@@ -199,5 +199,15 @@
assert os.path.exists(out_path), "dump.xml still missing"
- return parse(out_path)
+ # Just in case the XML data is not fully written at this point...
+ for i in range(10):
+ try:
+ return parse(out_path)
+ except Exception as e:
+ message.warn("XML parse failed (%d/10): %s" % (i+1, e))
+ if i >= 10:
+ raise
+ time.sleep(2)
+ raise RuntimeError("this exception should never happen")
+
finally:
if not utils.have_debug_flag('save-temps'):