[metapost] With prologues=3 and SVG output, METAPOST dies with SIGSEGV

luigi scarso luigi.scarso at gmail.com
Wed Dec 3 19:03:43 CET 2014


On Wed, Dec 3, 2014 at 10:17 AM, Wojciech A. Koszek <wkoszek at freebsd.org>
wrote:

> Hello,
>
> I wanted to document my solution to a problem from the ``Cracking the
> coding
> interview'' on measuring angles between clock's pointers. I have 1 figure
> for this for now, and METAPOST crashes when I try to compile my image.
>
> I figured it works fine with prologues=1 or 2 for both MPS and SVG output.
>
> For prologues=3 it works fine with MPS, but gets a SIGSEGV with SVG as an
> output.
>
> SVG
>
> Will finish OK:
>
>         wget -O bug_2.mp http://pastebin.com/5irnjVHB
>         mpost bug_2.mp
>
> No go and make g_use_svg = 1. It will fails with ``Segmentation fault''.
>
> My METAPOST:
>
>         wkoszek|1:08:06|0|/home/wkoszek/o/mp$ mpost --version
>
>         MetaPost 1.208
>         Copyright 2009 AT&T Bell Laboratories.
>         There is NO warranty.  Redistribution of this software is
>         covered by the terms of both the MetaPost copyright and
>         the Lesser GNU Lesser General Public License.
>         For more information about these matters, see the files
>         named COPYING, COPYING.LESSER and the MetaPost source.
>         Primary author of MetaPost: John Hobby.
>         Current maintainer of MetaPost: Taco Hoekwater.
>
> --
> Wojciech A. Koszek
> wkoszek at FreeBSD.czest.pl
> http://www.koszek.com/
> --
> http://tug.org/metapost/
>



prologues := 3;

g_use_svg = 1;

outputtemplate := "%j-%c.mps";
outputformat := "mps";
if g_use_svg > 0:
        outputtemplate := "%j-%c.svg";
        outputformat := "svg";
fi

beginfig(4);
        path            circle;

        % Scale everything
        w = 5in;

        % Plate
        pickup pencircle scaled 3;
        circle = fullcircle scaled 1w;
        draw circle;
        show circle;

        % Legend.
        pair    hours[];
        pair    twelve;
        rgbcolor c;
        c = (0.9, 0.1, 0.1);
        pickup pencircle scaled 10;
        twelve = (0, 0.9w/2);
        show twelve;
        for i = 0 upto 12:
                hours[i] = twelve rotated (30*i);
                draw hours[i] withcolor c;
                show hours[i];
                label.bot("x", hours[i]);
        endfor

        % Hour pointer.
        pickup pencircle scaled 10;
        drawarrow origin--(0, 0.70w/2) rotated -90;
        drawdot(w/2,w/2);
endfig;
end


# mpost bug.mp
This is MetaPost, version 1.902 (TeX Live 2014) (kpathsea version 6.2.0)

(/media/Iomega_Ext_Drive/opt/luatex/texlive/2014/texmf-dist/metapost/base/mpost
.mp
(/media/Iomega_Ext_Drive/opt/luatex/texlive/2014/texmf-dist/metapost/base/plain
.mp
Preloading the plain mem file, version 1.005) ) (./bug.mp
>> path (see the transcript file)
>> (0,161.9989)
>> (0,161.9989)
>> (-80.99945,140.29556)
>> (-140.29556,80.99945)
>> (-161.9989,0)
>> (-140.29556,-80.99945)
>> (-80.99945,-140.29556)
>> (0,-161.9989)
>> (80.99945,-140.29556)
>> (140.29556,-80.99945)
>> (161.9989,0)
>> (140.29556,80.99945)
>> (80.99945,140.29556)
>> (0,161.9989) [4{psfonts.map}<cmr10.pfb>] )
(see the transcript file for additional information)
1 output file written: bug-4.svg
Transcript written on bug.log.


it looks ok to me

-- 
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/metapost/attachments/20141203/05f61339/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-4.svg
Type: image/svg+xml
Size: 8337 bytes
Desc: not available
URL: <http://tug.org/pipermail/metapost/attachments/20141203/05f61339/attachment-0001.bin>


More information about the metapost mailing list