Overview
| Artifact ID: | b237e6e543a40c88fd6c8e6cec0861b3869e612d1d2f6b4678f10b17559f6da8 |
|---|---|
| Ticket: | c2a8c0a5f64ce6bada9759ce0277a5f06a4cf4e6
Tcl should try to read env(VAR) before unsetting it |
| User & Date: | anonymous on 2021-03-29 17:22:47 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
Bug was discovered when trying to unset env(COLUMNS) set by tclreadline. Since any loaded extension can modify the environment with setenv/putenv, Tcl must try to read an environment variable before unsetting it. Here's a simple example to reproduce it: $ cat setenv.c #include <tcl.h> #include <stdlib.h> int Setenv_Init(Tcl_Interp *interp) { if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { return TCL_ERROR; } if (Tcl_PkgProvide(interp, "Setenv", "1.0") == TCL_ERROR) { return TCL_ERROR; } setenv("MYVAR", "MYVAL", 0); return TCL_OK; } $ gcc -shared -o libsetenv.so -DUSE_TCL_STUBS -I/usr/include/ setenv.c -L/usr/lib64 -ltclstub8.6 $ tclsh [~] load ./libsetenv.so [~] unset env(MYVAR) can't unset "env(MYVAR)": no such element in array [~] puts $env(MYVAR) MYVAL Note that `array unset env MYVAR` works. - foundin changed to: "8.6.8"
- is_private changed to: "0"
- login: "anonymous"
- priority changed to: "5 Medium"
- private_contact changed to: "146dd1e205d9fff77d7951eac899e5ac1489b0a7"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "anonymous"
- subsystem changed to: "08. Environment Variables"
- title changed to:
Tcl should try to read env(VAR) before unsetting it
- type changed to: "Bug"