Index: generic/tclPkg.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPkg.c,v
retrieving revision 1.31
diff -u -r1.31 tclPkg.c
--- generic/tclPkg.c	19 Sep 2007 15:29:21 -0000	1.31
+++ generic/tclPkg.c	1 Oct 2007 20:47:16 -0000
@@ -374,6 +374,14 @@
 	 */
 
 	if (pkgPtr->clientData != NULL) {
+	    if (pkgPtr->clientData == (ClientData) tclEmptyStringRep) {
+		Tcl_AppendResult(interp, "circular package dependency: "
+			"attempt to find ", name, " requires ", name, NULL);
+		AddRequirementsToResult(interp, reqc, reqv);
+		Tcl_AppendResult(interp , "\n('package require {", name,
+			"}' in an index script?)", NULL);
+		return NULL;
+	    }
 	    Tcl_AppendResult(interp, "circular package dependency: "
 		    "attempt to provide ", name, " ",
 		    (char *) pkgPtr->clientData, " requires ", name, NULL);
@@ -575,8 +583,14 @@
 	    Tcl_DStringAppendElement(&command, name);
 	    AddRequirementsToDString(&command, reqc, reqv);
 
+	    pkgPtr->clientData = (ClientData) tclEmptyStringRep;
+
 	    code = Tcl_EvalEx(interp, Tcl_DStringValue(&command),
 		    Tcl_DStringLength(&command), TCL_EVAL_GLOBAL);
+
+	    if (pkgPtr->clientData == (ClientData) tclEmptyStringRep) {
+		pkgPtr->clientData = NULL;
+	    }
 	    Tcl_DStringFree(&command);
 
 	    if ((code != TCL_OK) && (code != TCL_ERROR)) {
