Overview
| Artifact ID: | af56e39f889b8f5baeed3a017b6758a76956591f |
|---|---|
| Ticket: | 979879ffffffffffffffffffffffffffffffffff
file isdirectory causing variable corruption? |
| User & Date: | vincentdarley on 2004-06-29 18:31:27 |
Changes
- icomment:
Logged In: YES user_id=32170 In Tcl 8.5 the problem is caused here in tclPathObj.c (line 1590): Tcl_AppendObjToObj(copy, fsPathPtr->normPathPtr); /* * Normalize the combined string, but only starting after * the end of the previously normalized 'dir'. This should * be much faster! We use 'cwdLen-1' so that we are * already pointing at the dir-separator that we know about. * The normalization code will actually start off directly * after that separator. */ TclFSNormalizeToUniquePath(interp, copy, cwdLen-1, (fsPathPtr->nativePathPtr == NULL ? &clientData : NULL)); where we are calling TclFSNormalizeToUniquePath contrary to its documentation, with a string which may still contain './' or '../' sequences (from fsPathPtr->normPathPtr). It's not really clear where the fix should be -- perhaps the special 'joined' pathObj representation shouldn't be allowed if the second part has '.' or '..' sequences, or else this bit of code shown above should be cleverer, or else the native normalization code should actually cope with the existence of such sequences. The problem occurs because the TclpObjNormalizePath routine tries to find the 'long, unique path name' for each path segment (one by one), and therefore turns 'a/b/./c' into 'a/b/b/c' (since the real name of '.' is 'b' in this case). Similar bugs exist with '..'. Lastly I should add that turning on 'TclNORM_LONG_PATH' in tclWinFile.c seems to fix the problem, at least for the cases I've tested (it activates a different version of the normalization), but I think that other cases might still trigger a failure. Anyway, this is too hard for a quick fix, so it'll take me some time (i.e. until I have some time) -- others are very welcome to look into it.
- login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"