Skip to content
Tcl Source Code View Ticket
Login

View Ticket

pkg_mkIndex core dumps

Closed / Fixed478641ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-11-06 12:48:12
OS Platform and Version 
   SPARC Solaris 2.6 Sun compiler
Problem Behavior 
   pkg_mkIndex . libvfs1.0.so 
results in a core dump in tclsh 8.4a4 .
Expected Behavior 
   a pkgIndex.tcl file

Here's the stack trace I am getting:

(dbx 19) where
  [1] _kill(0x0, 0x6, 0x0, 0xffffffff, 0xff0bc404,
0xff035690), at 0xff09ba28
  [2] abort(0xff0b800c, 0xff0bfa8c, 0x0, 0x0, 0x0,
0x223d8), at 0xff035774
  [3] Tcl_PanicVA(format = 0xff30df18 "called
Tcl_FindHashEntry on deleted table", argList =
0xffbeb720), line 106 in "tclPanic.c"
  [4] Tcl_Panic(arg1 = 0xff30df18 "called
Tcl_FindHashEntry on deleted table", ...), line 134 in
"tclPanic.c"
  [5] BogusFind(tablePtr = 0x4f0ec, key = 0xffbeb7c4
"vfs"), line 1050 in "tclHash.c"
=>[6] TclGetNamespaceForQualName(interp = 0x4eee0,
qualName = 0xfeff35ac "vfs::mount", cxtNsPtr = (nil),
flags = 1, nsPtrPtr = 0xffbeb934, altNsPtrPtr =
0xffbeb938, actualCxtPtrPtr = 0xffbeb930, simpleNamePtr
= 0xffbeb92c), line 1782 in "tclNamesp.c"
  [7] Tcl_FindNamespaceVar(interp = 0x4eee0, name =
0xfeff35ac "vfs::mount", contextNsPtr = (nil), flags =
1), line 2150 in "tclNamesp.c"
  [8] TclLookupVar(interp = 0x4eee0, part1 = 0xfeff35ac
"vfs::mount", part2 = 0x592f0
"/vol/tclsrcsol/tcl84/tclvfs", flags = 1, msg =
0xff33a39c "read", createPart1 = 0, createPart2 = 1,
arrayPtrPtr = 0xffbeba84), line 277 in "tclVar.c"
  [9] Tcl_GetVar2Ex(interp = 0x4eee0, part1 =
0xfeff35ac "vfs::mount", part2 = 0x592f0
"/vol/tclsrcsol/tcl84/tclvfs", flags = 1), line 625 in
"tclVar.c"
  [10] VfsInFilesystem(0x511f8, 0xffbebb60, 0xfeff351c,
0x2f, 0x4eee0, 0x0), at 0xfefe168c
  [11] Tcl_FSGetFileSystemForPath(pathObjPtr =
0x511f8), line 4446 in "tclIOUtil.c"
  [12] Tcl_FSGetCwd(interp = (nil)), line 1812 in
"tclIOUtil.c"
  [13] Tcl_FSGetNormalizedPath(interp = (nil),
pathObjPtr = 0x4b720), line 3865 in "tclIOUtil.c"
  [14] Tcl_FSGetFileSystemForPath(pathObjPtr =
0x4b720), line 4393 in "tclIOUtil.c"
  [15] Tcl_FSOpenFileChannel(interp = 0x23d60, pathPtr
= 0x4b720, modeString = 0x4a798 "w", permissions =
438), line 1543 in "tclIOUtil.c"
  [16] Tcl_OpenObjCmd(notUsed = (nil), interp =
0x23d60, objc = 3, objv = 0x25834), line 975 in
"tclIOCmd.c"
  [17] TclExecuteByteCode(interp = 0x23d60, codePtr =
0x4fdc0), line 870 in "tclExecute.c"
  [18] Tcl_EvalObjEx(interp = 0x23d60, objPtr =
0x4b648, flags = 0), line 2951 in "tclBasic.c"
  [19] TclObjInterpProc(clientData = 0x480d0, interp =
0x23d60, objc = 3, objv = 0x4a070), line 1074 in
"tclProc.c"
  [20] EvalObjv(interp = 0x23d60, objc = 3, objv =
0x4a070, command = 0xff338100 "", length = 0, flags =
262144), line 932 in "tclParse.c"
  [21] Tcl_EvalObjv(interp = 0x23d60, objc = 3, objv =
0x4a070, flags = 262144), line 1019 in "tclParse.c"
  [22] Tcl_EvalObjEx(interp = 0x23d60, objPtr =
0x4b600, flags = 262144), line 2794 in "tclBasic.c"
  [23] Tcl_UplevelObjCmd(dummy = (nil), interp =
0x23d60, objc = 1, objv = 0x25830), line 666 in
"tclProc.c"
  [24] TclExecuteByteCode(interp = 0x23d60, codePtr =
0x37340), line 870 in "tclExecute.c"
  [25] Tcl_EvalObjEx(interp = 0x23d60, objPtr =
0x31520, flags = 0), line 2951 in "tclBasic.c"
  [26] TclObjInterpProc(clientData = 0x30218, interp =
0x23d60, objc = 4, objv = 0x25818), line 1074 in
"tclProc.c"
  [27] TclExecuteByteCode(interp = 0x23d60, codePtr =
0x296f8), line 870 in "tclExecute.c"
  [28] Tcl_EvalObjEx(interp = 0x23d60, objPtr =
0x31580, flags = 0), line 2951 in "tclBasic.c"
  [29] Tcl_RecordAndEvalObj(interp = 0x23d60, cmdPtr =
0x31580, flags = 0), line 142 in "tclHistory.c"
  [30] Tcl_Main(argc = 1, argv = 0xffbed7fc,
appInitProc = 0x10bb8 = &Tcl_AppInit(Tcl_Interp
*interp)), line 315 in "tclMain.c"
  [31] main(argc = 1, argv = 0xffbed7fc), line 99 in
"tclAppInit.c"
dgp Ticket [478641ffff]: 1 change [History diff]2001-11-07 03:37:02
dgpplain2001-11-07 03:37:03
Logged In: YES 
user_id=80530

Assigning this to myself for review as the
pkg_mkIndex maintainer, but I suspect the problem
lies in the vfs package, not in Tcl.
andreas_kupriesplain2001-11-07 03:42:28
Logged In: YES 
user_id=75003

Most likely. I did a debug session this morning and came 
with this explanation (excerpt from email to Larry and 
Vincent). Sorry, Larry didn't tell me that he a bug report 
submitted or I would have updated it earlier.

Hm. The trouble happens when the higher layers try to
retrieve the current working directory. The VFS layer
of Tcl is going through the registered filesystems and
asks them if they know about a directory. This directory
is the directory containing the tclvfs package. ...
And the higher level tcl code just tries to write into
the file "pkgIndex.tcl".

This means that loading "tclvfs" by 'pkg_mkIndex' was
alright. So was the code afterward looking for new
commands ... But the last command, writing the package
index fails.

Aiiihh. I see the problem !

'pkg_mkIndex' loads the extension into a slave-
interpreter, does the command discovery and then
destroys the slave again. But tclvfs stays in
memory and when trying to write the pkgIndex from
the _main_ interpreter tclvfs most assuredly tries
to access the deleted slave to look for its
"vfs::mount" variable.

This is a design problem with tclvfs ... Maybe
with VFS. A future VFS FR might be to have per-
interp FS registrations instead of the current
global one.

Workaround, bugfix:

    Have tclvfs register a 'DeleteHandler' for the
    interp it uses to hold its own state. Unregister
    tclvfs if that interp goes away.
dgpplain2001-11-07 03:53:51
Logged In: YES 
user_id=80530

OK, then assigning to Vince to determine if this
is a "File System" bug in Tcl, or Invalid and to
be reassigned to the vfs package.

BTW, is this a problem that a [pkg_mkIndex -direct]
would avoid?
dgp Ticket [478641ffff]: 2 changes [History diff]2001-11-07 03:54:14
andreas_kupriesplain2001-11-07 03:58:30
Logged In: YES 
user_id=75003

Hm. I am not sure. There comment in the code of pkg_mkIndex 
indicating that it will load the library even for -direct, 
for some "'partial pkgIndex.tcl' step". Line 257 of 
package.tcl.
nobodyplain2001-11-07 17:11:23
Logged In: NO 

This is a vfs package problem.  I'll fix it some time in 
the next few days.  tclvfs should not use an arbitrary 
interpreter (which may disappear) to store information 
which it needs across all interpreters. -- Vince.
vincentdarleyplain2001-11-10 00:56:55
Logged In: YES 
user_id=32170

Was a vfs problem, and is now fixed.
Log in (anonymous is fine) to add a comment.