[tlbuild] dvibook failure on Cygwin

Ken Brown kbrow1i at gmail.com
Fri Feb 24 15:20:49 CET 2012


On 2/24/2012 8:02 AM, Ken Brown wrote:
> On 2/24/2012 6:15 AM, Peter Breitenlohner wrote:
>> On Thu, 23 Feb 2012, Ken Brown wrote:
>>
>>> I just did a test build of the trunk (rev 25482) on Cygwin. The build
>>> went smoothly, but the dvibook test failed with a segfault:
>>>
>>> ...
>>>
>>> This may well be a Cygwin problem. But before digging further, I'd
>>> like to know whether anyone is seeing problems on other platforms.
>>
>> Hi Ken,
>>
>> these tests were introduced after the TL11 release, so it is quite
>> possible
>> that the Cygwin versions of dvibook and dvitodvi never worked. Can you
>> test that?
>
> Hi Peter,
>
> dvibook from TL11 fails in the same way, but dvitodvi works fine, both
> in TL11 and in my build from the current trunk.
>
>> Dvibook and dvitodvi use SeekFile() from seek.c containing Cygwin
>> specific
>> code and it is quite possible that this code doesn't work as it does on
>> Windows. Please have a look.
>
> All of that Cygwin specific code looks wrong to me, but removing it
> doesn't solve the problem: dvibook still segfaults (and dvitodvi still
> works). I'll try running dvibook under gdb to see if I can figure out
> what's going on.

This is really strange.  The segfault is occurring early in the program, 
in the processing of the argument -s4 to dvibook.  Here's the gdb session:

$ gdb ./dvibook
[...]
(gdb) b main
Breakpoint 1 at 0x402036: file ../../../texk/seetexk/dvibook.c, line 371.
(gdb) b atoi
Breakpoint 2 at 0x405410
(gdb) r -s4 playsel.dvi playbook.dvi
Starting program: 
/home/kbrown/src/texlive/Build/test/Work/texk/seetexk/dvibook -s4 
playsel.dvi playbook.dvi
[New Thread 1288.0xc2c]
[New Thread 1288.0x19d8]

Breakpoint 1, main (argc=4, argv=0x28cc30)
     at ../../../texk/seetexk/dvibook.c:371
371             char *outname = NULL;
(gdb) n
373             Signature = 0;
(gdb) n
375             ProgName = *argv;
(gdb) n
376             setbuf(stderr, serrbuf);
(gdb) n
378             while ((c = getopt(argc, argv, "i:o:s:q")) != EOF) {
(gdb) n
379                     switch (c) {
(gdb) n
398                             if (Signature != 0)
(gdb) n
400                             Signature = atoi(optarg);
(gdb) p optarg
$1 = 0x28cca9 "4"
(gdb) n

Breakpoint 2, atoi (s=0x0) at 
../../../../../src/newlib/libc/stdlib/atoi.c:70
70        return (int) strtol (s, NULL, 10);
(gdb) n
      10 [main] dvibook 1288 exception::handle: Exception: 
STATUS_ACCESS_VIOLATION
    1141 [main] dvibook 1288 open_stackdumpfile: Dumping stack trace to 
dvibook.exe.stackdump

Program received signal SIGSEGV, Segmentation fault.
_strtol_r (rptr=0x40010006, nptr=0x0, endptr=0x2, base=2670504)
     at ../../../../../src/newlib/libc/stdlib/strtol.c:152
152                     c = *s++;


Notice that s is null in the call to atoi.  So somehow optarg got 
changed to a null pointer.

I'll keep digging.

Ken


More information about the tlbuild mailing list