Skip to content
Tcl Source Code History Of Ticket 7cb7409e05b12cab
Login

History Of Ticket 7cb7409e05b12cab

Artifacts Associated With Ticket 7cb7409e05b12cab

  1. Ticket change [6abdcc66a1] (rid 224157) by emiliano on 2024-04-03 20:29:51:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      Tcl_ParseArgsObjv shows a bug in the TCL_ARGV_GENFUNC case, by not properly
      updating both the objc and srcIndex variables, as read in
      
      https://core.tcl-lang.org/tcl/file?ci=tip&name=generic/tclIndexObj.c&ln=1184-1188
      
      The (integral) return value should be added to srcIndex and substracted from
      objc.
      
      Attached a simple demo file parsearg-bug.c and a patch to address the issue
      against core-8-branch.
      
      Compiled with
      
      gcc -shared -o libparse.so -DUSE_TCL_STUBS -I/usr/local/include parsearg-bug.c -L/usr/local/lib -ltclstub8.7
      
      Before the patch:
      
      <pre>
      % load ./libparse.so
      % parse
      Color: |0|NO COLOR|, Media: |0|NO MEDIA|
      % parse -color Nothing
      Color: |1|Nothing|, Media: |0|NO MEDIA|
      % parse -media A4
      unrecognized argument "A4"
      % parse -media A4 -color Somecolor
      unrecognized argument "A4"
      % parse -color othercolor -media Letter
      unrecognized argument "Letter"
      % parse -color othercolor -media Nosuchmedia
      bad media "Nosuchmedia": must be A4, Legal, or Letter
      </pre>
      
      After
      
      <pre>
      % load ./libparse.so
      % parse
      Color: |0|NO COLOR|, Media: |0|NO MEDIA|
      % parse -color Nothing
      Color: |1|Nothing|, Media: |0|NO MEDIA|
      % parse -media A4
      Color: |0|NO COLOR|, Media: |1|Paper size is ISO A4|
      % parse -media A4 -color Somecolor
      Color: |1|Somecolor|, Media: |1|Paper size is ISO A4|
      % parse -color othercolor -media Letter
      Color: |1|othercolor|, Media: |1|Paper size is US Letter|
      % parse -color othercolor -media Nosuchmedia
      bad media "Nosuchmedia": must be A4, Legal, or Letter
      </pre>
      
      There's also a bug in the documentation, which reads (after the
      Tcl_ArgvGenFuncProc prototype):
      
      "The clientData is the value from the table entry, the interp is where to
      store any error messages, the keyStr is the name of the argument, objc and
      objv describe an array of all the remaining arguments, and dstPtr argument
      to the Tcl_ArgvGenFuncProc is the location to write the parsed value
      (or values) to."
      
      Here, "...the keyStr is the name of the argument,..." is wrong as there's
      no such argument in the prototype.
      
    5. foundin initialized to: "8.7 - trunk"
    6. is_private initialized to: "0"
    7. login: "emiliano"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "fadeac91dee1779dde21ce23534a629c945b508b"
    10. resolution initialized to: "None"
    11. severity initialized to: "Severe"
    12. status initialized to: "Open"
    13. submitter initialized to: "emiliano"
    14. subsystem initialized to: "13. Index Object"
    15. title initialized to: "Tcl_ParseArgsObjv bug with TCL_ARGV_GENFUNC"
    16. type initialized to: "Bug"
  2. Add attachment "parseargs.diff" [4e451c494d] (rid 224158) by emiliano on 2024-04-03 20:30:49.

  3. Add attachment "parsearg-bug.c" [8c62836ffa] (rid 224159) by emiliano on 2024-04-03 20:31:12.

  4. Ticket change [d95b639a51] (rid 224167) by jan.nijtmans on 2024-04-03 22:23:26:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      Thanks! Committed now to a bug-fix branch. I will also add some test-cases.
      
      I wonder if 8.6 has the same bug .....
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
  5. Ticket change [beca8dda93] (rid 224168) by emiliano on 2024-04-03 22:30:37:

    1. icomment:
      Indeed, the code on core-8-6-branch looks pretty much the same. It can be easily backported (just 3 lines).
      
    2. login: "emiliano"
    3. mimetype: "text/plain"
  6. Ticket change [62bea068a6] (rid 224310) by jan.nijtmans on 2024-04-04 21:09:40:

    1. closedate changed to: "2460405.38172067"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Fixed in all branches now (core-8-6-branch, core-8-branch and trunk)
      
      Many thanks!
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Fixed"
    7. severity changed to: "Important"
    8. status changed to: "Closed"