From 843b8497d3c972540e5b12b26ae3055d9df4bf77 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 20 Aug 2012 23:45:25 +0000 Subject: 3559678 Fix bad filename normalization when the last component is the empty string. --- ChangeLog | 5 +++++ generic/tclPathObj.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5e6345..b1c9079 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-08-20 Don Porter + + * generic/tclPathObj.c: [Bug 3559678] Fix bad filename normalization + when the last component is the empty string. + 2012-08-20 Jan Nijtmans * win/tclWinPort.h: Remove wrapper macro for ntohs(): unnecessary, diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index ac9df3a..c9b3b8e 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1831,7 +1831,7 @@ Tcl_FSGetNormalizedPath( */ Tcl_Obj *dir, *copy; - int cwdLen, pathType; + int tailLen, cwdLen, pathType; pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr); dir = Tcl_FSGetNormalizedPath(interp, fsPathPtr->cwdPtr); @@ -1843,7 +1843,12 @@ Tcl_FSGetNormalizedPath( UpdateStringOfFsPath(pathPtr); } - copy = AppendPath(dir, fsPathPtr->normPathPtr); + Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &tailLen); + if (tailLen) { + copy = AppendPath(dir, fsPathPtr->normPathPtr); + } else { + copy = Tcl_DuplicateObj(dir); + } Tcl_IncrRefCount(dir); Tcl_IncrRefCount(copy); -- cgit v0.12