summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2017-05-01 20:23:28 (GMT)
committerdgp <dgp@users.sourceforge.net>2017-05-01 20:23:28 (GMT)
commited853e1ffb7933562c641af3d69686df27520a8f (patch)
treebea537c1c3524b7a1e64d63515d78dfcdd37f7d7
parent64f999ee893448c079cadda5b07e13a51066dad0 (diff)
downloadtcl-ed853e1ffb7933562c641af3d69686df27520a8f.zip
tcl-ed853e1ffb7933562c641af3d69686df27520a8f.tar.gz
tcl-ed853e1ffb7933562c641af3d69686df27520a8f.tar.bz2
[f9fe90d0fa] [file join] normalization. See filesystem-1.52*
-rw-r--r--generic/tclPathObj.c12
-rw-r--r--tests/fileSystem.test10
2 files changed, 21 insertions, 1 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 6dd2f3f..88e49b5 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -921,7 +921,17 @@ Tcl_FSJoinPath(
if (res != NULL) {
TclDecrRefCount(res);
}
- return TclNewFSPathObj(elt, str, len);
+
+ if (PATHFLAGS(elt)) {
+ return TclNewFSPathObj(elt, str, len);
+ }
+ if (TCL_PATH_ABSOLUTE != Tcl_FSGetPathType(elt)) {
+ return TclNewFSPathObj(elt, str, len);
+ }
+ (void) Tcl_FSGetNormalizedPath(NULL, elt);
+ if (elt == PATHOBJ(elt)->normPathPtr) {
+ return TclNewFSPathObj(elt, str, len);
+ }
}
}
diff --git a/tests/fileSystem.test b/tests/fileSystem.test
index c255b1e..28e5268 100644
--- a/tests/fileSystem.test
+++ b/tests/fileSystem.test
@@ -498,6 +498,16 @@ test filesystem-1.51.1 {file normalisation .. beyond root (Bug 1379287)} {
set res "ok"
}
} {ok}
+test filesystem-1.52 {bug f9f390d0fa: file join where strep is not canonical} -body {
+ set x //foo
+ file normalize $x
+ file join $x bar
+} -result /foo/bar
+test filesystem-1.52.1 {bug f9f390d0fa: file join where strep is not canonical} -body {
+ set x //foo
+ file normalize $x
+ file join $x
+} -result /foo
test filesystem-2.0 {new native path} {unix} {
foreach f [lsort [glob -nocomplain /usr/bin/c*]] {