Tcl Source Code

View Ticket
Login
2026-10-22
17:19 • Ticket [1787911fff] array search of env status still Closed with 3 other cha... artifact: a10ec60565 user: serhiy.storchaka
2026-10-21
10:03 • Closed ticket [1787911fff]. artifact: 8011cb6fc0 user: serhiy.storchaka
09:58 • Closed ticket [2889257fff]: array startsearch and friends do not work on env</... artifact: 5a9a674d5d user: serhiy.storchaka
2009-05-01
08:24 • Ticket [1787911fff] array search of env status still Open with 1 other chang... artifact: 66ef572f38 user: msofer
2007-10-28
00:11 • Ticket [1787911fff]: 4 changes artifact: 5c038de29a user: msofer
2007-09-05
02:09 • Ticket [1787911fff]: 4 changes artifact: 2056f467fa user: msofer
2007-09-04
16:43 • New ticket [1787911fff]. artifact: c8dbda013a user: dgp

Ticket UUID: 1787911
Title: array search of env
Type: Bug Created on: 2007-09-04 16:43:12
Submitter: dgp Assigned to: msofer
Subsystem: 07. Variables Severity:
Priority: 6 Last modified: 2026-10-22 17:19:30
Status: Closed Closed by: serhiy.storchaka
Resolution: Fixed Closed on: 2026-10-21 10:03:37
Version: obsolete: 8.5a7
Description:
Noted on the chat:

% set a [array startsearch env]
s-1-env
% array anymore env $a
couldn't find search "s-1-env"
User Comments:
msofer added on 2007-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.

msofer added on 2007-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.

serhiy.storchaka added on 2026-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.