Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 18170cea48b4e42142900732e455f2206001a9376a35b7e44707556bd871304a
Ticket: af3ebc5fafe0097cb93f0304cd4b7676831a706e
clock scan and clock add bugs in error cases / with abbreviated options
User & Date: pointsman on 2023-05-22 11:57:25
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    The clock command - as the other core commands - supports abbreviated options. Due to deficiencies in the Tcl code in library/clock.tcl this does not work as expected in some error cases.
    
    Example
    
    clock scan 1970-01-01 -format %Y-%m-%d -gmt true -timezone :Europe/Berlin
    
    ==> cannot use -gmt and -timezone in same call
    
    as the documentation say and is expected. Though
    
    clock scan 1970-01-01 -format %Y-%m-%d -g true -timezone :Europe/Berlin
    
    ==> 0
    
    returns a result without error.
    
    Looking at 
    [https://core.tcl-lang.org/tcl/file?udc=1&ln=1209-1242&ci=586f490293ce298c&name=library%2Fclock.tcl] (thats from core-8-6-branch, any later up to trunk has the same code) it is pretty clear what happens. In the foreach loop the option as given (even in abbreviated form) is used as key but the tests later on test only for the full option name.
    
    Other examples of erroneous option processing than the example above can easily found with this observation.
    
    With the clock add command it is even a bit worser. Look at
    
    [https://core.tcl-lang.org/tcl/file?udc=1&ln=4240-4288&ci=586f490293ce298c&name=library%2Fclock.tcl]
    
    In the part following the comment "# Check options for validity" the existence of saw(-gmt) and saw(-timezone) is tested but the saw array isn't set in any case by the code above - the test will never fire.
    
  5. foundin changed to: "8.6 - 9.0"
  6. is_private changed to: "0"
  7. login: "pointsman"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "4ca203a8e925aecdd9419645f936bccf18cd6ea7"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "pointsman"
  14. subsystem changed to: "16. Commands A-H"
  15. title changed to:
    clock scan and clock add bugs in error cases / with abbreviated options
    
  16. type changed to: "Bug"