|
2002-07-08
| ||
| 19:11 | • Closed ticket [578617ffff]: Tcl_FSCreateDirectory() aborts plus 7 other chan... artifact: bc33d84a39 user: vincentdarley | |
| 18:12 | • Ticket [578617ffff]: 4 changes artifact: 2e12f0b023 user: rmax | |
| 17:59 | • Ticket [578617ffff]: 4 changes artifact: 84c2377b22 user: vincentdarley | |
| 10:54 | • New ticket [578617ffff]. artifact: f7304186fe user: rmax | |
Tcl_FSCreateDirectory() aborts
Closed / Fixed578617ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-07-08 10:54:28
Tcl_FSCreateDirectory() aborts with:
UpdateStringProc should not be invoked for type path
Aborted (core dumped)
when the argument object has a refcount of 0, e.g.
Tcl_FSCreateDirectory(Tcl_NewStringObj("foo", -1));
The backtrace looks like this:
#0 0x400f7ab1 in kill () from /lib/libc.so.6
#1 0x400f78a8 in raise () from /lib/libc.so.6
#2 0x400f8edb in abort () from /lib/libc.so.6
#3 0x40091ade in Tcl_PanicVA () from /usr/lib/libtcl8.4.so
#4 0x40091b06 in Tcl_Panic () from /usr/lib/libtcl8.4.so
#5 0x4008fec6 in Tcl_GetStringFromObj () from
/usr/lib/libtcl8.4.so
#6 0x40085cbd in Tcl_FSJoinPath () from
/usr/lib/libtcl8.4.so
#7 0x4008579d in Tcl_FSGetPathType () from
/usr/lib/libtcl8.4.so
#8 0x40085721 in Tcl_FSGetPathType () from
/usr/lib/libtcl8.4.so
#9 0x40086dab in Tcl_FSGetNormalizedPath () from
/usr/lib/libtcl8.4.so
#10 0x40087290 in Tcl_FSGetFileSystemForPath () from
/usr/lib/libtcl8.4.so
#11 0x40086152 in Tcl_FSCreateDirectory () from
/usr/lib/libtcl8.4.so
vincentdarleyplain2002-07-08 17:59:55
Logged In: YES user_id=32170 This obviously isn't ideal, but calling Tcl_FSAnything in that way is clearly going to leak memory even if the result succeeds. The docs explicitly say that you should not call these APIs with refCounts of zero: "The \fBTcl_FS...\fR are objectified and may cache internal representations and other path-related strings (e.g. the current working directory). One side-effect of this is that one must be careful when passing in temporary objects with a refCount of zero. Under some circumstances, the filesystem code may wish to retain a reference to the passed in object, and so one must not assume that after any of these calls return, the object still has a refCount of zero - it may have been incremented. The practical lesson to learn from this is that \fBTcl_Obj *path = Tcl_NewStringObj (...) ; Tcl_FS...(path) ; Tcl_DecrRefCount(path)\fR is wrong, and may segfault. The 'path' must have its refCount incremented before passing it in, or decrementing it." I'll try to fix the crash in any case...
rmaxplain2002-07-08 18:12:05
Logged In: YES user_id=124643 Oops, sorry. I had overlooked that part of the manpage.
vincentdarleyplain2002-07-08 19:11:23
Logged In: YES user_id=32170 Removed crash, but such a zero-refcount function call will simply return an error. Clarified docs.
Log in (anonymous is fine) to add a comment.