Index: generic/tclPathObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPathObj.c,v
retrieving revision 1.79
diff -u -r1.79 tclPathObj.c
--- generic/tclPathObj.c	20 Feb 2009 18:19:16 -0000	1.79
+++ generic/tclPathObj.c	27 Mar 2009 18:56:47 -0000
@@ -578,11 +578,24 @@
 		 * the standardPath code.
 		 */
 
-		const char *rest = TclGetString(fsPathPtr->normPathPtr);
+		int numBytes;
+		const char *rest =
+			Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &numBytes);
 
 		if (strchr(rest, '/') != NULL) {
 		    goto standardPath;
 		}
+		/*
+		 * If the joined-on bit is empty, then [file dirname] is
+		 * documented to return all but the last non-empty element
+		 * of the path, so we need to split apart the main part to
+		 * get the right answer.  We could do that here, but it's
+		 * simpler to fall back to the standardPath code.
+		 * [Bug 2710920]
+		 */
+		if (numBytes == 0) {
+		    goto standardPath;
+		}
 		if (tclPlatform == TCL_PLATFORM_WINDOWS
 			&& strchr(rest, '\\') != NULL) {
 		    goto standardPath;
@@ -603,11 +616,24 @@
 		 * we don't, and instead just use the standardPath code.
 		 */
 
-		const char *rest = TclGetString(fsPathPtr->normPathPtr);
+		int numBytes;
+		const char *rest =
+			Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &numBytes);
 
 		if (strchr(rest, '/') != NULL) {
 		    goto standardPath;
 		}
+		/*
+		 * If the joined-on bit is empty, then [file tail] is
+		 * documented to return the last non-empty element
+		 * of the path, so we need to split off the last element
+		 * of the main part to get the right answer.  We could do
+		 * that here, but it's simpler to fall back to the
+		 * standardPath code.  [Bug 2710920]
+		 */
+		if (numBytes == 0) {
+		    goto standardPath;
+		}
 		if (tclPlatform == TCL_PLATFORM_WINDOWS
 			&& strchr(rest, '\\') != NULL) {
 		    goto standardPath;
Index: tests/fileName.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/fileName.test,v
retrieving revision 1.58
diff -u -r1.58 fileName.test
--- tests/fileName.test	20 Feb 2009 18:19:16 -0000	1.58
+++ tests/fileName.test	27 Mar 2009 18:56:47 -0000
@@ -1277,6 +1277,18 @@
 test filename-14.26 {type specific globbing} {
     glob -nocomplain -dir globTest -types {readonly} *
 } {}
+test filename-14.27 {Bug 2710920} {unixOrPc} {
+    file tail [lindex [lsort [glob globTest/*/]] 0]
+} a1
+test filename-14.28 {Bug 2710920} {unixOrPc} {
+    file dirname [lindex [lsort [glob globTest/*/]] 0]
+} globTest
+test filename-14.29 {Bug 2710920} {unixOrPc} {
+    file extension [lindex [lsort [glob globTest/*/]] 0]
+} {}
+test filename-14.30 {Bug 2710920} {unixOrPc} {
+    file rootname [lindex [lsort [glob globTest/*/]] 0]
+} globTest/a1/
 
 unset globname
 
