|
2016-06-23
| ||
| 17:26 | • Ticket [40ef293eed] Path intrep invalidation triggered by cd too aggressive?</... artifact: 2634e4cb81 user: dgp | |
| 17:25 | • Ticket [40ef293eed]: 3 changes artifact: f86a29a65b user: dgp | |
| 17:20 | • Ticket [40ef293eed]: 4 changes artifact: 897e7734da user: dgp | |
|
2016-06-17
| ||
| 04:33 | • Ticket [40ef293eed]: 4 changes artifact: e061c8b21b user: dah | |
|
2016-04-26
| ||
| 17:05 | • New ticket [40ef293eed]. artifact: f0cff9e707 user: dgp | |
Path intrep invalidation triggered by [cd] too aggressive?
Open40ef293eed77dd168398cab4c98b20f553f2b7fcCreated 11 years agoUpdated 10 years ago
Descriptionplain2016-04-26 17:05:04
Thanks to Brian Griffin for finding this: % package require trofs 0.4.8 % file mkdir foo % trofs::archive foo archive % trofs::mount archive /mount /mount % cd /mount % glob * Program received signal SIGSEGV, Segmentation fault. It's a very difficult twisted problem to unravel. Will require much time and effort. Until then, recording it here, since it's far from clear whether more blame belongs with trofs, or with the Tcl_Filesystem foundation.
dahplain2016-06-17 04:33:51
In trofs.c PathInFilesystem calls FetchDirFromCache -> FetchTrofsPath -> Tcl_FSGetInternalRep. Tcl_FSGetInternalRep is doing a call back to PathInFileSystem because srcFsPathPtr->fsPtr is nil when first looking up /mount, srcFsPathPtr->fsPtr isn't set out until PathInFileSystem returns first, so it winds up in an infinite loop. No idea how it is really supposed to go, just figured this might help someone that knows better :)
dgpplain2016-06-23 17:20:45
At its root, this is a shimmering problem that
trofs code didn't take enough care to handle.
Patch to trofs source code that appears to fix it:
diff -u -r1.27 trofs.c
--- generic/trofs.c 22 Jan 2015 17:07:00 -0000 1.27
+++ generic/trofs.c 23 Jun 2016 17:18:10 -0000
@@ -547,12 +547,22 @@
Tcl_DictObjGet(NULL, dictPtr, pathPtr, &dirPathPtr);
if (NULL != dirPathPtr) {
- TrofsPath *tpPtr = FetchTrofsPath(dirPathPtr);
- if (NULL == tpPtr) {
- Tcl_DictObjRemove(NULL, dictPtr, pathPtr);
+ TrofsPath *tpPtr;
+
+ /* Remove item from cache to prevent endless loops */
+ Tcl_IncrRefCount(dirPathPtr);
+ Tcl_IncrRefCount(pathPtr);
+ Tcl_DictObjRemove(NULL, dictPtr, pathPtr);
+ tpPtr = FetchTrofsPath(dirPathPtr);
+ if (tpPtr) {
+ *tpPtrPtr = tpPtr;
+ Tcl_DictObjPut(NULL, dictPtr, pathPtr, dirPathPtr);
+ }
+ Tcl_DecrRefCount(pathPtr);
+ Tcl_DecrRefCount(dirPathPtr);
+ if (tpPtr == NULL) {
return NULL;
}
- *tpPtrPtr = tpPtr;
}
return dirPathPtr;
}
dgpplain2016-06-23 17:25:50
It's possible a case could be made that core Tcl filesystem code is too aggressive in invalidating absolute path internal reps when the current working directory is changed. The place to direct further examination is in the epoch checking done in Tcl_FSConvertToPathType().
dgp Ticket [40ef293eed]: 3 changes
[History diff]2016-06-23 17:26:42
Log in (anonymous is fine) to add a comment.