Artifacts Associated With Ticket 0238027108
Ticket change [1845801f5c] (rid 168763) by anonymous on 2019-01-29 22:56:19:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I quote the doc: TCL_ARGV_CONSTANT The argument does not take any following value argument. If this argument is present, the int pointed to by the srcPtr field is copied to the dstPtr field. The clientData field is ignored. But today, while programming an extension, I noticed that it's not "the int pointed to by the srcPtr field" but the pointer itself being put in dstPtr. When compiling the attached "test.c" and testing it, I get: $ gcc -shared -o test.{so,c} -DUSE_TCL_STUBS -I/usr/include -L/usr/lib64 -ltclstub8.6 $ tclsh > load ./test.so > test1 -opt 515178680 > test2 -opt 10 After looking at the source code, the solution is either applying diff --git a/tclIndexObj.c b/tclIndexObj.c index 30c33f1..4a388a5 100644 --- a/tclIndexObj.c +++ b/tclIndexObj.c @@ -1207,7 +1207,7 @@ Tcl_ParseArgsObjv( infoPtr = matchPtr; switch (infoPtr->type) { case TCL_ARGV_CONSTANT: - *((int *) infoPtr->dstPtr) = PTR2INT(infoPtr->srcPtr); + *((int *) infoPtr->dstPtr) = *(infoPtr->srcPtr); break; case TCL_ARGV_INT: if (objc == 0) { or changing the documentation to mean that it's the value being copied. - foundin initialized to: "8.6.8"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "f597160e566927b8647015fd255e6e6f01f7002c"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "None"
- title initialized to:
Tcl_ParseArgsObjv TCL_ARGV_CONSTANT documentation error
- type initialized to: "Bug"
Add attachment "test.c" [892a3478cd] (rid 168764) by anonymous on 2019-01-29 22:57:35.
Ticket change [679a3afc33] (rid 168765) by anonymous on 2019-01-29 23:00:13:
- comment changed to:
I quote the doc: TCL_ARGV_CONSTANT The argument does not take any following value argument. If this argument is present, the int pointed to by the srcPtr field is copied to the dstPtr field. The clientData field is ignored. But today, while programming an extension, I noticed that it's not "the int pointed to by the srcPtr field" but the pointer itself being put in dstPtr. When compiling the attached "test.c" and testing it, I get: $ gcc -shared -o test.{so,c} -DUSE_TCL_STUBS -I/usr/include -L/usr/lib64 -ltclstub8.6 $ tclsh > load ./test.so > test1 -opt 515178680 > test2 -opt 10 After looking at the source code, the solution is either applying diff --git a/tclIndexObj.c b/tclIndexObj.c index 30c33f1..07792c5 100644 --- a/tclIndexObj.c +++ b/tclIndexObj.c @@ -1207,7 +1207,7 @@ Tcl_ParseArgsObjv( infoPtr = matchPtr; switch (infoPtr->type) { case TCL_ARGV_CONSTANT: - *((int *) infoPtr->dstPtr) = PTR2INT(infoPtr->srcPtr); + *((int *) infoPtr->dstPtr) = *((int *) infoPtr->srcPtr); break; case TCL_ARGV_INT: if (objc == 0) { or changing the documentation to mean that it's the value being copied. - login: "anonymous"
- mimetype: "text/plain"
- comment changed to:
Add attachment "tcl8.6.8_generic_tclIndexObj.c.patch" [995ad0f2cc] (rid 168766) by anonymous on 2019-01-29 23:00:34.
Ticket change [9fb3b8992a] (rid 168786) by jan.nijtmans on 2019-01-31 20:48:17:
- icomment:
Actually, I don't know if TCL_ARGV_CONSTANT is useful in real life, but the problem is: If we change the actual behavior then current extensions using TCL_ARGV_CONSTANT will be broken by this changes. Therefore I would suggest to change the documentation. Thanks for reporting this! Maybe it - indeed - would be more logical to change the implementation, but it's too dangerous IMHO
- login: "jan.nijtmans"
- mimetype: "text/plain"
- icomment:
Ticket change [6cec17a27d] (rid 168790) by jan.nijtmans on 2019-01-31 21:05:28:
- icomment:
There actually is a test-case, testing for the actual current behavior: [artifact/76c4d17a5f6cca82?ln=7367]
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [81dde1ae4c] (rid 168792) by jan.nijtmans on 2019-01-31 21:09:41:
- closedate changed to: "2458515.38172537"
- closer changed to: "jan.nijtmans"
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [f06410a50f] (rid 170397) by jan.nijtmans on 2019-03-25 15:47:05:
- closedate changed to: "2458568.15770266"
- icomment:
Documentation fixed in: [b970ae4ac5]. Will be in next release.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"