summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2017-05-01 20:25:03 (GMT)
committerdgp <dgp@users.sourceforge.net>2017-05-01 20:25:03 (GMT)
commitcfdf3d1f29001198f2afdea91a595527acdc2802 (patch)
treef1f237860cddc62d0bd939d7c5272cde05c048e9
parentb396b6e2533e98a2733a3fa471766e98c2d55088 (diff)
parentc0108dceb13e2079a9a4b662d98fa27a8c5d13c0 (diff)
downloadtcl-cfdf3d1f29001198f2afdea91a595527acdc2802.zip
tcl-cfdf3d1f29001198f2afdea91a595527acdc2802.tar.gz
tcl-cfdf3d1f29001198f2afdea91a595527acdc2802.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 20f41a3..31ed68e 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -921,7 +921,17 @@ TclJoinPath(
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 9fe4fe9..ba9b82a 100644
--- a/tests/fileSystem.test
+++ b/tests/fileSystem.test
@@ -367,6 +367,16 @@ test filesystem-1.51 {file normalisation .. beyond root (Bug 1379287)} {
test filesystem-1.51.1 {file normalisation .. beyond root (Bug 1379287)} {
testPathEqual [file norm /../../] [file norm /]
} 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*]] {