Overview
| Artifact ID: | f11750d026d4684bcf0cb6e71cc47fa068cbe621 |
|---|---|
| Ticket: | 2000586fffffffffffffffffffffffffffffffff
Dangerous reuse of channel names in unix |
| User & Date: | ferrieux on 2008-06-23 08:48:18 |
Changes
- assignee changed to: "andreas_kupries"
- cmimetype changed to: "text/plain"
- comment changed to:
The string representation of channels in unix is too directly linked to the file descriptor, which is reused over time. This means that a given channel may be closed, then another one be created later with the same one, and the original channel become usable again, pointing to the wrong file. Demo: % set f [open /dev/null r] file3 % set g [open /dev/null r] file4 % close $f % set h [open /etc/issue.net r] file3 % gets $f line 30 In Windows this does not occur because channel names use handles, and the system seems to never reuse handles (is it guaranteed ?). I think this bug can be solved in a platform-independent and more robust manner (imagine Windows starts reusing handles...), by using our own OS-independent naming system. It could be as simple as incrementing a per-interp uniqueID. No need to keep a compact range of values, since lookup-by-name is only rarely done (and already with a hashtable) thanks to the addition of tclChannelType. For those wary of the 32-bit wrapping, a Wide could be considered ;-)
- foundin changed to: "None"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "ferrieux"
- subsystem changed to: "25. Channel System"
- title changed to: "Dangerous reuse of channel names in unix"
- type changed to: "Bug"