[GHC] #14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2)

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Keywords: | Operating System: Windows Architecture: | Type of failure: Incorrect result Unknown/Multiple | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- On Windows, the situation regarding Ctrl+C in GHCi has always been a little flaky in the sense that some shells (e.g., `mintty`-based ones) don't intercept Ctrl+C properly, causing GHCi to exit prematurely. However, up until 8.0.2, Ctrl+C was being intercepted correctly on `cmd.exe` and PowerShell. In GHC 8.2.1, however, this has changed. If you hit Ctrl+C in GHCi on PowerShell, then GHCi will appear to "exit" (in the sense that the prompt will go back to the PowerShell one). However, if you try typing and entering commands, there's a 50-50 chance it will be interpreted by PowerShell or a lingering GHCi process (indicating that GHCi wasn't really killed!). (Apologies for the rather crude description, but I'm not sure of a better way to report what is going on here.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: Phyx (removed) * cc: Phyx- (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * related: => #3081 Comment: These interrupt handlers have been rather flaky but the code hasn't changed the 8 years since they were written I think. The runtime will immediately kill the process if it receives two ctrl+c after each other. I suspect that something with threading is messing up again and handling the same event twice. But will need to investigate to be sure, but seems related to #3081 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): I can't seem to be able to reproduce this though... Actually I wonder, does `ghc --interactive` have the same behavior? So don't go through the `ghci.exe`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Ah, good eye. Indeed, this problem does //not// happen with `ghc.exe --interactive`, only with `ghci.exe`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Then I know what's going on, the `FreeConsole()` call that was there in the `cwrapper.c` before that broke under Windows 10 recently was detaching the caller from the console. I suspect now that this was done to now have the caller still handle signals. The issue was by putting it in `cwrapper` it broke in cases where the caller should handle it. such as when GHC calls GCC. So the call should actually be in `ghci.c` not in `cwrapper.c`, since here we *do* have an interactive session. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Interesting. Do you have a hunch where `FreeConsole()` //should// live in `ghci.c`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): I think the code has to be slightly refactored. either a Boolean passed to `run` that indicates to call `FreeConsole` after the `CreateProcess` call, or run should return the process to wait on so callers can do custom stuff before blocking. I think `FreeConsole` has to be called after the new process is made so there are more than one process sharing the console, otherwise a call to `FreeConsole` will destroy the console and the new process won't have a console to use. At least I think... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Or maybe have `run` take a callback of sorts. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.2.2 Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * milestone: => 8.2.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Phab:D4028 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * status: new => patch * differential: => Phab:D4028 * milestone: 8.2.2 => 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Phab:D4028 Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Thanks, Phyx-! If it's not too unreasonable, could we consider merging this into 8.2.2? It is a regression from 8.0.2, and moreover, it's one that bites fairly commonly (at least for me, anyways). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Phab:D4028 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): I don't think it's very risky, so I don't see why not. But as always the last word is on @bgamari :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in
8.0.2)
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone: 8.4.1
Component: GHCi | Version: 8.2.1
Resolution: | Keywords:
Operating System: Windows | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: #3081 | Differential Rev(s): Phab:D4028
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Tamar Christina

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.4.1 Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Phab:D4028 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * status: patch => merge Comment: how do you feel about merging this one back @bgamari? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.2.2 Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Phab:D4028 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.4.1 => 8.2.2 Comment: Alright, we can do that. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14150: Ctrl+C causes GHCi 8.2.1 to "exit" in Windows (which didn't happen in 8.0.2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.2.2 Component: GHCi | Version: 8.2.1 Resolution: fixed | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #3081 | Differential Rev(s): Phab:D4028 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.2` in f837db7e1cb23efca86f9804b5aa9503ae765c57. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14150#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC