diff options
author | vincentdarley <vincentdarley> | 2002-06-27 12:27:34 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2002-06-27 12:27:34 (GMT) |
commit | d803b5d6f6c5b0536c4b9ea252cb2e9312dc8302 (patch) | |
tree | dff037214125bb866ef5becad1d4e39993ba0b07 | |
parent | af98b186fc8d7e04f254b7bf0e6588000e5e6ea3 (diff) | |
download | tcl-d803b5d6f6c5b0536c4b9ea252cb2e9312dc8302.zip tcl-d803b5d6f6c5b0536c4b9ea252cb2e9312dc8302.tar.gz tcl-d803b5d6f6c5b0536c4b9ea252cb2e9312dc8302.tar.bz2 |
unix root volume fix
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | tests/cmdAH.test | 10 | ||||
-rw-r--r-- | unix/tclUnixFCmd.c | 11 |
3 files changed, 21 insertions, 3 deletions
@@ -4,6 +4,9 @@ * generic/tclIOUtil.c: fix to handling of empty paths "" which are not claimed by any filesystem (Bug #573758). Ensure good error messages are given in all cases. + * tests/cmdAH.test: + * unix/tclUnixFCmd.c: fix to bug reported as part of + (Patch #566669). Thanks to Taguchi, Takeshi for the report. 2002-06-26 Reinhard Max <max@suse.de> diff --git a/tests/cmdAH.test b/tests/cmdAH.test index ff715e0..cb6b2e4 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: cmdAH.test,v 1.21 2002/06/21 14:22:29 vincentdarley Exp $ +# RCS: @(#) $Id: cmdAH.test,v 1.22 2002/06/27 12:27:35 vincentdarley Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -198,6 +198,14 @@ test cmdAH-6.4 {Tcl_FileObjCmd: volumes} {pcOnly} { list [catch {lsearch $volumeList "c:/"} element] [expr $element != -1] [catch {list glob -nocomplain [lindex $volumeList $element]*}] } {0 1 0} +test cmdAH-6.5 {cd} {unixOnly nonPortable} { + set dir [pwd] + cd / + set res [pwd] + cd $dir + set res +} {/} + # attributes test cmdAH-7.1 {Tcl_FileObjCmd - file attrs} { diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 37921fc..51e354e 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFCmd.c,v 1.23 2002/06/10 17:41:52 vincentdarley Exp $ + * RCS: @(#) $Id: tclUnixFCmd.c,v 1.24 2002/06/27 12:27:35 vincentdarley Exp $ * * Portions of this code were derived from NetBSD source code which has * the following copyright notice: @@ -1692,7 +1692,6 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) nextCheckpoint = currentPathEndPosition - path; } else if (cur == 0) { /* Reached end of string */ - /* nextCheckpoint = pathLen; */ break; } currentPathEndPosition++; @@ -1705,6 +1704,14 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) * have 'realpath'. */ #ifndef NO_REALPATH + /* + * If we only had '/foo' or '/' then we never increment nextCheckpoint + * and we don't need or want to go through 'Realpath'. Also, on some + * platforms, passing an empty string to 'Realpath' will give us the + * normalized pwd, which is not what we want at all! + */ + if (nextCheckpoint == 0) return 0; + nativePath = Tcl_UtfToExternalDString(NULL, path, nextCheckpoint, &ds); if (Realpath(nativePath, normPath) != NULL) { /* |