Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 94c8c3e218717c89e24597873960708ef56166d37797ea4ece8f6dc9ac85d640
Ticket: 0c7ddf85368a7d92578e2409d0c07a09a0c5d691
array variable traces don't disable additional traces on the array
User & Date: anonymous on 2019-11-02 18:18:46
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    When a variable trace is set on an array variable, tracing is supposed to be
    disabled during the trace callback. The following test code shows that this is 
    not the case.
    
    () 1 % set ::foo(bar) one
    one
    () 2 % trace add variable ::foo {read write unset} traceit
    () 3 % proc traceit args {puts "args=$args"; puts "ex=[info exist ::foo]"}
    () 4 % set ::foo(bar)
    args=::foo bar read
    args=::foo {} read
    ex=1
    ex=1
    one
    
    
    While taking a quick peek at the code, it would appear that the flag for an 
    arrayPtr is not getting set to indicate a trace is active. The flag is 
    VAR_TRACE_ACTIVE and it is only set for an item in an array, not for the entire
     array. And so while a trace is active for an element of the array, a trace
     callback that references another member of the array or the array itself, such
     as with the [info exist] call on the array, will trigger a recursive trace 
    callback which is in disagreement with the documentation.
    
  5. foundin changed to: "8.6.9"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "anonymous"
  13. subsystem changed to: "46. Traces"
  14. title changed to:
    array variable traces don't disable additional traces on the array
    
  15. type changed to: "Bug"