Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b66194d492f355aab50097321d74b3da91cec3e2
Ticket: 3432962fffffffffffffffffffffffffffffffff
Some noninteractive invocations of tclsh still run .tclshrc
User & Date: karll on 2011-11-03 20:16:54
Changes

  1. assignee changed to: "dgp"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Running Tcl without command line arguments but with input not coming from a tty causes .tclshrc (or equivalent) to be loaded.  It shouldn't.  (We don't want peoples' tclshrc files to cause noninteractive Tcl programs to change their behavior.)
    
    How to reproduce:
    Put something in your .tclshrc like...  puts ".tclshrc loaded"
    
    echo exit | tclsh8.5
    
    It will emit ".tclshrc loaded".  It shouldn't.
    
    Note that in the above example, or any other where stdin isn't a tty, tcl_interactive is correctly set to 0.
    
    Here is a context diff for a patch that fixes the bug:
    
    *** tclMain.c.origThu Nov  3 15:02:54 2011
    --- tclMain.cThu Nov  3 15:04:12 2011
    ***************
    *** 460,472 ****
          }
      
          /*
    !      * We're running interactively. Source a user-specific startup file if the
    !      * application specified one and if the file exists.
           */
      
    !     Tcl_SourceRCFile(interp);
    !     if (Tcl_LimitExceeded(interp)) {
    ! goto done;
          }
      
          /*
    --- 460,475 ----
          }
      
          /*
    !      * No script file was specified on the command line.
    !      * If we're running interactively, source a user-specific 
    !      * startup file if the application specified one and if the file exists.
           */
      
    !     if (tty) {
    ! Tcl_SourceRCFile(interp);
    ! if (Tcl_LimitExceeded(interp)) {
    !     goto done;
    ! }
          }
      
          /*
    
    
    
    
    
    
    
    
  4. foundin changed to: "obsolete: 8.5.10"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "karll"
  10. subsystem changed to: "38. Init - Library - Autoload"
  11. title changed to:
    Some noninteractive invocations of tclsh still run .tclshrc
    
  12. type changed to: "RFE"