|
2026-05-21
| ||
| 13:43 | • Ticket [8014353dcb] append env(varname) overwrites existing value status sti... artifact: e3657f9aff user: apnadkarni | |
|
2026-04-26
| ||
| 11:19 | • Ticket [8014353dcb]: 4 changes artifact: 524d90df5a user: apnadkarni | |
| 11:12 | • Ticket [8014353dcb]: 3 changes artifact: 57477a23cd user: apnadkarni | |
| 11:04 | • New ticket [8014353dcb]. artifact: 4fe360e36d user: apnadkarni | |
append env(varname) overwrites existing value
Open8014353dcbac77b8d0c2ad4d1be43603b48fa6c7Created 220 days agoUpdated 195 days ago
Descriptionmarkdown2026-04-26 11:04:56
As the transcript below shows, appending to an environment variable using the lowercase name when originally stored as uppercase overwrites instead of appending. However,
c:\src\tcltk\wip\tcl\win>set USERNAME
USERNAME=ashok
c:\src\tcltk\wip\tcl\win>tclsh
% set env(USERNAME)
ashok
% append env(username) nadkarni
nadkarni <--------------- OVERWRITE
% set env(USERNAME)
nadkarni
% exit
c:\src\tcltk\wip\tcl\win>tclsh
% set env(USERNAME)
ashok
% append env(USERNAME) nadkarni
ashoknadkarni <---------------OK
% set env(USERNAME)
ashoknadkarni
% exit
Curiously, if the value is read previously in lowercase before appending, it all works as expected.
c:\src\tcltk\wip\tcl\doc>tclsh
% set env(username) <---------------- read using lowercase
ashok
% append env(username) nadkarni
ashoknadkarni <---------------- then works as expected
% set env(USERNAME)
ashoknadkarni
apnadkarnimarkdown2026-04-26 11:12:37
The env manpage states environment variable names PATH and COMSPEC are automatically converted to uppercase. It does not say anything about other environment variables. However,
the reported behavior is also seen with
PATHeven if variables other than the above two are case-sensitive, there is still an inconsistency because in that case setting
usernameshould not affectUSERNAME.
apnadkarniplain2026-04-26 11:19:48
Present in 8.6 as well
apnadkarniplain2026-05-21 13:43:48
As per ticket [3057639fff], issues around append/lappend, compiled/uncompiled behavior seem to have been around forever and still exist. This ticket might be related.
Log in (anonymous is fine) to add a comment.