Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix for [bcd1004104] |
|---|---|
| Timelines: | family | ancestors | descendants | both | core-8-branch |
| Files: | files | file ages | folders |
| SHA3-256: |
0f2870649c804dd87d5ccd4fcce394e6 |
| User & Date: | pooryorick 2019-10-22 19:21:48.002 |
References
|
2019-10-24
| ||
| 07:57 | Backout [0f2870649c804dd8], since testcase encoding-2.2 fails check-in: 4c604727ef user: jan.nijtmans tags: core-8-branch | |
|
2019-10-23
| ||
| 11:51 | Fix gcc warning, also introduced by [0f2870649c804dd8] check-in: f90c5df06a user: jan.nijtmans tags: core-8-branch | |
| 10:01 | Merge 8.6. Also unbreak windows build, broken since [0f2870649c804dd8]. check-in: e8c104baf7 user: jan.nijtmans tags: core-8-branch | |
|
2019-10-22
| ||
| 22:11 | • Ticket [bcd1004104] A change to the system encoding, a stale cached file FsPath object, and an incorrect result status still Open with 4 other changes artifact: e82c4981ce user: jan.nijtmans | |
Context
|
2019-10-22
| ||
| 21:54 | Fix breakage from previous commit (still one test-case, encoding-2.2, is failing) check-in: 5b03166381 user: jan.nijtmans tags: core-8-branch | |
| 21:36 | Merge 8.7 check-in: 27b5a315e9 user: jan.nijtmans tags: trunk | |
| 19:21 | Fix for [bcd1004104] check-in: 0f2870649c user: pooryorick tags: core-8-branch | |
| 15:47 | Deprecate mp_get_bit, mp_expt_d_ex, mp_toradix_n, mp_to_unsigned_bin, mp_to_unsigned_bin_n, because ... check-in: 68d0196442 user: jan.nijtmans tags: core-8-branch | |
|
2019-06-20
| ||
| 19:40 | [6bdadfba7d] Stop crash with multi-lappend and failing writes check-in: ca4a6f0a95 user: dkf tags: core-8-6-branch | |
Changes
Changes to generic/tclFileName.c.
| ︙ | ︙ | |||
2433 2434 2435 2436 2437 2438 2439 |
* Common for all platforms.
*/
if (pathPtr == NULL) {
joinedPtr = TclDStringToObj(&append);
} else if (flags) {
joinedPtr = TclNewFSPathObj(pathPtr, Tcl_DStringValue(&append),
| | > | 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 |
* Common for all platforms.
*/
if (pathPtr == NULL) {
joinedPtr = TclDStringToObj(&append);
} else if (flags) {
joinedPtr = TclNewFSPathObj(pathPtr, Tcl_DStringValue(&append),
Tcl_DStringLength(&append),
TclFSPathEncoding(interp, pathPtr));
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
if (strchr(separators, Tcl_DStringValue(&append)[0]) == NULL) {
/*
* The current prefix must end in a separator.
*/
|
| ︙ | ︙ | |||
2466 2467 2468 2469 2470 2471 2472 |
/*
* If it's not the end of the string, we must recurse
*/
if (pathPtr == NULL) {
joinedPtr = Tcl_NewStringObj(pattern, p-pattern);
} else if (flags) {
| | > | 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 |
/*
* If it's not the end of the string, we must recurse
*/
if (pathPtr == NULL) {
joinedPtr = Tcl_NewStringObj(pattern, p-pattern);
} else if (flags) {
joinedPtr = TclNewFSPathObj(pathPtr, pattern, p-pattern,
TclFSPathEncoding(interp, pathPtr));
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
if (strchr(separators, pattern[0]) == NULL) {
/*
* The current prefix must end in a separator, unless this is a
* volume-relative path. In particular globbing in Windows shares,
* when not using -dir or -path, e.g. 'glob [file join
|
| ︙ | ︙ |
Changes to generic/tclIOUtil.c.
| ︙ | ︙ | |||
1221 1222 1223 1224 1225 1226 1227 | /* * Deal with the root of the volume. */ len--; } len++; /* account for '/' in the mElt [Bug 1602539] */ | > | > | 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 | /* * Deal with the root of the volume. */ len--; } len++; /* account for '/' in the mElt [Bug 1602539] */ mElt = TclNewFSPathObj(pathPtr, mount + len, mlen - len , TclFSPathEncoding(NULL, pathPtr)); Tcl_ListObjAppendElement(NULL, resultPtr, mElt); } /* * No need to increment gLength, since we don't want to compare * mounts against mounts. */ } |
| ︙ | ︙ |
Changes to generic/tclInt.h.
| ︙ | ︙ | |||
3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 | MODULE_SCOPE void TclFinalizeThreadAllocThread(void); MODULE_SCOPE void TclFinalizeThreadData(int quick); MODULE_SCOPE void TclFinalizeThreadObjects(void); MODULE_SCOPE double TclFloor(const mp_int *a); MODULE_SCOPE void TclFormatNaN(double value, char *buffer); MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr, const char *attributeName, int *indexPtr); MODULE_SCOPE Tcl_Command TclNRCreateCommandInNs(Tcl_Interp *interp, const char *cmdName, Tcl_Namespace *nsPtr, Tcl_ObjCmdProc *proc, Tcl_ObjCmdProc *nreProc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *encodingName); | > > > > > > | 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 |
MODULE_SCOPE void TclFinalizeThreadAllocThread(void);
MODULE_SCOPE void TclFinalizeThreadData(int quick);
MODULE_SCOPE void TclFinalizeThreadObjects(void);
MODULE_SCOPE double TclFloor(const mp_int *a);
MODULE_SCOPE void TclFormatNaN(double value, char *buffer);
MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr,
const char *attributeName, int *indexPtr);
MODULE_SCOPE
Tcl_Encoding TclFSPathEncoding(
Tcl_Interp *interp,
Tcl_Obj *pathPtr
);
MODULE_SCOPE Tcl_Command TclNRCreateCommandInNs(Tcl_Interp *interp,
const char *cmdName, Tcl_Namespace *nsPtr,
Tcl_ObjCmdProc *proc, Tcl_ObjCmdProc *nreProc,
ClientData clientData,
Tcl_CmdDeleteProc *deleteProc);
MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr,
const char *encodingName);
|
| ︙ | ︙ | |||
3128 3129 3130 3131 3132 3133 3134 | MODULE_SCOPE int TclParseAllWhiteSpace(const char *src, int numBytes); MODULE_SCOPE int TclProcessReturn(Tcl_Interp *interp, int code, int level, Tcl_Obj *returnOpts); MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf); MODULE_SCOPE Tcl_Obj * TclpTempFileName(void); MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr); MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep, | | | 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 | MODULE_SCOPE int TclParseAllWhiteSpace(const char *src, int numBytes); MODULE_SCOPE int TclProcessReturn(Tcl_Interp *interp, int code, int level, Tcl_Obj *returnOpts); MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf); MODULE_SCOPE Tcl_Obj * TclpTempFileName(void); MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr); MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep, int len, Tcl_Encoding encoding); MODULE_SCOPE int TclpDeleteFile(const void *path); MODULE_SCOPE void TclpFinalizeCondition(Tcl_Condition *condPtr); MODULE_SCOPE void TclpFinalizeMutex(Tcl_Mutex *mutexPtr); MODULE_SCOPE void TclpFinalizePipes(void); MODULE_SCOPE void TclpFinalizeSockets(void); MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp, struct addrinfo **addrlist, |
| ︙ | ︙ |
Changes to generic/tclPathObj.c.
| ︙ | ︙ | |||
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
ClientData nativePathPtr; /* Native representation of this path, which
* is filesystem dependent. */
int filesystemEpoch; /* Used to ensure the path representation was
* generated during the correct filesystem
* epoch. The epoch changes when
* filesystem-mounts are changed. */
const Tcl_Filesystem *fsPtr;/* The Tcl_Filesystem that claims this path */
} FsPath;
/*
* Flag values for FsPath->flags.
*/
#define TCLPATH_APPENDED 1
| > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
ClientData nativePathPtr; /* Native representation of this path, which
* is filesystem dependent. */
int filesystemEpoch; /* Used to ensure the path representation was
* generated during the correct filesystem
* epoch. The epoch changes when
* filesystem-mounts are changed. */
const Tcl_Filesystem *fsPtr;/* The Tcl_Filesystem that claims this path */
Tcl_Encoding encoding;
} FsPath;
/*
* Flag values for FsPath->flags.
*/
#define TCLPATH_APPENDED 1
|
| ︙ | ︙ | |||
658 659 660 661 662 663 664 665 | /* * Need to return the whole path with the extension * suffix removed. Do that by joining our "head" to * our "tail" with the extension suffix removed from * the tail. */ Tcl_Obj *resultPtr = | > > > > > > > > | | > | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | /* * Need to return the whole path with the extension * suffix removed. Do that by joining our "head" to * our "tail" with the extension suffix removed from * the tail. */ /* * We don't know that the encoding of the fileName is the * same as the encoding of, but that's on the caller to * harmonize. In any case, if the encoding doesn't match * at the time it the FsPath object is used, the object is * ignored. */ Tcl_Obj *resultPtr = TclNewFSPathObj(fsPathPtr->cwdPtr, fileName, (int)(length - strlen(extension)), TclFSPathEncoding(interp, fsPathPtr->cwdPtr)); Tcl_IncrRefCount(resultPtr); return resultPtr; } } default: /* We should never get here */ |
| ︙ | ︙ | |||
874 875 876 877 878 879 880 881 882 883 884 885 886 887 |
* to be an absolute path. Added a check for that elt is absolute.
*/
if ((eltIr)
&& !((elt->bytes != NULL) && (elt->bytes[0] == '\0'))
&& TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) {
Tcl_Obj *tailObj = objv[1];
Tcl_PathType type;
/* if forceRelative - second path is relative */
type = forceRelative ? TCL_PATH_RELATIVE :
TclGetPathType(tailObj, NULL, NULL, NULL);
if (type == TCL_PATH_RELATIVE) {
const char *str;
| > | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 |
* to be an absolute path. Added a check for that elt is absolute.
*/
if ((eltIr)
&& !((elt->bytes != NULL) && (elt->bytes[0] == '\0'))
&& TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) {
Tcl_Obj *tailObj = objv[1];
Tcl_PathType type;
/* if forceRelative - second path is relative */
type = forceRelative ? TCL_PATH_RELATIVE :
TclGetPathType(tailObj, NULL, NULL, NULL);
if (type == TCL_PATH_RELATIVE) {
const char *str;
|
| ︙ | ︙ | |||
915 916 917 918 919 920 921 |
* cannot have backslashes either.
*/
if ((tclPlatform != TCL_PLATFORM_WINDOWS)
|| (strchr(Tcl_GetString(elt), '\\') == NULL)) {
if (PATHFLAGS(elt)) {
| | > | > | > | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 |
* cannot have backslashes either.
*/
if ((tclPlatform != TCL_PLATFORM_WINDOWS)
|| (strchr(Tcl_GetString(elt), '\\') == NULL)) {
if (PATHFLAGS(elt)) {
return TclNewFSPathObj(elt, str, len,
TclFSPathEncoding(NULL, elt));
}
if (TCL_PATH_ABSOLUTE != Tcl_FSGetPathType(elt)) {
return TclNewFSPathObj(
elt, str, len, TclFSPathEncoding(NULL, elt));
}
(void) Tcl_FSGetNormalizedPath(NULL, elt);
if (elt == PATHOBJ(elt)->normPathPtr) {
return TclNewFSPathObj(
elt, str, len, TclFSPathEncoding(NULL, elt));
}
}
}
/*
* Otherwise we don't have an easy join, and we must let the
* more general code below handle things.
|
| ︙ | ︙ | |||
1254 1255 1256 1257 1258 1259 1260 |
*---------------------------------------------------------------------------
*/
Tcl_Obj *
TclNewFSPathObj(
Tcl_Obj *dirPtr,
const char *addStrRep,
| | > > | 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,
Tcl_Encoding encoding
)
{
FsPath *fsPathPtr;
Tcl_Obj *pathPtr;
const char *p;
int state = 0, count = 0;
/* [Bug 2806250] - this is only a partial solution of the problem.
|
| ︙ | ︙ | |||
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 |
fsPathPtr->normPathPtr = Tcl_NewStringObj(addStrRep, len);
Tcl_IncrRefCount(fsPathPtr->normPathPtr);
fsPathPtr->cwdPtr = dirPtr;
Tcl_IncrRefCount(dirPtr);
fsPathPtr->nativePathPtr = NULL;
fsPathPtr->fsPtr = NULL;
fsPathPtr->filesystemEpoch = 0;
SETPATHOBJ(pathPtr, fsPathPtr);
PATHFLAGS(pathPtr) = TCLPATH_APPENDED;
TclInvalidateStringRep(pathPtr);
/*
* Look for path components made up of only "."
| > | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 |
fsPathPtr->normPathPtr = Tcl_NewStringObj(addStrRep, len);
Tcl_IncrRefCount(fsPathPtr->normPathPtr);
fsPathPtr->cwdPtr = dirPtr;
Tcl_IncrRefCount(dirPtr);
fsPathPtr->nativePathPtr = NULL;
fsPathPtr->fsPtr = NULL;
fsPathPtr->filesystemEpoch = 0;
fsPathPtr->encoding = encoding;
SETPATHOBJ(pathPtr, fsPathPtr);
PATHFLAGS(pathPtr) = TCLPATH_APPENDED;
TclInvalidateStringRep(pathPtr);
/*
* Look for path components made up of only "."
|
| ︙ | ︙ | |||
2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 |
srcFsPathPtr->nativePathPtr = clientData;
srcFsPathPtr->filesystemEpoch = TclFSEpoch();
}
/*
*---------------------------------------------------------------------------
*
* Tcl_FSEqualPaths --
*
* This function tests whether the two paths given are equal path
* objects. If either or both is NULL, 0 is always returned.
*
* Results:
* 1 or 0.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 |
srcFsPathPtr->nativePathPtr = clientData;
srcFsPathPtr->filesystemEpoch = TclFSEpoch();
}
/*
*---------------------------------------------------------------------------
*
* TclFSPathEncoding --
*
* Produce the encoding, if any, associated with a filesystem path.
*
* Results:
* NULL or a valid Tcl_Encoding.
*
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
Tcl_Encoding
TclFSPathEncoding(
Tcl_Interp *interp,
Tcl_Obj *pathPtr)
{
FsPath *fsPathPtr;
Tcl_Encoding encoding = NULL;
if (Tcl_FSConvertToPathType(interp, pathPtr) != TCL_OK) {
return NULL;
}
if (TclFetchIntRep(pathPtr, &fsPathType)) {
fsPathPtr = PATHOBJ(pathPtr);
encoding = fsPathPtr->encoding;
}
return encoding;
}
/*
*---------------------------------------------------------------------------
*
* Tcl_FSEqualPaths --
*
* This function tests whether the two paths given are equal path
* objects. If either or both is NULL, 0 is always returned.
*
* Results:
* 1 or 0.
|
| ︙ | ︙ | |||
2240 2241 2242 2243 2244 2245 2246 |
Tcl_Obj *pathPtr) /* The object to convert. */
{
int len;
FsPath *fsPathPtr;
Tcl_Obj *transPtr;
const char *name;
| > > | > | 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 |
Tcl_Obj *pathPtr) /* The object to convert. */
{
int len;
FsPath *fsPathPtr;
Tcl_Obj *transPtr;
const char *name;
Tcl_Encoding sysencoding = Tcl_GetEncoding(interp, NULL);
if (TclHasIntRep(pathPtr, &fsPathType)
&& TclFsPathEncoding(pathPtr) == sysencoding) {
return TCL_OK;
}
/*
* First step is to translate the filename. This is similar to
* Tcl_TranslateFilename, but shouldn't convert everything to windows
* backslashes on that platform. The current implementation of this piece
|
| ︙ | ︙ |
Changes to unix/tclUnixFile.c.
| ︙ | ︙ | |||
265 266 267 268 269 270 271 272 273 274 275 276 277 278 | size_t dirLength, nativeDirLen; int matchHidden, matchHiddenPat; Tcl_StatBuf statBuf; Tcl_DString ds; /* native encoding of dir */ Tcl_DString dsOrig; /* utf-8 encoding of dir */ Tcl_DStringInit(&dsOrig); dirName = TclGetString(fileNamePtr); dirLength = fileNamePtr->length; Tcl_DStringAppend(&dsOrig, dirName, dirLength); /* * Make sure that the directory part of the name really is a * directory. If the directory name is "", use the name "." instead, | > | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | size_t dirLength, nativeDirLen; int matchHidden, matchHiddenPat; Tcl_StatBuf statBuf; Tcl_DString ds; /* native encoding of dir */ Tcl_DString dsOrig; /* utf-8 encoding of dir */ Tcl_DStringInit(&dsOrig); Tcl_Encoding encoding; dirName = TclGetString(fileNamePtr); dirLength = fileNamePtr->length; Tcl_DStringAppend(&dsOrig, dirName, dirLength); /* * Make sure that the directory part of the name really is a * directory. If the directory name is "", use the name "." instead, |
| ︙ | ︙ | |||
360 361 362 363 364 365 366 | } /* * Now check to see if the file matches, according to both type * and pattern. If so, add the file to the result. */ | > > | | | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
}
/*
* Now check to see if the file matches, according to both type
* and pattern. If so, add the file to the result.
*/
encoding = Tcl_GetEncoding(interp ,NULL);
utfname = Tcl_ExternalToUtfDString(encoding, entryPtr->d_name, -1,
&utfDs);
if (Tcl_StringCaseMatch(utfname, pattern, 0)) {
int typeOk = 1;
if (types != NULL) {
Tcl_DStringSetLength(&ds, nativeDirLen);
native = Tcl_DStringAppend(&ds, entryPtr->d_name, -1);
matchResult = NativeMatchType(interp, native,
entryPtr->d_name, types);
typeOk = (matchResult == 1);
}
if (typeOk) {
Tcl_ListObjAppendElement(interp, resultPtr,
TclNewFSPathObj(pathPtr, utfname,
Tcl_DStringLength(&utfDs), encoding));
}
}
Tcl_DStringFree(&utfDs);
if (matchResult < 0) {
break;
}
}
|
| ︙ | ︙ |