Skip to content
Tcl Source Code History Of Ticket 3401704fffffffff
Login

History Of Ticket 3401704fffffffff

Artifacts Associated With Ticket 3401704fffffffff

  1. Ticket change [fe7517d645] (rid 108595) by duquette on 2011-08-31 16:22:07:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      You cannot define expr functions with names that begin with numbers (including "inf" and "nan").  The expression parser looks for numbers before looking for function names.  For example,
      
          expr {2*nancy(5)}
      
      will throw the following error:
      
          missing operator at _@_ 
          in expression "nan_@_cy(5)"
      
      Function names beginning with a digit have the same problem.
      
      Note: it doesn't matter whether the tcl::mathfunc::nancy command is actually defined or not.
      
      
    4. foundin initialized to: "obsolete: 8.5.10"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "duquette"
    10. subsystem initialized to: "45. Parsing and Eval"
    11. title initialized to: "expr parses numbers before function names"
    12. type initialized to: "Bug"
  2. Ticket change [c70f6108cc] (rid 121875) by duquette on 2011-08-31 23:22:44:

    1. icomment:
      Gave this a high priority, per DKF on c.l.t.
      
      
    2. login: "duquette"
    3. mimetype: "text/plain"
    4. priority changed to: "8"
    5. username: "duquette"
  3. Ticket change [2fdb7f088b] (rid 93140) by msofer on 2011-08-31 23:24:06:

    1. assignee changed to: "dgp"
  4. Ticket change [f043e599d0] (rid 109159) by ferrieux on 2011-09-01 00:15:04:

    1. icomment:
      It looks like TclParseNumber tries to mimic strtod. Quoting the manpage:
      
       The  strtod(),  strtof(),  and  strtold() functions convert the initial
       portion of the string pointed to by nptr to  double,  float,  and  long
       double representation, respectively.
      
      The attached patch fixes the issue by detecting trailers after Nan and Inf[inity].
      Trailers currently defined as [0-9A-Za-z_], should be generalized (is there a function for that ?).
      
      In case they are detected, the number parser bails out, and [expr] reports the correct "invalid bareword nancy" or "invalid command name ::tcl::mathfunc::nancy depending on the context. 
      
      
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  5. Ticket change [7aa09ec9b6] (rid 90361) by ferrieux on 2011-09-01 00:15:42:

    1. icomment:
      
      
      File Added - 422482: exprnan.patch
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  6. Ticket change [ff6271d21e] (rid 108744) by dgp on 2011-09-01 00:30:52:

    1. icomment:
      
      Can you commit the patch to a branch bug-3401704
      for more convenient review please?  Thanks!
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [12a2a986c8] (rid 124073) by ferrieux on 2011-09-01 00:50:47:

    1. icomment:
      Done :)
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  8. Ticket change [f6d03d243c] (rid 130368) by ferrieux on 2011-09-01 01:26:06:

    1. icomment:
      
      
      File Deleted - 422482: 
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  9. Ticket change [d193231539] (rid 113374) by ferrieux on 2011-09-01 01:27:15:

    1. icomment:
      Branch bug-3401704 now has the cleaner 'isalnum' predicate instead of hard-coded tests.
      Also includes a new test case expr-22.10
      Removing attached patch now out of sync.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  10. Ticket change [55dacbd03b] (rid 94222) by dgp on 2011-09-01 01:39:55:

    1. icomment:
      
      Oh.  You revised TclParseNumber()? Not at
      all what I was expecting.  My unexamined opinion
      is that the flaw is in the parsing of expressions, not
      numbers.  Will look it over though.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  11. Ticket change [524a045fda] (rid 126291) by ferrieux on 2011-09-01 01:43:19:

    1. icomment:
      Yes. Rationale: ParseLexeme uses TclParseNumber pretty early, as a tokenization first pass. So if I'd fixed the caller, I'd have gotten "inbalid bareword 'cy'". So I had to fix the callee.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  12. Ticket change [4ae158ff64] (rid 126610) by dgp on 2011-09-01 01:49:15:

    1. icomment:
      
      Yes but TclParseNumber has other callers too.
      
      FWIW, 8.6b2 produces this:
      % expr {1eq1}
      1
      % expr {infeqinf}
      invalid bareword "eqinf"
      in expression "inf_@_eqinf";
      should be "$eqinf" or "{eqinf}" or "eqinf(...)" or ...
      % expr {infeq inf}
      1
      
      
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  13. Ticket change [7ac8306390] (rid 90395) by ferrieux on 2011-09-01 02:41:19:

    1. icomment:
      With the patch this becomes:
      
        % expr {infeqinf}
        invalid bareword "infeqinf"
        in expression "infeqinf";
      
      do you prefer the old behavior ? FWIW I don't :}
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  14. Ticket change [b2474ad70b] (rid 98305) by ferrieux on 2011-09-01 04:13:21:

    1. icomment:
      As another example:
      
       string is double -failindex x nancy
      
      formerly returned 3 in $x, now zero. Same remark.
      Do you have counter examples ? A true regression ?
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  15. Ticket change [41a4b39aa4] (rid 116227) by dgp on 2011-09-01 04:33:51:

    1. icomment:
      
      Just for the record, this issue is not a regression.
      
      % info patch
      7.6p2
      % expr {nancy(2)}
      unknown math function "cy"
      % expr {influence(1.2)}
      unknown math function "luence"
      
      similar results all along the way.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  16. Ticket change [22ee8e2225] (rid 130839) by ferrieux on 2011-09-01 04:35:36:

    1. icomment:
      I went through all call sites of TclParseNumber (in the core; not bothered about extensions).
      What I gather from this is:
        - there are many call sites, so fixing them would be tricky/unmaintainable
        - fixing the callee only improves existing error cases
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  17. Ticket change [2bb710aa11] (rid 118788) by ferrieux on 2011-09-01 04:39:43:

    1. icomment:
      
      
      IP - Comment Removed: 81.53.167.132
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  18. Ticket change [4e57f080b0] (rid 127213) by ferrieux on 2011-09-01 04:39:48:

    1. icomment:
      
      
      IP - Comment Removed: 81.53.167.132
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  19. Ticket change [c46bc40c54] (rid 111844) by ferrieux on 2011-09-01 04:39:50:

    1. icomment:
      
      
      IP - Comment Removed: 81.53.167.132
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  20. Ticket change [05c91452e6] (rid 89118) by kennykb on 2011-09-01 04:41:44:

    1. icomment:
      It seems sensible that 'infirmity' or 'nancy' should not be considered numbers. And the only obvious use case that I see breaking is simply that it would change error behaviour for things like screen metrics: [expr {1/0}]cm] would now complain that Infcm isn't a number, rather than being an infinite number of centimetres.
      
      
    2. login: "kennykb"
    3. mimetype: "text/plain"
    4. username: "kennykb"
  21. Ticket change [8b20e03443] (rid 127505) by dgp on 2011-09-01 05:11:33:

    1. icomment:
      On trunk:
      % scan infernal %g%s
      Inf ernal
      
      On review branch:
      % scan infernal %g%s
      {} {}
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  22. Ticket change [9a6c53ddb8] (rid 110940) by ferrieux on 2011-09-01 15:41:00:

    1. icomment:
      To summarise why I think revising T_PN is okay:
      T_PN's contract can be described by a single regexp not very far from (simplifying on the actual float syntax):
      
         ^[+-]?(
               [0-9.e]+
          |
               Inf(inity)?
          |
               Nan(\([0-9af]+\))?
         )
      
      Note that due to the greediness of '+', adding a positive lookahead of [^0-9] after the floating-point part is a no-op:
      
      
         ^[+-]?(
               [0-9.e]+  (?=[^0-9])
          |
               Inf(inity)?
          |
               Nan(\([0-9af]+\))?
         )
      
      This is the current trunk status.
      Now the patch just adds 2 more lookaheads:
      
      
         ^[+-]?(
               [0-9.e]+  (?=[^0-9])
          |
               Inf(inity)? (?=[^0-9A-Za-z_])
          |
               Nan(\([0-9af]+\))? (?=[^0-9A-Za-z_])
         )
      
      That's it. No dirty hack, just a slight bend of the accepted regular language. And that bend is justified, across all callers of T_PN, by the fact that Nancy and Infinitesimal being parsed as Nan+cy and Inf+initesimal are utterly meaningless. If you want to flag this as POTENTIAL INCOMPATIBILITY, please do, but it's a very very tiny one.
      
      While doing the equivalent fix only in T_PE would IMO break symmetry. People doing script emulations of one of the primitives with the others would start noting inconsistencies !
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  23. Ticket change [ae417fa742] (rid 101613) by dgp on 2011-09-02 03:43:35:

    1. icomment:
      see dgp-3401704 branch
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  24. Ticket change [55abf976ce] (rid 94184) by ferrieux on 2011-09-02 04:25:20:

    1. icomment:
      Translation: it's a NO. OK , won't fight.
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  25. Ticket change [1b5d34fa98] (rid 123136) by dgp on 2011-09-07 00:50:16:

    1. icomment:
      
      Earlier attempt was a failed experiment.
      See new dgp-3401704 branch for new attempt.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  26. Ticket change [fa1f476e33] (rid 91821) by dgp on 2011-09-08 01:20:43:

    1. closedate changed to: "2011-09-07T18:20:43"
    2. closer changed to: "dgp"
    3. icomment:
      
      
      allow_comments - 1
      
      fixed for 8.5.11, 8.6b3.
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dgp"