Tcl_FSGetNormalizedPath is hairier monster
Open1752124fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-07-11 17:52:52
The most recent commit to tclPathObj.c, 1.62 -> 1.63, causes a crash in the trofs test suite (test trofs-12.8). Examining...
dgpplain2007-07-12 01:22:55
Logged In: YES user_id=80530 Originator: YES Looking like this is really a bug in trofs, just exposed by the changes to refcount logic. These changes appear to have extended (created?) a Hairy Monster nature for the Tcl_FSGetNormalizedPath routine. The pathPtr passed in to Tcl_FSGetNormalizedPath has fsPathPtr->translatedPathPtr with zero refCount. Since the pointer is stored, there ought to be a refcount to go with that. Still need to look it over with care, but that's probably trofs's fault.
dgpplain2007-07-12 01:33:39
Logged In: YES user_id=80530 Originator: YES Nope. trofs never touches that field at all. It's the Tcl core that permits that field to hold a pointer value, but leave the Tcl_Obj pointed to with zero refcount, apparently due to some very complex requirements of some circular reference scheme.
dgpplain2007-07-12 02:13:22
Logged In: YES
user_id=80530
Originator: YES
Was able to workaround the issue
with changes to trofs. The code which
is not safe looks like:
Tcl_FSGetNormalizedPath(NULL,
Tcl_FSJoinToPath(parent, 1, &element));
where T_FSJTP can return a zero
refcount Tcl_Obj, and T_FSGNP can
free it just by trying to determine
its normalized form.
Probably should add warnings to the
docs that it's not safe to pass
zero refcount pathPtr values to
T_FSGNP().
dgpplain2007-07-12 02:14:28
Logged In: YES user_id=80530 Originator: YES Something else to consider is whether T_FSGNP ought to immediately panic if handed a zero refcount pathPtr.
Log in (anonymous is fine) to add a comment.