Tcl Source Code

Check-in [15d9677358]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Radical experiment of completely disabling the TCLPATH_APPENDED intrep of the "path" Tcl_ObjType that is and has been the location of so many difficult bugs for so long.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | remove-pathappend-intrep
Files: files | file ages | folders
SHA1: 15d9677358b03edf2d4451c9a490ae0f967f8c75
User & Date: dgp 2011-10-05 18:11:55
Context
2011-10-05
19:01
Add special handling required for ~foo filesystem paths. check-in: a09a9e64c0 user: dgp tags: remove-pathappend-intrep
18:11
Radical experiment of completely disabling the TCLPATH_APPENDED intrep of the "path" Tcl_ObjType tha... check-in: 15d9677358 user: dgp tags: remove-pathappend-intrep
14:05
wrong copy/paste in ChangeLog check-in: fed81b9937 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclPathObj.c.

864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
    for (i = 0; i < elements; i++) {
	Tcl_Obj *elt, *driveName = NULL;
	int driveNameLength, strEltLen, length;
	Tcl_PathType type;
	char *strElt, *ptr;

	Tcl_ListObjIndex(NULL, listObj, i, &elt);

	/*
	 * This is a special case where we can be much more efficient, where
	 * we are joining a single relative path onto an object that is
	 * already of path type. The 'TclNewFSPathObj' call below creates an
	 * object which can be normalized more efficiently. Currently we only
	 * use the special case when we have exactly two elements, but we
	 * could expand that in the future.







|







864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
    for (i = 0; i < elements; i++) {
	Tcl_Obj *elt, *driveName = NULL;
	int driveNameLength, strEltLen, length;
	Tcl_PathType type;
	char *strElt, *ptr;

	Tcl_ListObjIndex(NULL, listObj, i, &elt);
#if 0
	/*
	 * This is a special case where we can be much more efficient, where
	 * we are joining a single relative path onto an object that is
	 * already of path type. The 'TclNewFSPathObj' call below creates an
	 * object which can be normalized more efficiently. Currently we only
	 * use the special case when we have exactly two elements, but we
	 * could expand that in the future.
947
948
949
950
951
952
953

954
955
956
957
958
959
960
			    TclDecrRefCount(res);
			}
			return tailObj;
		    }
		}
	    }
	}

	strElt = Tcl_GetStringFromObj(elt, &strEltLen);
	type = TclGetPathType(elt, &fsPtr, &driveNameLength, &driveName);
	if (type != TCL_PATH_RELATIVE) {
	    /*
	     * Zero out the current result.
	     */








>







947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
			    TclDecrRefCount(res);
			}
			return tailObj;
		    }
		}
	    }
	}
#endif
	strElt = Tcl_GetStringFromObj(elt, &strEltLen);
	type = TclGetPathType(elt, &fsPtr, &driveNameLength, &driveName);
	if (type != TCL_PATH_RELATIVE) {
	    /*
	     * Zero out the current result.
	     */

1260
1261
1262
1263
1264
1265
1266










1267
1268
1269
1270
1271
1272
1273

Tcl_Obj *
TclNewFSPathObj(
    Tcl_Obj *dirPtr,
    const char *addStrRep,
    int len)
{










    FsPath *fsPathPtr;
    Tcl_Obj *pathPtr;
    ThreadSpecificData *tsdPtr;
    const char *p;
    int state = 0, count = 0;

    /* [Bug 2806250] - this is only a partial solution of the problem.







>
>
>
>
>
>
>
>
>
>







1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284

Tcl_Obj *
TclNewFSPathObj(
    Tcl_Obj *dirPtr,
    const char *addStrRep,
    int len)
{
#if 1
    Tcl_Obj *newPath, *tail = Tcl_NewStringObj(addStrRep, len);

    Tcl_IncrRefCount(tail);
    newPath = Tcl_FSJoinToPath(dirPtr, 1, &tail);
    if (newPath != tail) {
	Tcl_DecrRefCount(tail);
    }
    return newPath;
#else
    FsPath *fsPathPtr;
    Tcl_Obj *pathPtr;
    ThreadSpecificData *tsdPtr;
    const char *p;
    int state = 0, count = 0;

    /* [Bug 2806250] - this is only a partial solution of the problem.
1354
1355
1356
1357
1358
1359
1360

1361
1362
1363
1364
1365
1366
1367
	}
    }
    if (len == 0 && count) {
	PATHFLAGS(pathPtr) |= TCLPATH_NEEDNORM;
    }

    return pathPtr;

}

static Tcl_Obj *
AppendPath(
    Tcl_Obj *head,
    Tcl_Obj *tail)
{







>







1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
	}
    }
    if (len == 0 && count) {
	PATHFLAGS(pathPtr) |= TCLPATH_NEEDNORM;
    }

    return pathPtr;
#endif
}

static Tcl_Obj *
AppendPath(
    Tcl_Obj *head,
    Tcl_Obj *tail)
{