diff options
| -rw-r--r-- | doc/filename.n | 3 | ||||
| -rw-r--r-- | generic/tclFileName.c | 48 | ||||
| -rw-r--r-- | tests/cmdAH.test | 10 | ||||
| -rw-r--r-- | tests/fileName.test | 6 | ||||
| -rw-r--r-- | tests/fileSystem.test | 6 |
5 files changed, 23 insertions, 50 deletions
diff --git a/doc/filename.n b/doc/filename.n index 1c49d02..628b2bb 100644 --- a/doc/filename.n +++ b/doc/filename.n @@ -47,7 +47,8 @@ absolute, and file names may contain any character other than slash. The file names \fB\&.\fR and \fB\&..\fR are special and refer to the current directory and the parent of the current directory respectively. Multiple adjacent slash characters are interpreted as a single -separator. Any number of trailing slash characters at the end of a +separator, except for the first double slash \fB//\fR in absolute paths. +Any number of trailing slash characters at the end of a path are simply ignored, so the paths \fBfoo\fR, \fBfoo/\fR and \fBfoo//\fR are all identical, and in particular \fBfoo/\fR does not necessarily mean a directory is being referred. diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 74e4d7f..408d295 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -390,7 +390,6 @@ TclpGetNativePathType( if (path[0] == '/') { ++path; -#if defined(__CYGWIN__) || defined(__QNX__) /* * Check for "//" network path prefix */ @@ -399,22 +398,10 @@ TclpGetNativePathType( while (*path && *path != '/') { ++path; } -#if defined(__CYGWIN__) - /* UNC paths need to be followed by a share name */ - if (*path++ && (*path && *path != '/')) { - ++path; - while (*path && *path != '/') { - ++path; - } - } else { - path = origPath + 1; - } -#endif } -#endif if (driveNameLengthPtr != NULL) { /* - * We need this addition in case the QNX or Cygwin code was used. + * We need this addition in case the "//" code was used. */ *driveNameLengthPtr = (path - origPath); @@ -632,7 +619,6 @@ SplitUnixPath( if (*path == '/') { Tcl_Obj *rootElt; ++path; -#if defined(__CYGWIN__) || defined(__QNX__) /* * Check for "//" network path prefix */ @@ -641,19 +627,7 @@ SplitUnixPath( while (*path && *path != '/') { ++path; } -#if defined(__CYGWIN__) - /* UNC paths need to be followed by a share name */ - if (*path++ && (*path && *path != '/')) { - ++path; - while (*path && *path != '/') { - ++path; - } - } else { - path = origPath + 1; - } -#endif } -#endif rootElt = Tcl_NewStringObj(origPath, path - origPath); Tcl_ListObjAppendElement(NULL, result, rootElt); while (*path == '/') { @@ -735,10 +709,10 @@ SplitWinPath( length = p - elementStart; if (length > 0) { Tcl_Obj *nextElt; - if ((elementStart != path) && - isalpha(UCHAR(elementStart[0])) && - (elementStart[1] == ':')) { - TclNewLiteralStringObj(nextElt, "./"); + if ((elementStart != path) && + isalpha(UCHAR(elementStart[0])) && + (elementStart[1] == ':')) { + TclNewLiteralStringObj(nextElt, "./"); Tcl_AppendToObj(nextElt, elementStart, length); } else { nextElt = Tcl_NewStringObj(elementStart, length); @@ -840,12 +814,10 @@ TclpNativeJoinPath( p = joining; if (length != 0) { - if ((p[0] == '.') && - (p[1] == '/') && - (tclPlatform==TCL_PLATFORM_WINDOWS) && - isalpha(UCHAR(p[2])) && - (p[3] == ':')) { - p += 2; + if ((p[0] == '.') && (p[1] == '/') && + (tclPlatform==TCL_PLATFORM_WINDOWS) && isalpha(UCHAR(p[2])) + && (p[3] == ':')) { + p += 2; } } if (*p == '\0') { @@ -2207,7 +2179,7 @@ DoGlob( for (i=0; result==TCL_OK && i<subdirc; i++) { Tcl_Obj *copy = NULL; - result = DoGlob(interp, matchesObj, separators, subdirv[i], + result = DoGlob(interp, matchesObj, separators, subdirv[i], 1, p+1, types); if (copy) { size_t end; diff --git a/tests/cmdAH.test b/tests/cmdAH.test index 0af66bf..f92e0f1 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -446,19 +446,19 @@ test cmdAH-8.13 {Tcl_FileObjCmd: dirname} testsetplatform { test cmdAH-8.14 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname //foo -} / +} //foo test cmdAH-8.15 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname //foo/bar -} /foo +} //foo test cmdAH-8.16 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname {//foo\/bar/baz} -} {/foo\/bar} +} {//foo\/bar} test cmdAH-8.17 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname {//foo\/bar/baz/blat} -} {/foo\/bar/baz} +} {//foo\/bar/baz} test cmdAH-8.18 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname /foo// @@ -584,7 +584,7 @@ test cmdAH-9.13 {Tcl_FileObjCmd: tail} testsetplatform { test cmdAH-9.14 {Tcl_FileObjCmd: tail} testsetplatform { testsetplatform unix file tail //foo -} foo +} {} test cmdAH-9.15 {Tcl_FileObjCmd: tail} testsetplatform { testsetplatform unix file tail //foo/bar diff --git a/tests/fileName.test b/tests/fileName.test index 0dd6f86..c4735cb 100644 --- a/tests/fileName.test +++ b/tests/fileName.test @@ -201,7 +201,7 @@ test filename-4.12 {Tcl_SplitPath: unix} {testsetplatform} { test filename-4.13 {Tcl_SplitPath: unix} {testsetplatform} { testsetplatform unix file split //foo -} "/ foo" +} "//foo" test filename-4.14 {Tcl_SplitPath: unix} {testsetplatform} { testsetplatform unix file split foo//bar @@ -438,14 +438,14 @@ test filename-7.16 {Tcl_JoinPath: unix} {testsetplatform} { test filename-7.17 {Tcl_JoinPath: unix} {testsetplatform} { testsetplatform unix file join //a b -} "/a/b" +} "//a/b" test filename-7.18 {Tcl_JoinPath: unix} {testsetplatform} { testsetplatform unix file join /// a b } "/a/b" test filename-7.19 {[Bug f34cf83dd0]} { file join foo //bar -} /bar +} //bar test filename-9.1 {Tcl_JoinPath: win} {testsetplatform} { testsetplatform win diff --git a/tests/fileSystem.test b/tests/fileSystem.test index 462b61e..5e98c39 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -378,13 +378,13 @@ 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} -constraints unix -body { - set x //foo +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 + set x ///foo file normalize $x file join $x } -result /foo |
