View Issue Details

IDProjectCategoryView StatusLast Update
0000525luatexluatex bugpublic2010-12-13 14:43
Reportervojta Assigned ToTaco  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Platformx86_32OSDebian LinuxOS Version2.6.36
Product Version0.64.0 
Fixed in Version0.65.0 
Summary0000525: Segmentation fault on 32-bit linux
DescriptionLuatex dies with a segmentation fault whenever it is run and tries to produce a (nonempty) pdf file. The problem is that pdfgen.w includes <kpathsea/c-auto.h>, but pdfpage.w does not, leading to inconsistencies in sizeof(off_t) and therefore in offsets of fields in the PDF structure.
Steps To Reproduceluatex story
Additional InformationThe following debugging session displays the problem:

| % gdb texk/web2c/luatex
| GNU gdb (GDB) 7.2-debian
| Copyright (C) 2010 Free Software Foundation, Inc.
| License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
| This is free software: you are free to change and redistribute it.
| There is NO WARRANTY, to the extent permitted by law. Type "show copying"
| and "show warranty" for details.
| This GDB was configured as "i486-linux-gnu".
| For bug reporting instructions, please see:
| <http://www.gnu.org/software/gdb/bugs/>...
| Reading symbols from /home/vojta/build/source6/texk/web2c/luatex...done.
| (gdb) break pdfgen.w:111
| Breakpoint 1 at 0x80a53b4: file ./luatexdir/pdf/pdfgen.w, line 111.
| (gdb) break pdfpage.w:43
| Breakpoint 2 at 0x80af013: file ./luatexdir/pdf/pdfpage.w, line 43.
| (gdb) run ../x
| Starting program: /home/vojta/build/source6/texk/web2c/luatex ../x
|
| Breakpoint 1, init_pdf_struct (pdf=0x8974c70) at ./luatexdir/pdf/pdfgen.w:112
| 112 init_pdf_pagecalculations(pdf);
| (gdb) print pdf
| $1 = (PDF) 0x8974c70
| (gdb) print &pdf->pstruct
| $2 = (pdfstructure **) 0x8974d40
| (gdb) cont
| Continuing.
|
| Breakpoint 2, init_pdf_pagecalculations (pdf=0x8974c70)
| at ./luatexdir/pdf/pdfpage.w:43
| 43 assert(pdf != NULL);
| (gdb) print pdf
| $3 = (PDF) 0x8974c70
| (gdb) print &pdf->pstruct
| $4 = (pdfstructure **) 0x8974d38
| (gdb)

Note that the offset of pdf->pstruct has changed!

This is LuaTeX, Version beta-0.64.0-2010112423 (rev 3962)
TagsNo tags attached.

Activities

vojta

2010-11-26 06:44

reporter   ~0000671

Correction: pdfpage.w does include c-auto.h, but it does so after <sys/types.h>, so the damage has already been done.

Taco

2010-11-26 10:00

administrator   ~0000673

The worrying thing here is how it is possible that sizeof(off_t) changes at all.

Paul, does simply swapping the includes fix the issue?

vojta

2010-11-28 02:33

reporter   ~0000680

Yes, swapping the includes fixes the problem, as in:

@@ -22,13 +22,13 @@
     "$Id: pdfpage.w 3733 2010-07-06 22:14:07Z hhenkel $ "
     "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfpage.w $";
 
+#include "ptexlib.h"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
 #include <math.h>
 
-#include "ptexlib.h"
-
 #define lround(a) (long) floor((a) + 0.5)
 
 @ eternal constants


As for "the worrying thing", I find the following comment in <kpathsea/config.h>:

/* config.h: master configuration file, included first by all compilable
   source files (not headers).

This is included by w2c/config.h, which contains a similar comment:

/* w2c/config.h: All .c files include this first.

This, in turn, is included by cpascal.h, which contains a similar message:

/* cpascal.h: implement various bits of standard and other Pascal that
   we use in the change files. Public domain.

   This is the top-level include file for all the web2c-generated C
   programs except TeX and Metafont themselves, which use texmf.h. It's
   not included by the web2c programs, though. */

This, in turn, is included by luatexdir/luatex.h, which is included by luatexdir/ptexlib.h, but neither of those includes a similar message.

And they should.

vojta

2010-11-28 02:40

reporter   ~0000681

P.S.: The reason that sizeof(off_t) changes (or, rather, the reason it varies between files) is that, if <kpathsea/c-auto.h> is included, then it does

#define _FILE_OFFSET_BITS 64

Then, in <features.h>, __USE_FILE_OFFSET64 gets set, which then affects the definition of off_t in <sys/types.h>.

Taco

2010-11-28 10:42

administrator   ~0000682

Fixed as proposed in the note, revision 3994.

Issue History

Date Modified Username Field Change
2010-11-25 09:08 vojta New Issue
2010-11-25 09:11 Taco Status new => assigned
2010-11-25 09:11 Taco Assigned To => hhenkel
2010-11-26 06:44 vojta Note Added: 0000671
2010-11-26 09:57 Taco Assigned To hhenkel => Taco
2010-11-26 10:00 Taco Note Added: 0000673
2010-11-28 02:33 vojta Note Added: 0000680
2010-11-28 02:40 vojta Note Added: 0000681
2010-11-28 10:42 Taco Note Added: 0000682
2010-11-28 10:42 Taco Status assigned => resolved
2010-11-28 10:42 Taco Resolution open => fixed
2010-12-13 14:43 Taco Fixed in Version => 0.65.0
2010-12-13 14:43 Taco Status resolved => closed