To give the valuable information in the beginning: It appears it
cannot handle /Library/Fonts/NISC18030.ttf.  It tries to load it via
ft2font.FT2Font() but that gives the Bus error.  The ttf file dates to
28 Jan 2010.  It is 7108232 bytes large.  I don't know why it cannot
be loaded.

Until it had to recreate the fontcache, it never tried to load that.
It appears to me I used matplotlib since before that file appeared, or
at least matplotlib never tried to load it, or succeeded before in
loading it.  The "first bad" commit mentioned in the last email(s) was
that one introducing a mechanism to throw the fontcache away if the
matplotlib version number does not match the version number stored in
the fontcache.

2011/11/12 Friedrich Romstedt <friedrichromst...@gmail.com>:
> 2011/11/11 Michael Droettboom <md...@stsci.edu>:
>> Very odd.  Given there's no C++ changes here, I'm very surprised.  Shooting
>> in the dark here: does deleting ~/.matplotlib/fontList.cache help at all?

I guess it might have to do with it: Removing the font cache might
have made the "good" commit 8c200dab4680efd5201 fail.  Or rather
keeping the old font cache might have made the "good" commit not fail
in the beginning.  Whatever the causal relation is, I will try to
investigate playing with the existence of the font cache.

I want to verify that the existence of the fontcache file influences
the test result.


-==  Trying to verify the influcence of the fontcache file ==-

> I could not believe this and checked out the good commit once more,
> and this one .... fails now too ...

Verifying that there's no further magic, after a clean reboot (you
never know, and I went asleep), I'm trying both commits again, without
the font cache in action:

"good" 8c200dab4680efd5201: Bus error.
"bad" af9954d46e5d: Bus error.

So everything like yesterday evening, without the font cache.

Putting the font cache back into action now (from the moved file).
Keeping the moved file for reference (i.e., copying it).

"good" 8c200dab4680efd5201: Succeeding.
"bad" af9954d46e5d: Bus error.

So the existence of the font cache file makes the apparently "good"
commit succeeding, althought it probably shouldn't succeed.  It is a
pity that it's not vice versa: That the existence of the font cache
file would make the "bad" commit fail, s.t. it (and the current
matplotlib) would succeed without it.


-==  Bisecting again, this time without font cache file  ==-

Removing the font cache file again (keeping the copy).

-=  Trying to find some good commit in the past  =-

Trying 1982fba643 (one from 2009): Bus error.  This commit's test run
differs from the previous Bus errors by the following additional lines
from python2.6 -v:

# /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/commands.pyc
matches 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/commands.py
import commands # precompiled from
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/commands.pyc

This happens directly after importing ft2font.so.

Nevertheless it fails, so going further back to past ...

Trying the v0.99.0rc1 ac387d18b: Bus error.
This cannot be!  It is a commit back from 2009, and I used matplotlib that time!

Still keeping trying to find a commit not exhibiting the Bus error ...


-== The first commit from 2009 ==-

Trying the first from 2009 1dcaee87fc: Bus error.

I grep'ed for "import .*commands" in the lib/ folder, and found that
it is only used by font_manager.py, and in that file on non-win32
platforms only the body of the get_fontconfig_fonts imports it.  I
will augment that function body with prints to track it down.  It
appears it is the fontmanager that crashes.

Probably it issues some commands that makes Python crash, and when the
fontcache existed and was not versionchecked (before the former "bad"
commit), it was simply loaded.  Now it tried to rebuild it and fails
in that.  It was running the time I used it because I also had a
working font cache that time maybe.

For some reason the log output did not appear in the test.  Running
the test manually shows the log output.  What?  Apparently it is
missing because of some buffering issue.  If I pass the output through
a pipe, like when logging, apparently Python switches buffering.

It might well be that the buffering truncates the whole -v output.

Apparently the -v output goes to sys.stderr, and the sys.stdout is
buffered when piping.

Patching sys.stderr: ``python2.6 -v -c "import sys; sys.stderr =
open('x.txt', 'w'); import matplotlib.figure"``.  The -v output up to
the Python 2.6.5 statement goes to stdout, after that it goes to
stderr apparently.  The output to x.txt is truncated in the middle of
a sentence:

# /Library/Frameworks/Python.framework/Versions/2.6/lib/python

and does not contain the ``commands`` import log.  Turning buffering off:

python2.6 -v -c "import sys; sys.stderr = open('x.txt', 'w', 0);
import matplotlib.figure"

it ends again at the ``commands`` import.

It is noteworthy that the function augmented by the logging statements
exits cleanly.  The function is called in whole matplotlib only once,
in font_manager.py, in findSystemFonts().  There find SystemFonts()
loops over the return value, which is {}, so no looping at all.

The crash appears in FontManager.__init__() somewhere between loading
the ttffiles and loading the afmfiles.

The crash appears in createFontList().

Setting matplotlib's ``matplotlib.verbose`` to level 'debug_annoying'
via the cmdline script yields that the bus occures after the following
last log message:

createFontDict: /Library/Fonts/NISC18030.ttf

Augmenting the createFontList() function by print statements yields this:

createFontDict: /Library/Fonts/Arial Narrow.ttf
Friedrich: ft2font.FT2Font(/Library/Fonts/Arial Narrow.ttf) ...
Friedrich: ft2font.FT2Font(/Library/Fonts/Arial Narrow.ttf) succeeded.
createFontDict: /Library/Fonts/NISC18030.ttf
Friedrich: ft2font.FT2Font(/Library/Fonts/NISC18030.ttf) ...
./runtest.sh: line 1:  7150 Bus error               python2.6 -v -u -c
"import matplotlib; matplotlib.verbose.set_level('debug-annoying');
import matplotlib.figure" 2>&1

So it appears it cannot handle /Library/Fonts/NISC18030.ttf.

Any ideas?

Friedrich

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to