Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 302273 - dev-tex/luatex-0.50.0 /usr/bin/luatex segfaults
Summary: dev-tex/luatex-0.50.0 /usr/bin/luatex segfaults
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: TeX project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 301943
  Show dependency tree
 
Reported: 2010-01-26 03:34 UTC by Jeroen Roovers (RETIRED)
Modified: 2010-02-04 10:33 UTC (History)
2 users (show)

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


Attachments
gdb backtrace [hppa] (luatex.gdb.out,1.61 KB, text/plain)
2010-01-26 03:35 UTC, Jeroen Roovers (RETIRED)
Details
build log (20100203-075912.log.gz,25.31 KB, application/octet-stream)
2010-02-03 15:46 UTC, Jeroen Roovers (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Roovers (RETIRED) gentoo-dev 2010-01-26 03:34:25 UTC
app-text/poppler-data-0.2.1
app-text/poppler-utils-0.10.7
dev-libs/poppler-0.10.7
dev-libs/poppler-glib-0.10.7
dev-libs/poppler-qt4-0.10.7
virtual/poppler-0.10.7
virtual/poppler-glib-0.10.7
virtual/poppler-qt4-0.10.7
virtual/poppler-utils-0.10.7
media-libs/libpng-1.2.40
dev-libs/zziplib-0.13.49-r1
sys-libs/zlib-1.2.3-r1
dev-tex/luatex-0.50.0

Tue Jan 26 04:32:51 CET 2010
Portage 2.1.7.16 (default/linux/hppa/10.0, gcc-4.2.4, glibc-2.10.1-r1, 2.6.32-gentoo-JeR parisc)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.32-gentoo-JeR-parisc-PA8700_-PCX-W2-with-gentoo-2.0.1
Timestamp of tree: Mon, 25 Jan 2010 16:15:01 +0000
distcc 3.1 hppa2.0-unknown-linux-gnu [enabled]
app-shells/bash:     4.0_p35
dev-lang/python:     2.6.4, 3.1.1-r1
dev-python/pycrypto: 2.1.0_beta1
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.0-r1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-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.2
sys-devel/binutils:  2.18-r3, 2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="hppa"
ACCEPT_LICENSE="* -@EULA"
CBUILD="hppa2.0-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mschedule=8000 -march=2.0 -ggdb -Wall"
CHOST="hppa2.0-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib/fax /usr/share/X11/xkb /usr/share/config /var/bind /var/spool/fax/etc /var/spool/torque /var/www/localhost/htdocs/wordpress/wp-config.php"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -mschedule=8000 -march=2.0 -ggdb -Wall"
DISTDIR="/newaches/gentoo/distfiles"
FEATURES="assume-digests autoaddcvs buildpkg cvs distcc distlocks fixpackages news notitles parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict test test-fail-continue unmerge-logs unmerge-orphans userfetch userpriv"
GENTOO_MIRRORS="http://de-mirror.org/distro/gentoo/ http://mirror.netcologne.de/gentoo/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://gentoo.tiscali.nl/ "
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="en nl he"
MAKEOPTS="-j4"
PKGDIR="/keeps/gentoo/packages/elmer"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/dev/shm/"
PORTDIR="/keeps/gentoo/portage"
PORTDIR_OVERLAY="/keeps/gentoo/local"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="7zip X Xaw3d a52 aac aalib abyss accessibility acl ads agg alsa amr amrnb amrwb ao aoss apache2 ares artist-screen asf assistant async asyncns audiofile audit automount avfs bash-completion berkdb bidi bittorrent bittorrent-external bl bluetooth bzip2 c++ cairo caps captury catalogs cblas cdb cddb cdparanoia cdr chardet cjk clarens cleartype cli colors contrast cracklib crypt cups curl custom-cflags custom-cxxflags cxx dbi dbtool dbus designer designer-plugin device-mapper dga dia dirac directfb djbfft djvu domainkeys dri drm dts dv dvd dvdr dvdread ebook edl elf emacs enca encode esd examples exif expat facebook fame fastbuild fastcgi fbcon ffmpeg filter fits flac fluidsynth fontconfig foomaticdb fortran ftp fts3 gadu galago gcrypt gd gdbm geant4 geoip ggi gif gimp gimpprint glep glib glut gmp gnokii gnome gnutls gphoto2 gpm gps gs gsl gsm gtk gtk2 gtkhtml guidexml guile hal hepmc hesiod hotpixels hppa i18n ical icecast iconv icu idea idn imagemagick imlib indi inquisitio ipv6 isc ithreads jabber jack javascript jbig jingle jpeg jpeg2k judy kde kerberos kpathsea lapack lasi latex lcms ldap leim lensfun libass libcaca libffi libmms libnotify libotf libsamplerate libwww live lm_sensors logrotate logwatch lua lyrics-screen lzo mad manhole matroska mbrola mem-scramble memcache metis mhash midi mikmod mmap mng modplug modules motif mozbranding mp3 mplayer mssql mudflap musepack musicbrainz mysql nagios-dns nagios-game nagios-ntp nagios-ping nagios-ssh nas nautilus ncurses netpbm network-cron nfconntrack nfs nls nntp nova nptl nptlonly nsplugin ntlm offensive ogg openal openexr opengl openmp openssl oss ots overlays pam pango pbs pch pcre pdf pdo-external perl php plasma plotutils plugins png policykit portage portaudio postgres povray ppds pppd pulseaudio python pyzord qalculate qdbm qt3support qt4 quotas raw readline recode reflection rle rpc rrdtool rtc ruby ruby18 ruby19 samba sasl scanner schroedinger scim sdl seamonkey server session sid slang slp sms sndfile snmp soap song-screen soundex speex spell spl spoof-source sqlite srt srtp ssh ssl startup-notification subtitles subversion suhosin supernodal svg swat sysfs syslog talkfilters tcl tcpd test tftp tga theora threads thumbnail thunar-vfs tidy tiff timezone timidity tk tokyocabinet tools truetype tslib tunepimp twolame udev unicode unzip urandom usb userlocales utempter utf v4l v4l2 vanim vcd vidix vim-syntax vorbis watchdog wavpack webdav webinstall winbind wlan wma wmf xanim xattr xcb xchattext xcomposite xface xml xml2 xmp xmpi xorg xpm xrandr xscreensaver xsettings xulrunner xv xvid xvmc zip zip-external zlib" ALSA_CARDS="ad1889 usb-audio" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_ftp proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev joystick keyboard mouse acecad aiptek calcomp citron digitaledge dmc dynapro elo2300 elographics fpit hyperpen jamstudio magellan microtouch mutouch palmax penmount spaceorb summa synaptics tek4957 tslib ur98 virtualbox wacom void" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en nl he" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="stifb fbdev none dummy" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

dev-tex/luatex-0.50.0 was built with the following:
USE="test -doc"
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2010-01-26 03:35:13 UTC
Created attachment 217436 [details]
gdb backtrace [hppa]
Comment 2 Alexis Ballier gentoo-dev 2010-01-26 09:09:57 UTC
is that just running luatex without argument?

snippet of code:
    pdfstructure *p;
    int decimal_digits = pdf->decimal_digits;
    assert(pdf != NULL);
    if (pdf->pstruct == NULL)
        pdf->pstruct = xmalloc(sizeof(pdfstructure));
    p = pdf->pstruct;
    setpdffloat(p->pdf.h, 0, decimal_digits);
    setpdffloat(p->pdf.v, 0, decimal_digits);
    p->cw.e = 1;
    p->fs_cur.e = p->fs.e = decimal_digits + 2; 


it seems it segfaults on the last line. Whats the value of 'p' here?
Or rather, since it doesnt seem to segfault on p->cw dereferences, why does it segfault on p->fs_cur ?

What are the sizes of the 'unsigned' and 'size_t' types on hppa?
xmalloc takes unsigned and gives it to malloc which takes a size_t, maybe this is the cause and not enough memory is allocated but i doubt it.
What's the value of sizeof(pdfstructure) for you?
Comment 3 Alexis Ballier gentoo-dev 2010-01-26 09:10:42 UTC
Ho, and what is your texlive-core version?
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2010-01-26 16:25:48 UTC
(In reply to comment #2)
> is that just running luatex without argument?

Yes.

> snippet of code:
>     pdfstructure *p;
>     int decimal_digits = pdf->decimal_digits;
>     assert(pdf != NULL);
>     if (pdf->pstruct == NULL)
>         pdf->pstruct = xmalloc(sizeof(pdfstructure));
>     p = pdf->pstruct;
>     setpdffloat(p->pdf.h, 0, decimal_digits);
>     setpdffloat(p->pdf.v, 0, decimal_digits);
>     p->cw.e = 1;
>     p->fs_cur.e = p->fs.e = decimal_digits + 2; 
> 
> 
> it seems it segfaults on the last line. Whats the value of 'p' here?
> Or rather, since it doesnt seem to segfault on p->cw dereferences, why does it
> segfault on p->fs_cur ?
> 
> What are the sizes of the 'unsigned' and 'size_t' types on hppa?
> xmalloc takes unsigned and gives it to malloc which takes a size_t, maybe this
> is the cause and not enough memory is allocated but i doubt it.
> What's the value of sizeof(pdfstructure) for you?

I'm not an expert on the usage of gdb, but here goes:

(gdb) print sizeof(pdfstructure)
$1 = 216
(gdb) print sizeof(pdf)
$2 = 4
(gdb) print sizeof(p)
$3 = 4
(gdb) print sizeof(size_t)
$4 = 4
(gdb) print sizeof(unsigned int)
$5 = 4

I'll recompile without optimisation to maybe achieve better output.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2010-01-26 16:39:47 UTC
(In reply to comment #3)
> Ho, and what is your texlive-core version?

app-text/texlive-core-2008-r7
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2010-01-26 16:53:43 UTC
With -O0:

(gdb) run
Starting program: /usr/bin/luatex 

Program received signal SIGSEGV, Segmentation fault.
0x0005471c in init_pdf_pagecalculations (pdf=0xa75e10) at luatexdir/pdf/pdfpage.c:46
46      luatexdir/pdf/pdfpage.c: No such file or directory.
        in luatexdir/pdf/pdfpage.c
(gdb) thread apply all bt full

Thread 1 (process 16978):
#0  0x0005471c in init_pdf_pagecalculations (pdf=0xa75e10)
    at luatexdir/pdf/pdfpage.c:46
        p = 0x2710
        decimal_digits = 4
        __PRETTY_FUNCTION__ = "init_pdf_pagecalculations"
#1  0x0004922c in init_pdf_struct (pdf=0xa75e10) at luatexdir/pdf/pdfgen.c:107
        __PRETTY_FUNCTION__ = "init_pdf_struct"
#2  0x0007cf8c in initialize () at luatexdir/tex/maincontrol.c:3440
        k = 10832136
        __PRETTY_FUNCTION__ = "initialize"
#3  0x0006f340 in main_initialize () at luatexdir/tex/mainbody.c:384
        bad = 0
#4  0x0006f464 in main_body () at luatexdir/tex/mainbody.c:402
No locals.
#5  0x00038788 in main (ac=1, av=0xfb3b1028) at luatexdir/luatex.c:430
No locals.
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2010-02-03 15:46:05 UTC
Created attachment 218301 [details]
build log
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2010-02-03 17:49:26 UTC
One thing to note is that the PARISC stack grows up, not down as most architectures have it. It doesn't look like the luatex build system checks for this, and maybe xmalloc assumes it grows down.

Of course, it is also interesting that 0.30.* never had this problem.
Comment 9 Raúl Porcel (RETIRED) gentoo-dev 2010-02-03 18:57:20 UTC
Same on sparc...maybe big-endian issues? And in my case is running 'luatex' without any argument
Comment 10 Alexis Ballier gentoo-dev 2010-02-04 08:48:13 UTC
Look at the following patch:

Index: luatex-beta-0.50.0/source/texk/web2c/luatexdir/pdf/pdfgen.c
===================================================================
--- luatex-beta-0.50.0.orig/source/texk/web2c/luatexdir/pdf/pdfgen.c
+++ luatex-beta-0.50.0/source/texk/web2c/luatexdir/pdf/pdfgen.c
@@ -24,6 +24,7 @@ static const char __svn_version[] =
 #include "ptexlib.h"
 #include <ctype.h>
 #include "md5.h"
+#include <stdio.h>
 
 /* for tokenlist_to_cstring */
 
@@ -104,6 +105,7 @@ PDF init_pdf_struct(PDF pdf)
     init_dest_names(pdf);
     pdf->resources = NULL;
 
+    printf("%p\n", pdf->pstruct);
     init_pdf_pagecalculations(pdf);
 
     return pdf;
Index: luatex-beta-0.50.0/source/texk/web2c/luatexdir/pdf/pdfpage.c
===================================================================
--- luatex-beta-0.50.0.orig/source/texk/web2c/luatexdir/pdf/pdfpage.c
+++ luatex-beta-0.50.0/source/texk/web2c/luatexdir/pdf/pdfpage.c
@@ -37,6 +37,7 @@ static const char __svn_version[] =
 
 void init_pdf_pagecalculations(PDF pdf)
 {
+    printf("%p\n", pdf->pstruct);
     pdfstructure *p;
     int decimal_digits = pdf->decimal_digits;
     assert(pdf != NULL);


The two printf should print the same thing. However, on bender, what I get is:
# luatex
(nil)
0x2710
Segmentation fault

So the value changed during the init_pdf_pagecalculations call; this is really weird. Since 0x2710 != NULL, it doesn't get malloc'ed and hence the segfault.

In gdb, in the function init_pdf_struct sizeof(*pdf) is 624. In function init_pdf_pagecalculations, sizeof(*pdf) is 604. So this is probably what breaks it.
Comment 11 Alexis Ballier gentoo-dev 2010-02-04 09:25:52 UTC
what is fun, if I print *pdf in these functions:

from  init_pdf_struct, interesting parts are:
 mem_size = 10000, mem = 0x99c350, mem_ptr = 1, pstruct = 0x0, posstruct = 0x93c6a8
from init_pdf_pagecalculations:
 mem_size = 0, mem = 0x0, mem_ptr = 0, pstruct = 0x2710, posstruct = 0x99c350


remark that mem in the first one is equal to posstruct in the second.
mem_size = 10000 = 0x2710, thus the first mem_size is equal to the second pstruct.
Comment 12 Alexis Ballier gentoo-dev 2010-02-04 09:29:18 UTC
(In reply to comment #10)
> In gdb, in the function init_pdf_struct sizeof(*pdf) is 624. In function
> init_pdf_pagecalculations, sizeof(*pdf) is 604. So this is probably what breaks
> it.

On x86_64 and ppc64 those are the same. On x86 they differ.
Comment 13 Alexis Ballier gentoo-dev 2010-02-04 10:33:42 UTC
so it turned up that it was largefile support again... there was a mismatch between various headers and thus causing sizeof(off_t) mismatches between different .c files. This is fixed in -r1