texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] graphviz plugin broken?


From: Martin Costabel
Subject: Re: [Texmacs-dev] graphviz plugin broken?
Date: Fri, 02 Jan 2004 14:09:32 +0100
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6b) Gecko/20031208

Joris van der Hoeven wrote:

Happy new year to everybody!

Same to you!

I built TeXmacs-1.0.2.5 on FreeBSD 5.2-i386-RC2, with graphviz-1.10 and
found similar behavior, a crash during a graphviz session. TeXmacs has
no trouble displaying other postscript images (for example, the gnu head
on the welcome page is rendered correctly). On OS X, TeXmacs was also
able to render other postscript images.


And if you try to load the postscript generated by Graphviz as an image?

I did some tests (I have the same problem as Gregory, with texmacs-1.0.2.11 and graphviz-1.9 from Fink). It seems that ghostscript crashes, because the postscript output of tm_graphviz is systematically truncated at 1024 bytes.

The problem lies in this kind of dynamic buffering of the output of popen in the readfile() function. I don't know how realloc() works in Linux, but in Darwin, it makes the buffer jump around, i.e. after the first realloc, wbuf and buf are no longer pointing to the same place, in general, and disaster follows.

I made a test where I just malloc 1024*1000+1 instead of 1025 and fread() also 1024*1000 bytes, which should be sufficient for most cases (for "graph test {a}", the ps output is about 5KB long, so 1MB should go a long way). In this case, the realloc is not launched at all, and the result is that the graphviz shell seems to work correctly (Not speaking any graphviz, I cannot really test it, but the previously observed crashes are absent).

--
Martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]