Artifacts Associated With Ticket 1048733
Ticket change [06f201323c] (rid 89298) by coldstore on 2004-10-17 16:36:45:
- assignee initialized to: "vincentdarley"
- cmimetype initialized to: "text/plain"
- comment initialized to:
FileCopyRename at ../generic/tclFCmd.c:539 calls Tcl_FSFileAttrsSet(NULL, 2, target, perm), passing a NULL Tcl_Interp* into the set attr command (presumably because the rename is being performed en passant) However, NativeFileAttrsSet() which is the default for normal file systems (and other set attribute handlers), can get errors - in my case in SetPermissionsAttribute at ../unix/tclUnixFCmd.c:1480, where a posix error occurs, and the code calls Tcl_PosixError(interp). The upshot is that Tcl_PosixError tries (eventually) to set errorCode and this fails because there is no interpreter (or, rather, a NULL interpreter) for it to set the variable in. You can reproduce this by creating a pair of files, A and B, owned by another user and (at least in my case) chmod u=rw,g=r,o=r Then, in tclsh8.5: file rename -force A B It SIGSEGVs because of the NULL interpreter. I suggest that the practice of passing NULL interp into functions which could generate errors is always bad, and in this case at least the call to Tcl_FSFileAttrsSet should pass in the variable interp, and not NULL.
- foundin initialized to: "obsolete: 8.5a2"
- priority initialized to: "7 High"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "coldstore"
- subsystem initialized to: "37. File System"
- title initialized to: "SIGSEGV on file rename when user doesn't own file"
- type initialized to: "Bug"
Ticket change [5dcbb485ef] (rid 115531) by coldstore on 2004-10-18 00:16:32:
- icomment:
Logged In: YES user_id=19214 At least the following public and private functions in tcl/generic/ match the following criteria: 1) have Tcl_Interp* as their first argument 2) have NULL passed in as their first argument. In the case that they (or the functions they pass interp to) can possibly error, I believe there's a risk of a segment fault. Tcl_Close Tcl_DictObjFirst Tcl_DictObjGet Tcl_DictObjPut Tcl_DictObjRemove Tcl_DictObjSize Tcl_ExternalToUtf Tcl_FSConvertToPathType Tcl_FSFileAttrsSet Tcl_FSGetCwd Tcl_FSGetNormalizedPath Tcl_FSGetTranslatedPath Tcl_FSJoinToPath Tcl_FSOpenFileChannel Tcl_GetBoolean Tcl_GetBooleanFromObj Tcl_GetEncoding Tcl_GetIndexFromObj Tcl_GetInt Tcl_GetIntFromObj Tcl_GetLongFromObj Tcl_GetWideIntFromObj Tcl_ListObjAppendElement Tcl_ListObjAppendList Tcl_ListObjGetElements Tcl_ListObjIndex Tcl_ListObjLength Tcl_ListObjReplace Tcl_ParseCommand Tcl_RegExpCompile Tcl_SetChannelOption Tcl_SplitList Tcl_UtfToExternal CheckForDeadChannel DoTildeSubst FlushChannel GetStatBuf SetBlockMode SetByteArrayFromAny SetFsPathFromAny SetStringFromAny
- login: "coldstore"
- mimetype: "text/plain"
- username: "coldstore"
- icomment:
Ticket change [b74ce92ec3] (rid 125564) by coldstore on 2004-10-18 00:30:05:
- icomment:
Logged In: YES user_id=19214 Winnowing out those functions which document that the can accept NULL interp arguments, we're left with these candidates for SEGV: Tcl_FSConvertToPathType Tcl_FSFileAttrsSet Tcl_FSGetCwd Tcl_FSGetNormalizedPath Tcl_FSGetTranslatedPath Tcl_FSJoinToPath Tcl_FSOpenFileChannel Tcl_GetBoolean Tcl_GetBooleanFromObj Tcl_GetEncoding Tcl_GetIndexFromObj Tcl_GetInt Tcl_GetIntFromObj Tcl_GetLongFromObj Tcl_GetWideIntFromObj Tcl_SetChannelOption CheckForDeadChannel DoTildeSubst FlushChannel GetStatBuf SetBlockMode SetByteArrayFromAny SetFsPathFromAny SetStringFromAny
- login: "coldstore"
- mimetype: "text/plain"
- username: "coldstore"
- icomment:
Ticket change [48c2e07002] (rid 99949) by vincentdarley on 2004-10-18 16:55:29:
- icomment:
Logged In: YES user_id=32170 The segfault cited has been fixed in cvs head a few weeks back. It would be worth looking at the other possible problems in more detail.
- login: "vincentdarley"
- mimetype: "text/plain"
- priority changed to: "5 Medium"
- title changed to: "possible segfaults with NULL interps"
- username: "vincentdarley"
- icomment:
Ticket change [f06442447c] (rid 109187) by dgp on 2006-03-10 13:40:55:
- icomment:
Logged In: YES user_id=80530 where do we stand on this now?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [c8ab81d8e1] (rid 259753) by serhiy.storchaka on 2026-10-21 10:03:39:
- icomment:
The reported crash (<tt>file rename -force</tt> calling Tcl_FSFileAttrsSet() with a NULL interp) was fixed in 8.5.0 by [088b6e6a3c] ([1020538]): the Unix attribute setters no longer touch a NULL interp on error. No crash with the other listed functions has been reported, so closing.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- icomment:
Ticket change [1586797593] (rid 260041) by serhiy.storchaka on 2026-10-22 17:19:32:
- closedate changed to: "2461334.9192101043"
- closer changed to: "serhiy.storchaka"
- login: "serhiy.storchaka"