Opened 7 years ago

Closed 7 years ago

#53974 closed defect (fixed)

texlive-basic: dvips exits with trap 6

Reported by: slewsys (Andrew L. Moore) Owned by: drkp (Dan Ports)
Priority: Normal Milestone:
Component: ports Version:
Keywords: sierra Cc: mojca (Mojca Miklavec), diochnos, petermichor, josmithiii
Port: texlive-basic

Description

Dvips on macOS 10.12.4 exits with trap 6 building asymptote 2.41 documentation from MacPorts GitHub HEAD.

Dvips had no trouble building asymptote 2.40 last month (March, 2017). The only change that I can attribute is upgrading Xcode to version 8.3.1.

By swapping dvips from MacPorts with dvips (and only dvips) from MacTeX 2016, the asymptote build succeeds. Both MacPorts and MacTeX dvips are version 5.996.

Attaching asymptote build log. The log doesn't show dvips trap 6 (SIGABRT). That must be from a manual build...

Attachments (9)

main.log (702.6 KB) - added by slewsys (Andrew L. Moore) 7 years ago.
asymptote 2.41 failed build log using MacPorts dvips and Xcode 8.3.1
main.2.log (838.9 KB) - added by slewsys (Andrew L. Moore) 7 years ago.
asymptote 2.41 successful build log using MacTeX dvips and otherwise MacPorts texlive
Bode_.dvi (4.8 KB) - added by slewsys (Andrew L. Moore) 7 years ago.
Bode_.dvi => Bode_.ps via `dvips -R -Pdownload35 -D600 -O-128.4bp,522.983bp -T612bp,792bp -tletterSize -oBode_.ps Bode_.dvi'
Bode_.ps (120.1 KB) - added by slewsys (Andrew L. Moore) 7 years ago.
Expected result of processing Bode_.dvi
CAD1_.dvi (800 bytes) - added by slewsys (Andrew L. Moore) 7 years ago.
CAD1_.dvi => CAD1_.ps via `dvips -R -Pdownload35 -D600 -O-128.4bp,579.491bp -T612bp,792bp -tletterSize -oCAD1_.ps CAD1_.dvi'
CAD1_.ps (45.3 KB) - added by slewsys (Andrew L. Moore) 7 years ago.
Expected result of processing CAD1_.dvi
Bode_0.eps (28.7 KB) - added by slewsys (Andrew L. Moore) 7 years ago.
Encapsulated Post
CAD1_0.eps (4.5 KB) - added by slewsys (Andrew L. Moore) 7 years ago.
Encapsulated PostScript
dvips.patch (2.7 KB) - added by slewsys (Andrew L. Moore) 7 years ago.
Patch texk/dvipsk/color.c. Fixes ticket #53974

Download all attachments as: .zip

Change History (31)

Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment: main.log added

asymptote 2.41 failed build log using MacPorts dvips and Xcode 8.3.1

comment:1 Changed 7 years ago by slewsys (Andrew L. Moore)

Attaching successful build log of asymptote 2.41 build with MacTeX dvips. Only two changes here:

  • Append /Library/TeX/texbin to binpath in macports.conf.
  • Move ${prefix}/bin/dvips to ${prefix}/bin/dvips-dist.

Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment: main.2.log added

asymptote 2.41 successful build log using MacTeX dvips and otherwise MacPorts texlive

comment:2 Changed 7 years ago by mf2k (Frank Schima)

Owner: set to drkp
Status: newassigned

In the future, please Cc the port maintainers (port info --maintainers texlive-basic), if any.

comment:3 Changed 7 years ago by drkp (Dan Ports)

Status: assignedaccepted

I can reproduce this with xcode 8.3.1, but haven't been able to figure out the cause yet...

comment:4 Changed 7 years ago by mf2k (Frank Schima)

Owner: changed from drkp to mojca
Port: asymptote added
Status: acceptedassigned

comment:5 Changed 7 years ago by mf2k (Frank Schima)

Cc: mojca added
Owner: changed from mojca to drkp

comment:6 Changed 7 years ago by diochnos

Cc: diochnos added

comment:7 Changed 7 years ago by mojca (Mojca Miklavec)

Can you please also attach the dvi files in questions (for example CAD1_.dvi)?

Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment: Bode_.dvi added

Bode_.dvi => Bode_.ps via `dvips -R -Pdownload35 -D600 -O-128.4bp,522.983bp -T612bp,792bp -tletterSize -oBode_.ps Bode_.dvi'

Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment: Bode_.ps added

Expected result of processing Bode_.dvi

Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment: CAD1_.dvi added

CAD1_.dvi => CAD1_.ps via `dvips -R -Pdownload35 -D600 -O-128.4bp,579.491bp -T612bp,792bp -tletterSize -oCAD1_.ps CAD1_.dvi'

Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment: CAD1_.ps added

Expected result of processing CAD1_.dvi

comment:8 Changed 7 years ago by mojca (Mojca Miklavec)

Please also add CAD1_0.eps for completeness (otherwise it's impossible to run dvips on that file).

Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment: Bode_0.eps added

Encapsulated Post

Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment: CAD1_0.eps added

Encapsulated PostScript

comment:9 Changed 7 years ago by mojca (Mojca Miklavec)

This works for me. What happens if you run:

/opt/local/bin/dvips -R -Pdownload35 -D600 -O-128.4bp,579.491bp -T612bp,792bp -tletterSize -oCAD1_.ps CAD1_.dvi

(Adjust that to your prefix.)

It might be due to some "corrupt" configuration files.

comment:10 Changed 7 years ago by drkp (Dan Ports)

I can reproduce this but only after upgrading Xcode to 8.3.1 and rebuilding texlive-bin. It worked fine with an earlier xcode version.

I have no idea why this is, and I haven't had a chance to look into it yet...

comment:11 Changed 7 years ago by mojca (Mojca Miklavec)

Andrew, if you have time to test, would you perhaps be willing to compile the latest TL sources (from subversion) with Xcode 8.3.1?

svn://tug.org/texlive/trunk/Build/source

Then make a backup of the existing dvips binary and replace it with the freshly built one (it probably makes sense to replace the one inside MacTeX) and try to run dvips on the above files (don't bother with asymptote installation).

comment:12 Changed 7 years ago by drkp (Dan Ports)

Same issue with a svn build.

comment:13 Changed 7 years ago by mojca (Mojca Miklavec)

In that case I suspect some issue that's really specific to the latest compiler, potentially also related to gs. Note that dvips from MacTeX 2016 has been compiled on 10.6 with gcc 4.2, so a different stdlib is being used.

Asymptote is also reported to be broken in some aspects after being compiled on Yosemite.

It wouldn't be the first time: #43728.

comment:14 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: petermichor added
Keywords: sierra added
Port: asymptote removed
Summary: Dvips on macOS 10.12.4 exits with trap 6 building asymptote 2.41 documentationtexlive-basic: dvips exits with trap 6

Has duplicate #54126.

comment:15 Changed 7 years ago by diochnos

Just to add a small related comment, which may give an additional hint.

There appears to be a similar issue with dvipdf: it generates a pdf file, but the resulting pdf document is empty (one empty white page). This behavior started after upgrading to the latest Xcode version (8.3.32 / around April 19, or earlier). For example, you can try dvipdf Bode_.dvi with the file provided above.

Actually I have subscribed to this thread when my real issue is the dvipdf command.

comment:16 Changed 7 years ago by brunoomartin

dvips still exits with Abort trap: 6 after recompiling the texlive-basic @41271_0+doc with Xcode 8.3.2 on OSX 10.12.5 on a MPB mid 2015

Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment: dvips.patch added

Patch texk/dvipsk/color.c. Fixes ticket #53974

comment:17 Changed 7 years ago by slewsys (Andrew L. Moore)

Attachment fixes dvips SIGABRT when divps compiled with clang compiler. Caused by bad pointer declaration, most likely a typo. TODO: submit up-stream as needed.

comment:18 Changed 7 years ago by mojca (Mojca Miklavec)

The patch above points to the right direction, but doesn't seem to be entirely correct. Here's a revised patch written by Akira Kakuto. Can you please test that one?

  • texk/dvipsk/color.c

    old new  
    3737   struct colorpage *next;
    3838   integer boploc; /* we use the bop loc as a page indicator */
    3939   char *bg;
    40    char colordat[2];
     40   char *colordat;
    4141} *colorhash[COLORHASH];
    4242static char *cstack, *csp, *cend, *bg;
    4343/*
     
    8484   for (i=0; i<COLORHASH; i++) {
    8585      for (p=colorhash[i]; p; p = q) {
    8686         q = p->next;
     87         free(p->colordat);
    8788         free(p);
    8889      }
    8990      colorhash[i] = 0;
     
    216217      }
    217218   } else {
    218219      p = (struct colorpage *)mymalloc((integer)
    219                   (strlen(cstack) + sizeof(struct colorpage) + MAXCOLORLEN));
     220                  (sizeof(struct colorpage)));
     221      p->colordat = mymalloc(strlen(cstack) + MAXCOLORLEN + 2);
    220222      p->next = colorhash[h];
    221223      p->boploc = pageloc;
    222224      strcpy(p->colordat, cstack);

comment:19 in reply to:  18 Changed 7 years ago by slewsys (Andrew L. Moore)

Replying to mojca:

The patch above points to the right direction, but doesn't seem to be entirely correct. Here's a revised patch written by Akira Kakuto. Can you please test that one?

Akira's patch is correct. I was thinking that separately allocating colordat isn't necessary, but actually it is. The declaration colordat[2] was evidently a hack to avoid that allocation, but clang won't let you get away with it. So changing colordat to a single pointer and separately allocating/freeing it is correct. Thanks to Akira Kakuto for clear thinking :)

Last edited 7 years ago by slewsys (Andrew L. Moore) (previous) (diff)

comment:20 Changed 7 years ago by drkp (Dan Ports)

Seems to work fine with the texlive 2017 update I am working on. (I haven't tested it with the version in the regular ports tree yet; need to switch back to that first)

comment:21 Changed 7 years ago by josmithiii

Cc: josmithiii added

comment:22 Changed 7 years ago by drkp (Dan Ports)

Resolution: fixed
Status: assignedclosed

In ba3b0b2ac1bc2fca3326fa7d9bfd2e97f9b06d6a/macports-ports:

texlive-bin: fix dvips crash
Closes: #53974

Note: See TracTickets for help on using tickets.