Skip to content
Tcl Source Code View Ticket
Login

View Ticket

array search of env

Closed / Fixed1787911fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 42 days ago
Descriptionplain2007-09-04 16:43:12
Noted on the chat:

% set a [array startsearch env]
s-1-env
% array anymore env $a
couldn't find search "s-1-env"
Referenced by1
  • 5a9a674d5dClosed ticket [2889257fff]: [array startsearch] and friends do not work on env plus 4 other changes ticket2026-10-21 09:58:25
msoferplain2007-09-05 02:09:48
Logged In: YES 
user_id=148712
Originator: NO

Same result on 8.34, 8.4.14, 8.5a6 (pre varReform), HEAD.
msoferplain2007-10-28 00:11:49
Logged In: YES 
user_id=148712
Originator: NO

The problem is with the way EnvTraceProc works: for array traces it calls TclSetupEnv, which in turns first deletes the env variable and then recreates it. The deletion cancels all searches.

What this means is that the env array cannot be searched at all. This should be either fixed or documented. 

Wary to muck with this stuff, especially since:
(a) the bug is prehistoric, raised few complaints, no tests available
(b) the bug combines two touchy issues (array searches and env), a fix may introduce subtle new bugs

Requesting comments.
msofer Ticket [1787911fff]: 1 change [History diff]2009-05-01 08:24:18
serhiy.storchakawiki2026-10-21 10:03:37

Fixed in 8.6.2 by [afaff33553] (ticket [219226]): env is no longer unset and recreated on array access, so [array startsearch env], anymore and nextelement work.

serhiy.storchaka Ticket [1787911fff]: 3 changes [History diff]2026-10-22 17:19:30
Log in (anonymous is fine) to add a comment.