summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-08-20 23:50:44 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-08-20 23:50:44 (GMT)
commitdbf049c0fba4506927b17c7ff9f7d66aa61cde18 (patch)
tree740b650a52897d03d9c3dbd0632fbed19c9e2d31
parenteb9bcac9c6ae30bb3e5f6bc298ee8238927a93e1 (diff)
parent843b8497d3c972540e5b12b26ae3055d9df4bf77 (diff)
downloadtcl-dbf049c0fba4506927b17c7ff9f7d66aa61cde18.zip
tcl-dbf049c0fba4506927b17c7ff9f7d66aa61cde18.tar.gz
tcl-dbf049c0fba4506927b17c7ff9f7d66aa61cde18.tar.bz2
3559678 Fix bad filename normalization when the last component is the empty string.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclPathObj.c9
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c1f1062..e8f96e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-08-20 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclPathObj.c: [Bug 3559678] Fix bad filename normalization
+ when the last component is the empty string.
+
2012-08-20 Jan Nijtmans <nijtmans@users.sf.net>
* win/tclWinPort.h: Remove wrapper macro for ntohs(): unnecessary,
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index db07c0e..2b9ff87 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -1764,7 +1764,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);
@@ -1776,7 +1776,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);