Skip to content

Core dump with use.tex #2670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kyleam opened this issue Dec 11, 2013 · 11 comments
Closed

Core dump with use.tex #2670

kyleam opened this issue Dec 11, 2013 · 11 comments

Comments

@kyleam
Copy link

kyleam commented Dec 11, 2013

With the current master branch (16ed8be), I'm getting an error when text.usetex is set to true. It fails with this core dump.

Running git bisect suggests that f4adec7 ("Use six instead of 2to3") is the first bad commit. One hiccup is that the test script was also showing failure for the use of basestring in line 174 of texmanager.py, but if that line is replaced with a fix from a later commit (d042e90), f4adec7 still seems to be the first commit to show the error.

I've pushed the bisect command ran to this branch.
latex-plot-bisect/latex_plot.py should reproduce the error on the master branch, and run-latex-bisect.sh will run the whole bisect (although it may need to be tweaked because it assumes the presence of /tmp and passes the --user flag to python setup.py install.

I'd guess the error is coming from src/ft2cpp.{cpp,h}, but I don't have enough of a handle on those files to know which changes in f4adec7 are likely culprits.

Hopefully this can be reproduced on other systems. I'm running python 3.3.3 and numpy 1.9.0.dev-3aa76ba on Arch Linux.

Thanks

@mdboom
Copy link
Member

mdboom commented Dec 11, 2013

Unfortunately, I'm having trouble reproducing this on Fedora with python 3.3.3 and numpy 1.9.0.dev-3aa76ba. I suspect it's somehow related to the fonts (or lack thereof) on your system. Can you test with Python 2.x and see whether that also fails for you?

This may be related to #2635, and you could try applying the patch suggested there (which isn't really a fix, but it may move along to the root cause of the issue).

@mdboom
Copy link
Member

mdboom commented Dec 11, 2013

You may also want to try removing your font cache in ~/.cache/matplotlib/fontList.py3k.cache and see if that helps. Let us know if it does so we can work toward a true solution.

@kyleam
Copy link
Author

kyleam commented Dec 11, 2013

Thanks for response.

You may also want to try removing your font cache in
~/.cache/matplotlib/fontList.py3k.cache` and see if that helps.

I still get the failure after removing fontList.py3k.cache and
tex.cache. I've also tried removing .cache/fontconfig.

Unfortunately, I'm having trouble reproducing this on Fedora with python
3.3.3 and numpy 1.9.0.dev-3aa76ba. I suspect it's somehow related to the
fonts (or lack thereof) on your system.

That seems reasonable. It's interesting that a recent commit seems to be
exposing the issue. I'm seeing the error on two machines, but they are
set up very similarly, so that doesn't say much.

I have a record of how I customized the fonts, so I'll try to set those
back to the base install and then test from there.

Can you test with Python 2.x and see whether that also fails for you?

I should have included that information that in the initial report. It
also fails with a
core dump.

This may be related to #2635, and you could try applying the patch
suggested there (which isn't really a fix, but it may move along to
the root cause of the issue).

Thanks for pointing that out. Somehow I missed issue in my initial
searches. I'll have a look.

@kyleam
Copy link
Author

kyleam commented Dec 11, 2013

The main font changes I've made are installing ttf-droid fonts and
adding a custom .config/fontconfig/fonts.conf file. When I remove both
of these, I still get an error. Perhaps it's something not on my
system.

@mdboom
Copy link
Member

mdboom commented Dec 11, 2013

Or unexpected content in one of the fonts on your system.

You can print out the files that Freetype is trying to load by applying this patch:

diff --git a/src/ft2font.cpp b/src/ft2font.cpp
index 0fb3b8b..b048f28 100644
--- a/src/ft2font.cpp
+++ b/src/ft2font.cpp
@@ -854,6 +854,8 @@ FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds)
      * that we'll always be able to print. */
     std::string facefile = Py::String(args[0]).encode("unicode_escape");

+    printf("%s\n", facefile.c_str());
+
     args.verify_length(1);

     clear(Py::Tuple(0));

The last font printed may be the culprit. If you share that font with me (or I pull it from the Arch repo or something), I might be able to reproduce the problem here.

@WeatherGod
Copy link
Member

Just as a sanity check... did you delete the font cache after reverting
your font customizations?

On Wed, Dec 11, 2013 at 12:39 PM, Kyle Meyer notifications@github.comwrote:

The main font changes I've made are installing ttf-droid fonts and
adding a custom .config/fontconfig/fonts.conf file. When I remove both
of these, I still get an error. Perhaps it's something not on my
system.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2670#issuecomment-30342733
.

@kyleam
Copy link
Author

kyleam commented Dec 11, 2013

You can print out the files that Freetype is trying to load by applying this patch:

diff --git a/src/ft2font.cpp b/src/ft2font.cpp
index 0fb3b8b..b048f28 100644
--- a/src/ft2font.cpp
+++ b/src/ft2font.cpp
@@ -854,6 +854,8 @@ FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds)
      * that we'll always be able to print. */
     std::string facefile = Py::String(args[0]).encode("unicode_escape");

+    printf("%s\n", facefile.c_str());
+
     args.verify_length(1);

     clear(Py::Tuple(0));

The last font printed may be the culprit. If you share that font
with me (or I pull it from the Arch repo or something), I might be
able to reproduce the problem here.

The patch produces this output:

/usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb

I've copied the file here:
https://github.com/kyleam/matplotlib/blob/bisect-latex-plot-error/cmr12.pfb

@kyleam
Copy link
Author

kyleam commented Dec 11, 2013

On 12/11/13 12:54, Benjamin Root wrote:

Just as a sanity check... did you delete the font cache after reverting
your font customizations?

The post-install/uninstall hook of the ttf-droid Arch package runs this

post_install() {
echo -n "Updating font cache... "
fc-cache -f > /dev/null
mkfontscale /usr/share/fonts/TTF
mkfontdir /usr/share/fonts/TTF
echo "done."
}

I am also deleting .cache/fontconfig and
.cache/matploltlib/{fontList.py3k.cache,tex.cache}.

Are there any other files I should be concerned about?

@tacaswell
Copy link
Member

@kyleam What is the state of this?

@kyleam
Copy link
Author

kyleam commented Jan 24, 2014

What is the state of this?

I'm still seeing this with the current master (c16d2c2).

@kyleam
Copy link
Author

kyleam commented Mar 31, 2014

When I last tested this with b5a6c49, it was still failing, but this seems to be working with the current master (b8cb6c3).

@kyleam kyleam closed this as completed Mar 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants