Skip to content
Tcl Source Code History Of Ticket e87000d842
Login

History Of Ticket e87000d842

Artifacts Associated With Ticket e87000d842

  1. Ticket change [7ae66c3258] (rid 185452) by chw on 2020-08-11 11:41:36:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      When doing a "fconfigure stdout" or "chan configure stdout" on Win32
      console channels, an immediate crash can happen. A potential fix is:
      
      ---8><------8><------8><------8><------8><------8><------8><------
      Index: win/tclWinConsole.c
      ==================================================================
      --- win/tclWinConsole.c
      +++ win/tclWinConsole.c
      @@ -1637,19 +1637,23 @@
           }
       
           if (valid) {
              return TCL_OK;
           }
      -    if (infoPtr->flags & CONSOLE_READ_OPS) {
      -       return Tcl_BadChannelOption(interp, optionName, "inputmode winsize");
      -    } else {
      -       return Tcl_BadChannelOption(interp, optionName, "");
      +    if (len > 0) {
      +       const char *optionList = "";
      +
      +       if (infoPtr->flags & CONSOLE_READ_OPS) {
      +           optionList = "inputmode winsize";
      +       }
      +       return Tcl_BadChannelOption(interp, optionName, optionList);
           }
      +    return TCL_OK;
       }
       ^L
       /*
        * Local Variables:
        * mode: c
        * c-basic-offset: 4
        * fill-column: 78
        * End:
        */
      
      ---8><------8><------8><------8><------8><------8><------8><------
      
    5. foundin initialized to: "core-8-branch, current"
    6. is_private initialized to: "0"
    7. login: "chw"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0b3aff16612e1e9f3b675963fa64e01bd1d89307"
    10. resolution initialized to: "None"
    11. severity initialized to: "Critical"
    12. status initialized to: "Open"
    13. submitter initialized to: "chw"
    14. subsystem initialized to: "25. Channel System"
    15. title initialized to: "crash for "fconfigure stdout" in Win32"
    16. type initialized to: "Bug"
  2. Ticket change [3556988b85] (rid 185453) by jan.nijtmans on 2020-08-11 11:58:21:

    1. assignee changed to: "jan.nijtmans"
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  3. Ticket change [2f3b96090b] (rid 185508) by jan.nijtmans on 2020-08-12 07:06:26:

    1. closedate changed to: "2459073.79613492"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Fixed now in core-8-branch. (btw. "winsize" is an androwish extension).
      
      Thanks!
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
  4. Ticket change [87ca7bdc07] (rid 185513) by chw on 2020-08-12 09:03:16:

    1. closedate changed to: "2459073.87727597"
    2. closer changed to: "chw"
    3. icomment:
      No, it is defined per tip#160 as can be seen in this check-in in core-8-branch:
      
      https://core.tcl-lang.org/tcl/blame?filename=win/tclWinConsole.c&checkin=42f24469aa
      
    4. login: "chw"
    5. mimetype: "text/plain"
  5. Ticket change [42e47c868a] (rid 185525) by jan.nijtmans on 2020-08-12 10:32:46:

    1. closedate changed to: "2459073.93943143"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      >No, it is defined per tip#160
      
      Indeed, which means that my fix was wrong (applied to the wrong lines in tclWinConsole.c. The actual problem was in Tcl\_BadChannelOption() which didn't protect against NULL argument. Should be fixed better now.
      
      -winsize is a read-only option, that's what caused the confusion.
      
      Thanks!
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
  6. Ticket change [8ee28d9cc1] (rid 185527) by chw on 2020-08-12 11:39:27:

    1. closedate changed to: "2459073.98572949"
    2. closer changed to: "chw"
    3. icomment:
      I think the problem is somewhat different. In the Win32 console case
      it starts with the (wrong) assumption, that the window size can be
      determined on stdin (the input handle from GetStandardHandle(...)).
      However, that information can only be read out from a console handle
      with a screen buffer, i.e stdout if obtained from GetStandardHandle().
      
      A proof of concept which properly supports -winsize is in the AndroWish
      repo, see 
      
      https://www.androwish.org/home/file?name=jni/tcl/win/tclWinConsole.c&ci=tip
      
      Regarding the crash: if you look at the various implementations of
      GetOptionsProc() most set a valid flag even in the optionName = NULL
      case and return earlier than Tcl_BadChannelOption(). Others deal with
      len > 0 (in case optionName is NULL, len is 0) and if len is zero don't
      call Tcl_BadChannelOption() at all.
      
    4. login: "chw"
    5. mimetype: "text/plain"