Skip to content
Tcl Source Code History Of Ticket 0238027108
Login

History Of Ticket 0238027108

Artifacts Associated With Ticket 0238027108

  1. Ticket change [1845801f5c] (rid 168763) by anonymous on 2019-01-29 22:56:19:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. 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.
      
    5. foundin initialized to: "8.6.8"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "f597160e566927b8647015fd255e6e6f01f7002c"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "None"
    15. title initialized to:
      Tcl_ParseArgsObjv TCL_ARGV_CONSTANT documentation error
      
    16. type initialized to: "Bug"
  2. Add attachment "test.c" [892a3478cd] (rid 168764) by anonymous on 2019-01-29 22:57:35.

  3. Ticket change [679a3afc33] (rid 168765) by anonymous on 2019-01-29 23:00:13:

    1. 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.
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
  4. Add attachment "tcl8.6.8_generic_tclIndexObj.c.patch" [995ad0f2cc] (rid 168766) by anonymous on 2019-01-29 23:00:34.

  5. Ticket change [9fb3b8992a] (rid 168786) by jan.nijtmans on 2019-01-31 20:48:17:

    1. 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
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  6. Ticket change [6cec17a27d] (rid 168790) by jan.nijtmans on 2019-01-31 21:05:28:

    1. icomment:
      There actually is a test-case, testing for the actual current behavior: [artifact/76c4d17a5f6cca82?ln=7367]
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [81dde1ae4c] (rid 168792) by jan.nijtmans on 2019-01-31 21:09:41:

    1. closedate changed to: "2458515.38172537"
    2. closer changed to: "jan.nijtmans"
    3. login: "jan.nijtmans"
    4. mimetype: "text/plain"
    5. resolution changed to: "Fixed"
    6. status changed to: "Closed"
  8. Ticket change [f06410a50f] (rid 170397) by jan.nijtmans on 2019-03-25 15:47:05:

    1. closedate changed to: "2458568.15770266"
    2. icomment:
      Documentation fixed in: [b970ae4ac5]. Will be in next release.
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"