? filedirname.diff
? win/config.status.lineno
Index: generic/tclPathObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPathObj.c,v
retrieving revision 1.30
diff -u -r1.30 tclPathObj.c
--- generic/tclPathObj.c	23 Apr 2004 12:09:37 -0000	1.30
+++ generic/tclPathObj.c	19 May 2004 15:42:22 -0000
@@ -494,6 +494,26 @@
 	if (PATHFLAGS(pathPtr) != 0) {
 	    switch (portion) {
 		case TCL_PATH_DIRNAME: {
+		    /* 
+		     * Check if the joined-on bit has any directory
+		     * delimiters in it.  If so, the 'dirname' would
+		     * be a joining of the main part with the dirname
+		     * of the joined-on bit.  We could handle that
+		     * special case here, but we don't, and instead
+		     * just use the standardPath code.
+		     */
+		    CONST char *rest = Tcl_GetString(fsPathPtr->normPathPtr);
+		    if (strchr(rest, '/') != NULL) {
+			goto standardPath;
+		    }
+		    if ((tclPlatform == TCL_PLATFORM_WINDOWS) 
+		      && (strchr(rest, '\\') != NULL)) {
+			goto standardPath;
+		    }
+		    /* 
+		     * The joined-on path is simple, so we can just
+		     * return here.
+		     */
 		    Tcl_IncrRefCount(fsPathPtr->cwdPtr);
 		    return fsPathPtr->cwdPtr;
 		}
Index: tests/cmdAH.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/cmdAH.test,v
retrieving revision 1.40
diff -u -r1.40 cmdAH.test
--- tests/cmdAH.test	17 May 2004 10:38:22 -0000	1.40
+++ tests/cmdAH.test	19 May 2004 15:42:22 -0000
@@ -367,6 +367,18 @@
     set env(HOME) $temp
     set result
 } {0 /homewontexist}
+test cmdAH-8.46 {Tcl_FileObjCmd: dirname} {
+    set f [file normalize [info nameof]]
+    file exists $f
+    set res1 [file dirname [file join $f foo/bar]]
+    set res2 [file dirname "${f}/foo/bar"]
+    if {$res1 eq $res2} {
+	set res "ok"
+    } else {
+        set res "file dirname problem, $res1, $res2 not equal"
+    }
+    set res
+} {ok}
 
 # tail
 
