| Ticket UUID: | 1752124 | ||
| Title: | Tcl_FSGetNormalizedPath is hairier monster | ||
| Type: | Bug | Created on: | 2007-07-11 17:52:52 |
| Submitter: | dgp | Assigned to: | kennykb |
| Subsystem: | 37. File System | Severity: | |
| Priority: | 5 Medium | Last modified: | 2007-07-12 02:14:28 |
| Status: | Open | Closed by: | dgp |
| Resolution: | None | Closed on: | 2007-07-11 18:22:55 |
| Version: | obsolete: 8.5a7 | ||
| Description: | ||||
The most recent commit to tclPathObj.c, 1.62 -> 1.63, causes a crash in the trofs test suite (test trofs-12.8). Examining... | ||||
| User Comments: | ||||
dgp added on 2007-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. dgp added on 2007-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. dgp added on 2007-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().
dgp added on 2007-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. | ||||
