diff options
author | dgp <dgp@noemail.net> | 2008-06-23 15:34:14 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2008-06-23 15:34:14 (GMT) |
commit | 49af1a06ce66225a83ee11dfef0b74566f94163f (patch) | |
tree | 070f168de31a65650f57077ac12d0028dcbbc7b2 /generic/tclPathObj.c | |
parent | 8368a108175f1acf73f455ec8d88ad8a6fef95fe (diff) | |
download | tcl-49af1a06ce66225a83ee11dfef0b74566f94163f.zip tcl-49af1a06ce66225a83ee11dfef0b74566f94163f.tar.gz tcl-49af1a06ce66225a83ee11dfef0b74566f94163f.tar.bz2 |
* generic/tclPathObj.c: Fixed bug in Tcl_GetTranslatedPath() when
operating on the "Special path" variant of the "path" Tcl_ObjType
intrep. A full normalization was getting done, in particular, coercing
relative paths to absolute, contrary to what the function of
producing the "translated path" is supposed to do. [Bug 1972879].
FossilOrigin-Name: 8ab9adb4fe04c6ddeb804a7d8924220012fe8d1b
Diffstat (limited to 'generic/tclPathObj.c')
-rw-r--r-- | generic/tclPathObj.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 89fb210..f292c8a 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPathObj.c,v 1.68 2008/06/23 04:18:34 dgp Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.69 2008/06/23 15:34:15 dgp Exp $ */ #include "tclInt.h" @@ -1596,14 +1596,16 @@ Tcl_FSGetTranslatedPath( srcFsPathPtr = PATHOBJ(pathPtr); if (srcFsPathPtr->translatedPathPtr == NULL) { if (PATHFLAGS(pathPtr) != 0) { - int numBytes; - const char *bytes = Tcl_GetStringFromObj(pathPtr, &numBytes); - Tcl_Obj *copy = Tcl_NewStringObj(bytes, numBytes); - Tcl_IncrRefCount(copy); - retObj = Tcl_FSGetTranslatedPath(interp, copy); + /* + * We lack a translated path result, but we have a directory + * (cwdPtr) and a tail (normPathPtr), and if we join the + * translated version of cwdPtr to normPathPtr, we'll get the + * translated result we need, and can store it for future use. + */ + retObj = Tcl_FSJoinToPath(Tcl_FSGetTranslatedPath(interp, + srcFsPathPtr->cwdPtr), 1, &(srcFsPathPtr->normPathPtr)); srcFsPathPtr->translatedPathPtr = retObj; Tcl_IncrRefCount(retObj); - Tcl_DecrRefCount(copy); } else { /* * It is a pure absolute, normalized path object. This is |