Skip to content
Tcl Source Code History Of Ticket 76ad7aeba3
Login

History Of Ticket 76ad7aeba3

Artifacts Associated With Ticket 76ad7aeba3

  1. Ticket change [a93ee0f462] (rid 200907) by mistachkin on 2022-05-20 17:32:02:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      The following script show a bug in the [string is integer] sub-command:
      
        set class integer
        set value 18446744073709551615
        string is $class $value; # should be 0
      
      The result was "1" (incorrect) using the following check-ins running on
      the Linux x86_64 platform:
      
      core-8-6-branch - e7da3f4504cd9db6e28fd4ed73dae542ab7c91f4
      core-8-branch - eaf93525a5d4bd519dfd68add09a3586ca0c1831
      
    5. foundin initialized to: "8.6.12"
    6. is_private initialized to: "0"
    7. login: "mistachkin"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Important"
    11. status initialized to: "Open"
    12. submitter initialized to: "mistachkin"
    13. subsystem initialized to: "18. Commands M-Z"
    14. title initialized to: "boundary case bug in [string is integer]"
    15. type initialized to: "Bug"
  2. Ticket change [289eb5dc85] (rid 200908) by mistachkin on 2022-05-20 17:42:53:

    1. comment changed to:
      The following script shows a bug in the [string is integer] sub-command:
      
        set class integer
        set value 18446744073709551615
        string is $class $value; # should be 0
      
      The result was "1" (incorrect) using the following check-ins running on
      the Linux x86_64 platform:
      
        core-8-6-branch - e7da3f4504cd9db6e28fd4ed73dae542ab7c91f4
        core-8-branch - eaf93525a5d4bd519dfd68add09a3586ca0c1831
      
      Also, compare and contrast with the result of the following command:
      
        string is integer 18446744073709551615; # should be 0
      
      This seems to imply that the bug involves the compiler.
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
  3. Ticket change [5de8b3151b] (rid 200909) by mistachkin on 2022-05-20 17:43:52:

    1. comment changed to:
      The following script shows a bug in the [string is integer] sub-command:
      
        set class integer
        set value 18446744073709551615
        string is $class $value; # should be 0
      
      The result was "1" (incorrect) using the following check-ins running on
      the Linux x86_64 platform:
      
        core-8-6-branch - e7da3f4504cd9db6e28fd4ed73dae542ab7c91f4
        core-8-branch - eaf93525a5d4bd519dfd68add09a3586ca0c1831
      
      Also, compare and contrast with the result of the following command:
      
        string is integer 18446744073709551615; # should be 0
      
      This seems to imply that the bug involves the compiler (or lack thereof?).
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
  4. Ticket change [8d105f672e] (rid 200910) by chrstphrchvz on 2022-05-21 21:29:10:

    1. icomment:
      This behavior occurs when non-compiled <tt>StringIsCmd()</tt> is invoked (which seems to be whenever the class isn’t specified as a literal); by the time it is invoked, the value already has a bignum representation, which <tt>Tcl_GetIntFromObj()</tt> → <tt>Tcl_GetLongFromObj()</tt> extract -1 from rather than return <tt>TCL_ERROR</tt> for.
      
      So I’m inclined to think this is a bug in <tt>Tcl_GetIntFromObj()</tt> and/or <tt>Tcl_GetLongFromObj()</tt>, affecting any bignum value within &#91;18446744069414584320,18446744073709551615&#93;, i.e. &#91;(2**64-1)-(2**32-1),2**64-1&#93; (at least on LP64).
      
      There should probably be a unit test made for this.
      
    2. login: "chrstphrchvz"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [3dc2b9e022] (rid 200911) by mistachkin on 2022-05-22 00:15:24:

    1. icomment:
      Thanks for the additional research.
      
      I think there should be a series of unit tests for this.
      
      FWIW, I discovered this issue when comparing (Eagle) unit test suite
      results between Tcl and Eagle, i.e. Eagle produces the correct result
      and Tcl does not.
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
  6. Ticket change [6bbea75da8] (rid 200950) by jan.nijtmans on 2022-05-22 17:22:53:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      Proposed fix [66a187edf25e7d07|here]. Yes, it looks like there - indeed - was a bug in Tcl_GetIntFromObj(), already exposed by testcases get-1.7 up to get-1.14.
      
      The strange thing is that Tcl_GetIntFromObj() is documented to return TCL_OK for values between -(UINT_MAX) and UINT_MAX, while Tcl_GetLongFromObj() is documented to return TCL_OK for values between -(ULONG_MAX) and ULONG_MAX. This means that Tcl_GetLongFromObj() is not usable to check whether the obj can be stored in a (long). Proposed solution:  use TclGetNumberFromObj() to do the range-check first. That's what the compiled code does too ;-)
      
      Please review!  Someone interested to write a bunch of unit-tests?
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
    5. resolution changed to: "Fixed"
    6. status changed to: "Pending"
  7. Ticket change [3cfca9d214] (rid 200951) by mistachkin on 2022-05-22 21:29:36:

    1. icomment:
      The changes look good based on my reading; however, more eyes would be better.
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
  8. Ticket change [972267176a] (rid 201088) by jan.nijtmans on 2022-05-25 11:06:04:

    1. closedate changed to: "2459724.96255279"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Fixed [e58be38bfd5ee1d4|here]
      
      Thanks for the report!
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. status changed to: "Closed"