Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5070fd4ceb20739f0b51f4d658c7a91208159aed
Ticket: 1322866fffffffffffffffffffffffffffffffff
TclFinalizeIOSubsystem closes zero descriptor
User & Date: dgp on 2005-12-19 22:56:06
Changes

  1. icomment:
    Logged In: YES 
    user_id=80530
    
    
    "interpreter closing file
    descriptors not opened by
    itself" is a (underdocumented?)
    feature of Tcl_MakeFileChannel().
    That's a very old interface
    predating the existence of a
    Tcl_Finalize() distinct and
    separate from Tcl_Exit(), IIRC.
    There are existing programs
    that rely on T_MFC acting
    this way.
    
    It's not so clear that when
    Tcl creates default standard
    channels that it ought to be
    calling T_MFC to do it, given
    this feature.  Now that existence
    of Tcl_Finalize() suggests Tcl
    supports finalizing in an app
    that will continue to run, it
    doesn't seem to be a good thing
    that Tcl forces closed the file
    descriptors corresponding to its
    standard channels.
    
    And in this particular report,
    there's the additional wrinkle
    that in this case file descriptor
    0 isn't even the right thing to
    attach to the "stdin" channel.
    
    Since this report is about an
    "embedded interpreter" I assume
    the app in question is a C program,
    and the workaround ought to be to
    include whatever Tcl_SetStdChannel()
    calls are required to force Tcl to
    use some harmless alternatives for
    its std* channels, and not the
    0, 1, 2 file descriptors being used
    in other ways by the program.
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"