Coredump with Tcl 8.4.X (possibly binary scan)

From: Paul Obermeier (obermeier_at_poSoft.de)
Date: 11/30/03


Date: Sun, 30 Nov 2003 21:07:48 +0100

Hi,

While working with the fileType function of TclLib, I encountered
core dumps on both Linux and Windows with different versions of
Tcl 8.4 (8.4.2, 8.4.4, 8.4.5).
The same code works with Tcl 8.3 on both platforms.

I succeeded to strip down the problem to the following code:
This code applied to the four (identical) image files supplied as an
attachment, dumps core.
You can avoid dumping core by
1. replacing the binary scan command as noted in the code or
2. by commenting out the line "set s [file size $filename]"

Could somebody please check, if this happens on machines other than mine.

foreach filename [glob *.ppm] {
    puts "Reading file $filename"
    if { [ catch {
 set fid [ open $filename r ]
    } err ] } {
 error "::fileutil::fileType: $err"
    }

    fconfigure $fid -translation binary
    seek $fid -16 end
    set test [ read $fid 16 ]
    ::close $fid

    set hdroffset 0
    puts "\tBefore binary scan" ; flush stdout

    binary scan $test IIII d hdroffset d d

    # Replacing above statement with the following works well.
    # binary scan $test IIII d1 hdroffset d2 d3

    set hdroffset [expr {[file size $filename] - 16 - $hdroffset}]
    puts "\tOffset is: $hdroffset" ; flush stdout

    set s [file size $filename]
    puts "\tFile size: $s" ; flush stdout
}

P.S.: Just noticed, that if I copy the files from the FAT32 partition
        to a NTFS partition, it does not dump core, but still prints out
        different offset values, although the files are identical.
        So the problem might be in the FS code.

Thanks for your help,

Paul

begin 666 coredump.zip
M4$L#!!0````(`.5V?B\^Y)],=@```,(+```/````8V]R961U;7 O9C(N<'!M
M"S#C4E9P#G)U#/$/LE((R4A5</?T#5 O5@CP\U5PR\PI22U2"$LM*L[,SU,P
MU#/@LC!2,#3B,C(UY;I_^_[(1 QXP7_<`"2+&S%0* TT'Q<"J< I34@KPZBO
M<8%17X_Z>M37H[X>]?6HKX>6KX<?(+[]-LP0`%!+`P04````" !M;WXO/N2?
M3'8```#""P``#P```&-O<F5D=6UP+V8Q+G!P;0LPXU)6< YR=0SQ#[)2",E(
M57#W] U0+U8(\/-5<,O,*4DM4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E<,)X+4+T*[D\
M<IYH?R*NOX*,/'T-",2>;,"#RP3P>6JK*"IM?1+.7OE&.EO7,?HR\>-O^$'1
M/4PWB^^H=>\;7J>T?4@:$P"+L?B*'\B),*\]L7,\4*=%%9T6I7TD5A*!6C(A
M7:1P=LG?+F1^2O^HV/6TV@WD[:7Y-O34.1PVXXZ]^C=9]!;+Z-,2BU?\N#VS
MXW?24+Z8,)<=B9S'Q3)GDC]?`);T[Z2.V7]02P,$"@``````M7A^+P``````
M``````````D```!C;W)E9'5M<"]02P$"% `4````" #E=GXO/N2?3'8```#"
M"P``#P`````````!`" `MH$`````8V]R961U;7 O9C(N<'!M4$L!`A0`% ``
M``@`;6]^+S[DGTQV````P@L```\``````````0`@`+:!HP```&-O<F5D=6UP
M+V8Q+G!P;5!+`0(4`!0````(`&]O?B\^Y)],=@```,(+```/``````````$`
M( "V@48!``!C;W)E9'5M<"]F,RYP<&U02P$"% `4````" #-=GXO/N2?3'8`
M``#""P``#P`````````!`" `MH'I`0``8V]R961U;7 O9C0N<'!M4$L!`A0`
M% ````@`F*5^+PE_,"WM`0``] ,``!4``````````0`@`+:!C (``&-O<F5D
M=6UP+V-O<F5D=6UP+G1C;%!+`0(4``H``````+5X?B\````````````````)
M````````````$ #_0:P$``!C;W)E9'5M<"]02P4&``````8`!@!N`0``TP0`
#````
`
end



Relevant Pages

  • Re: dh, the daemon helper
    ... terminate the process and create a core dump of it. ... beforehand when core dumps should rather have been enabled. ... I myself try to fix bugs that I encounter, but I find that the core file ... If the bug is hard to reproduce, the core file is of limited utility ...
    (comp.unix.programmer)
  • Re: Annoying S10 + Xinerama bug
    ... * The first place to look for error messages from Xsun is ... but you have to configure the system to Capture Xsun Core Dumps ... The command plimit can be run as root ...
    (comp.unix.solaris)
  • Re: Apache20 port on FreeBSD 7.2 does a core dump
    ... I'm assuming you're not used to using a debugger on a core file, ... I originally had them included and I was getting the core dumps, ... I don't know if it would be helpful, but PHP is also really slow on this ... How do I inspect the core file to find out which module caused it? ...
    (freebsd-questions)
  • Re: Random core dumps in home directory
    ... Core dumps are generated when some program fails. ... to set the limits. ... the tcsh builtin command "limit". ...
    (Fedora)
  • Re: dh, the daemon helper
    ... beforehand when core dumps should rather have been enabled. ... form -- to anyone who gets a look at the core file. ... means if you have sensitive data that must not hit the disk, ...
    (comp.unix.programmer)