Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 0ef6a0e73df5d836afbd5fecd3704466a946b7dedecc9723a15c8bec7af1e06b
Ticket: bda99f23936f7170e8f51e7e3eb52db794a3195c
gets stdin problem when non-blocking - Windows
User & Date: juliannoble2 on 2024-02-19 06:35:26
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    Seems to affect Windows only. (tested 8.7a6 and 9.0b in ubuntu under WSL and not affected, reported by stevel as not a problem on macos)
    
    when stdin is in line mode but the channel is configured with -blocking 0 - gets fails to return a line when input is above 100 characters.
    The state of -translation auto/cr/lf/crlf doesn't seem to make any difference.
    (chan pending stdin input will show there are bytes available after hitting enter - but gets returns -1)
    
    This is most easily seen in a tclsh shell which behaves differently on windows Tcl 8.7a6/9.0b compared to 8.7a5 and earlier, and is different to Tcl on other platforms.
    
    The string repeat is just to show line of the right length.
    The first set v line is just shy of 100 chars of input - and hitting return brings you straight to the prompt as expected.
    The second set v appears to hang after enter is pushed, but hitting enter a second time, or any other key will return to the prompt.
    If enter was pushed, you get a double prompt. If another key was pushed - the repl prepends that character to the next commandline entered  - usually resulting in an invalid command error.
    (although the extra character is only visible above the % on the previous line or to the left of the % depending on which terminal is being used)
    
    While running the standard repl with stdin set to line mode and nonblocking might not be usual - this behaviour of gets and stdin is potentially confusing/a source of bugs in other contexts.
    
        %chan conf stdin -blocking 0
        % string repeat a 102
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        % set v aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        % set v aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        % %
    
  5. foundin changed to: "8.7a6 - 9.0b"
  6. is_private changed to: "0"
  7. login: "juliannoble2"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "juliannoble2"
  14. subsystem changed to: "25. Channel System"
  15. title changed to: "gets stdin problem when non-blocking - Windows"
  16. type changed to: "Bug"