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

Wojciech A. Koszek wkoszek at FreeBSD.org
Thu Dec 4 04:08:16 CET 2014


On Wed, Dec 03, 2014 at 07:03:43PM +0100, luigi scarso wrote:
>    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:
> 
>      A  A  A  A  wget -O bug_2.mp http://pastebin.com/5irnjVHB
>      A  A  A  A  mpost bug_2.mp
> 
>      No go and make g_use_svg = 1. It will fails with ``Segmentation fault''.
> 
>      My METAPOST:
> 
>      A  A  A  A  wkoszek|1:08:06|0|/home/wkoszek/o/mp$ mpost --version
> 
>      A  A  A  A  MetaPost 1.208
>      A  A  A  A  Copyright 2009 AT&T Bell Laboratories.
>      A  A  A  A  There is NO warranty.A  Redistribution of this software is
>      A  A  A  A  covered by the terms of both the MetaPost copyright and
>      A  A  A  A  the Lesser GNU Lesser General Public License.
>      A  A  A  A  For more information about these matters, see the files
>      A  A  A  A  named COPYING, COPYING.LESSER and the MetaPost source.
>      A  A  A  A  Primary author of MetaPost: John Hobby.
>      A  A  A  A  Current maintainer of MetaPost: Taco Hoekwater.
>      --
>      Wojciech A. Koszek
>      wkoszek at FreeBSD.czest.pl
>      http://www.koszek.com/
>      --
>      http://tug.org/metapost/
> 
>    prologues := 3;
>    A 
>    g_use_svg = 1;
>    A 
>    outputtemplate := "%j-%c.mps";
>    outputformat := "mps";
>    if g_use_svg > 0:
>    A  A  A  A  outputtemplate := "%j-%c.svg";
>    A  A  A  A  outputformat := "svg";
>    fi
>    A 
>    beginfig(4);
>    A  A  A  A  path A  A  A  A  A  A circle;
>    A 
>    A  A  A  A  % Scale everything
>    A  A  A  A  w = 5in;
>    A 
>    A  A  A  A  % Plate
>    A  A  A  A  pickup pencircle scaled 3;
>    A  A  A  A  circle = fullcircle scaled 1w;
>    A  A  A  A  draw circle;
>    A  A  A  A  show circle;
>    A 
>    A  A  A  A  % Legend.
>    A  A  A  A  pair A  A hours[];
>    A  A  A  A  pair A  A twelve;
>    A  A  A  A  rgbcolor c;
>    A  A  A  A  c = (0.9, 0.1, 0.1);
>    A  A  A  A  pickup pencircle scaled 10;
>    A  A  A  A  twelve = (0, 0.9w/2);
>    A  A  A  A  show twelve;
>    A  A  A  A  for i = 0 upto 12:
>    A  A  A  A  A  A  A  A  hours[i] = twelve rotated (30*i);
>    A  A  A  A  A  A  A  A  draw hours[i] withcolor c;
>    A  A  A  A  A  A  A  A  show hours[i];
>    A  A  A  A  A  A  A  A  label.bot("x", hours[i]);
>    A  A  A  A  endfor
>    A 
>    A  A  A  A  % Hour pointer.
>    A  A  A  A  pickup pencircle scaled 10;
>    A  A  A  A  drawarrow origin--(0, 0.70w/2) rotated -90;
>    A  A  A  A  drawdot(w/2,w/2);
>    endfig;
>    end
>    # mpost bug.mpA 
>    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,

OK, I confirm that with 1.902 METAPOST this bug no longer exists. I will
have to upgrade my laptop.

-- 
Wojciech A. Koszek
wkoszek at FreeBSD.czest.pl
http://FreeBSD.czest.pl/~wkoszek/


More information about the metapost mailing list