Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 185358 - app-text/xdvipdfmx segmentation fault with recent freetype-2 : bump to 0.4 + patch
Summary: app-text/xdvipdfmx segmentation fault with recent freetype-2 : bump to 0.4 + ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Joshua (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 195815
  Show dependency tree
 
Reported: 2007-07-14 23:49 UTC by Kazuo Teramoto
Modified: 2007-10-15 18:26 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix access to metrics tables (xdvipdfmx-0.4-ft2-internals.patch,3.00 KB, patch)
2007-07-18 13:18 UTC, Remy Oudompheng
Details | Diff
Ebuild for 0.4 (xdvipdfmx-0.4.ebuild,1.16 KB, text/plain)
2007-07-18 13:19 UTC, Remy Oudompheng
Details
Patch to fix access to metrics tables (with buffer initialiser) (xdvipdfmx-0.4-ft2-internals.patch,3.01 KB, patch)
2007-09-03 15:28 UTC, Dan Callaghan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kazuo Teramoto 2007-07-14 23:49:15 UTC
Hi!
The xdvipdfmx seg. fault when I try to convert any xdv to pdf.
But if a dl the binary provided on Xetex site in rpm format it works great.
Using Texlive 2007 (but I think the problem is related to amd64 because a see reports of xdvipdfmx working with Gentoo+Texlive+32bits)

emerge --info
Portage 2.1.3_rc8 (default-linux/amd64/2007.0/desktop, gcc-4.1.2, glibc-2.5-r4, 2.6.19-gentoo-r4 x86_64)
=================================================================
System uname: 2.6.19-gentoo-r4 x86_64 AMD Turion(tm) 64 Mobile Technology ML-34
Gentoo Base System release 1.12.10
Timestamp of tree: Fri, 13 Jul 2007 00:20:01 +0000
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.22
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=athlon64 -pipe -msse3"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -march=athlon64 -pipe -msse3"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans"
GENTOO_MIRRORS="ftp://ftp.las.ic.unicamp.br/pub/gentoo/ http://adelie.polymtl.ca/"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LINGUAS="en pt_BR"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/overlays/sci-gentoo /usr/local/overlays/musicbrainz-overlay /usr/local/overlays/xgl-coffee /usr/local/overlays/einit-overlay /usr/local/overlays/initng"
SYNC="rsync://rsync.samerica.gentoo.org/gentoo-portage"
USE="3dnow X aac acl acpi alsa amd64 audiofile bash-completion berkdb bitmap-fonts blas bluetooth bzip2 cairo cdr cjk cli cracklib crypt cups dbus dga doc dri dv dvd dvdr dvdread eds emboss emul-linux-x86 encode esd evo exif fam ffmpeg fftw firefox flac fortran ftp gcj gd gdbm gif gmp gnutls gpm gsl gstreamer gtk gtk2 hal iconv ieee1394 imagemagick imlib immqt-bc ipv6 isdnlog javascript jingle jpeg kde kdehiddenvisibility kdexdeltas kerberos kipi lapack lcms ldap libg++ lua mad matroska midi mikmod mmx mp3 mpeg mpi mudflap ncurses nls nowin nptl nptlonly ogg opengl openmp oss pam pcmcia pcre pdf perl png pppd python qt qt3 qt3support qt4 quicktime readline reflection sdl session slang spell spl sqlite sqlite3 sse sse2 sse3 ssl svg tcltk tcpd tetex threads tiff truetype truetype-fonts type1-fonts udev unicode usb vcd vim-pager vim-syntax vim-with-x visualization vorbis wifi x264 xcomposite xml xml2 xorg xscreensaver xv xvid zlib" ALSA_CARDS="atiixp" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INITNG_PLUGINS="also bash_launcher chdir chroot conflict cpout critical ctrlaltdel daemon_clean debug_commands envparser find fmon fstat history idleprobe initctl interactive iparser last limit lockfile logfile netdev netprobe ngc4 ngcs nge pause provide reload renice rlparser simple_launcher stcmd stdout suid syncron syslog sysreq unneeded usplash" INPUT_DEVICES="keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en pt_BR" USERLAND="GNU" VIDEO_CARDS="radeon fbdev vesa"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Thanks!

Reproducible: Always
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-07-15 04:13:28 UTC
Can you attach a backtrace please?

http://www.gentoo.org/proj/en/qa/backtraces.xml
Comment 2 Kazuo Teramoto 2007-07-15 09:47:04 UTC
(In reply to comment #1)
> Can you attach a backtrace please?
> 
> http://www.gentoo.org/proj/en/qa/backtraces.xml
> 
Sorry. the bt

#0  0x000000000041b674 in do_glyph_array (yLocsPresent=<value optimized out>) at dvi.c:1915
#1  0x000000000041c6ac in dvi_do_page (n=0, paper_width=<value optimized out>, paper_height=<value optimized out>, hmargin=<value optimized out>, vmargin=<value optimized out>) at dvi.c:2175
#2  0x000000000041e6e0 in main (argc=<value optimized out>, argv=<value optimized out>) at dvipdfmx.c:705
Comment 3 Kazuo Teramoto 2007-07-17 21:22:49 UTC
I discussion about this seg. fault is running on the xetex ml, I don't look like a upstream problem.

Thanks.
Comment 4 Joshua (RETIRED) gentoo-dev 2007-07-18 09:34:02 UTC
Can you please let me know what version of freetype you are using?  There appear to be some incompatible changes to freetype that may be causing the problems.  I've been discussing this with the author already.

Also, if you could revert to freetype-2.1.10-r3 and retest that would be very helpful.

Oh, and apologies for the delay in answering.  I have infrequent access to the net at the moment.
Comment 5 Remy Oudompheng 2007-07-18 09:37:57 UTC
Changing disable to enable at the line
  enable_option FT_CONFIG_OPTION_OLD_INTERNALS
in the freetype ebuild fixes the problems.

Seems like there is some black magic in the xdvipdfmx code relying upon that.
Comment 6 Remy Oudompheng 2007-07-18 13:18:00 UTC
Created attachment 125254 [details, diff]
Patch to fix access to metrics tables

This patches the dependency on FreeType internals in xdvipdfmx
Comment 7 Remy Oudompheng 2007-07-18 13:19:23 UTC
Created attachment 125256 [details]
Ebuild for 0.4
Comment 8 Kazuo Teramoto 2007-07-18 20:28:38 UTC
(In reply to comment #4)
> Can you please let me know what version of freetype you are using?  There
> appear to be some incompatible changes to freetype that may be causing the
> problems.  I've been discussing this with the author already.
> 
> Also, if you could revert to freetype-2.1.10-r3 and retest that would be very
> helpful.
> 

I'm using 2.3.5 reverting to 2.1.10-r3 solves the problem and using the patch provided too.
Comment 9 Constantin Baranov 2007-09-03 14:54:44 UTC
Yes, xdvipdfmx-0.4 works with provided ebuild and patch.
Comment 10 Dan Callaghan 2007-09-03 15:24:33 UTC
Remy's ebuild and patch work nicely for me (thanks!), apart from a minor error which results in a glibc double free when generating PDFs containing certain types of fonts, like this:

*** glibc detected *** /usr/bin/xdvipdfmx: double free or corruption (out): 0x00000000004236e0 ***
======= Backtrace: =========
/lib/libc.so.6[0x2ba10ed74b1d]
/lib/libc.so.6(__libc_free+0x76)[0x2ba10ed76146]
/usr/bin/xdvipdfmx[0x41b9e5]
/usr/bin/xdvipdfmx[0x41ca7c]
/usr/bin/xdvipdfmx[0x41eab0]
/lib/libc.so.6(__libc_start_main+0xf4)[0x2ba10ed27374]
/usr/bin/xdvipdfmx[0x403299]

The error is at src/dvi.c:1904 in the patched sources (corresponds to line 20 of Remy's patch). buffer is declared without an initialiser, but then conditionally allocated (dvi.c:1916), and then unconditionally freed (dvi.c:1971). This causes a double-free when the condition at dvi.c:1906 is false, which apparently happens for some fonts.

The trivial fix is to add an initialiser to the declaration of buffer:

  FT_Byte *buffer = NULL;

since free(NULL) is a noop.

I will attach an updated patch.
Comment 11 Dan Callaghan 2007-09-03 15:28:55 UTC
Created attachment 129925 [details, diff]
Patch to fix access to metrics tables (with buffer initialiser)

Obsoletes the previous patch, with a minor bug fix.

Bugzilla won't let me mark the old one as obsolete? :-(
Comment 12 Alexis Ballier gentoo-dev 2007-10-14 19:04:16 UTC
Hi Joshua, 
I hope you'll read this because you're currently marked away :/
I'll need this to have xetex on texlive working fine (plus some virtual/tetex -> virtual/latex-base changes)

the patch I have been using for some time in my overlay is basically what you get by typing 
svn diff -r92:93 http://scripts.sil.org/svn-public/xdvipdfmx/TRUNK/

and you can get it here :
http://overlays.gentoo.org/dev/aballier/browser/texlive-overlay/app-text/xdvipdfmx/files/xdvipdfmx-0.4-ft2-internals.patch

plus this needs a version bump to 0.4


If you can't answer, I hope you won't mind if I fix the bug ;)
Comment 13 Joshua (RETIRED) gentoo-dev 2007-10-15 00:19:35 UTC
(In reply to comment #12)
> Hi Joshua, 
> I hope you'll read this because you're currently marked away :/
> I'll need this to have xetex on texlive working fine (plus some virtual/tetex
> -> virtual/latex-base changes)
>
> the patch I have been using for some time in my overlay is basically what you
> get by typing 
> svn diff -r92:93 http://scripts.sil.org/svn-public/xdvipdfmx/TRUNK/
> 
> and you can get it here :
> http://overlays.gentoo.org/dev/aballier/browser/texlive-overlay/app-text/xdvipdfmx/files/xdvipdfmx-0.4-ft2-internals.patch
> 
> plus this needs a version bump to 0.4
> 
> 
> If you can't answer, I hope you won't mind if I fix the bug ;)
> 

   If you can test, then feel free to commit the patch.  I'm just getting ready to come back, having finally got a working machine and looking at hopefully having some time, but I'm not protective of my ebuilds.  Next step will be to get enough net access to get the tree up and running again.  I can only test it on amd64 now, so can't do that much extra testing.

   So go for it.
Comment 14 Alexis Ballier gentoo-dev 2007-10-15 18:26:09 UTC
(In reply to comment #13)

>    So go for it.


thanks, I've commited it.

could you please ping/mail me once you're back ? I've enabled xetex in texlive, as it was stated on xetex website that it would be maintained there, but as far as I can see we can still fetch the same versions as those in texlive from sil.org and having xetex enabled in texlive triggers some circular deps with some fontconfig deps + use doc, they need a latex compiler to build their docs...

for the time being, I'll try to have something clean and working on my side