Skip to content
Tcl Source Code History Of Ticket 2000586fffffffff
Login

History Of Ticket 2000586fffffffff

Artifacts Associated With Ticket 2000586fffffffff

  1. Ticket change [f11750d026] (rid 109304) by ferrieux on 2008-06-23 08:48:18:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized 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 ;-)
      
      
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "ferrieux"
    10. subsystem initialized to: "25. Channel System"
    11. title initialized to: "Dangerous reuse of channel names in unix"
    12. type initialized to: "Bug"
  2. Ticket change [049889e2d4] (rid 120022) by dkf on 2008-06-23 16:17:27:

    1. closedate changed to: "2008-06-23T09:17:27"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      I cannot see how this is dangerous in any substantive way. Your code has a probable-bug; that is all.
      
      Moreover, it's useful on Unix to be able to find out the FD from the script level (e.g. for when you're poking around in /proc which is non-portable, but useful all the same). Stop trying to fix non-bugs.
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. priority changed to: "1 Zero"
    7. resolution changed to: "Invalid"
    8. status changed to: "Closed"
    9. username: "dkf"
  3. Ticket change [8eb31d6f25] (rid 120158) by ferrieux on 2008-06-23 16:51:32:

    1. icomment:
      Logged In: YES 
      user_id=496139
      Originator: YES
      
      Had a bad night Donal ?
      Do you think it is nice to have such a report slam-closed in one's face ?
      Are you sure your opinion is shared across the TCT ?
      Are you proud to veto a fix for a script-level, simply observable, semantic leak ?
      Yes my code was intentionally buggy. But aren't you the first to recognize that a language's primary duty is to timely warn about mistakes rather than pulling them under the rug ?
      Are you serious about the hacking-FDs argument ? I do strace and /proc all day long, never did I have to look at the script-level channel name to know which is what (for one, in /proc/*/fd a readlink gives you the identification of the underlying object, and even for pipes and socket you can follow the graph).
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  4. Ticket change [2b2d5a90f4] (rid 118698) by dkf on 2008-06-23 17:33:34:

    1. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      I think this is an unnecessary change, and I note that it's not possible to say for sure that people aren't using the fact that the FD is in the channel name. It's not possible to extrapolate from just your own experience with the hacks that people do; that's why more than one person is a maintainer. The point about prime duties of a language is obfuscatory and totally off topic. Tcl uses the FD in the channel handle name (except for stdin/stdout/stderr); it has done for many years — more than I've been using Tcl at least — so I'm really loth to change it as who knows what you'd break? (I know I've written code in the past to determine what file a particular channel is opened upon, which can be useful in complex programs; doing this by grabbing the number off the end of the channel name and looking /proc/[pid]/fd is the easiest way since it doesn't require you to retain any metadata yourself. Having to strace the program would have sucked, since it ran for at full tilt for hours...)
      
      Why not go and write some photo image rotation or scaling code or something? That'd be welcomed by many...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  5. Ticket change [7c1cfd5afd] (rid 97024) by ferrieux on 2008-06-23 17:42:45:

    1. icomment:
      Logged In: YES 
      user_id=496139
      Originator: YES
      
      > Why not go and write some photo image rotation or scaling code or
      > something? That'd be welcomed by many...
      
      I read this as "go play with the other kids and let adults talk".
      This is not a nice feeling.
      
      And to answer your question literally, I think I am rather equally balanced between consolidation (fcopy, tell) and extrapolation (chan pipe, lrange, CONCAT1, info zaplevel). Given your reaction to at least [lrange] and CONCAT1, let's say my output buffer is full and I block in fflush().
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  6. Ticket change [5faf7a5292] (rid 115861) by msofer on 2008-06-24 05:41:43:

    1. icomment:
      Logged In: YES 
      user_id=148712
      Originator: NO
      
      I read this as "Donal must have had a very bad day, and he'll probably apologize when he's well rested". Both you guys seem to be a bit too touchy.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"