Haskell.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

ghc-tickets

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2013 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
ghc-tickets@haskell.org

November 2013

  • 1 participants
  • 514 discussions
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 12 Nov '13

12 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by andersk): I’d say we reject those corner cases and turn them into `0xff` like other unexpected values—we only allow the coredump flag in the signal case. (I don’t care strongly.) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:34> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 12 Nov '13

12 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by hvr): Replying to [comment:32 andersk]: > `safeExit` should just ignore the coredump flag. (The process can’t control whether the `SIG_DFL` action for that signal results in a core dump—the list of such signals is defined by the kernel, e.g. `SIG_KERNEL_COREDUMP_MASK` in Linux.) ok, so - `safeExit 0x8300` would be handled like `safeExit 0x0300` but what should happen for the corner-cases - `safeExit 0x8000`, or - `safeExit 0x8001`, or - `safeExit 0x18000` ? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:33> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 12 Nov '13

12 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by andersk): `safeExit` should just ignore the coredump flag. (The process can’t control whether the `SIG_DFL` action for that signal results in a core dump—the list of such signals is defined by the kernel, e.g. `SIG_KERNEL_COREDUMP_MASK` in Linux.) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:32> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 12 Nov '13

12 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by hvr): Replying to [comment:30 andersk]: > * The documentation clearly calls out that our encoding is byte-swapped from the standard one for historical reasons. Yeah, I've planned to enhance the documentation related to `exitWith`, and for the two functions in `process` to reflect the new non-windows encoding. > * We might as well include the core dump bit as bit 15 for completeness. It’s useful for printing messages like `Segmentation fault (core dumped)`, and I don’t see a downside as long as we do it now. glibc, Perl, and Python all provide it as bit 7. ...I'm not against that, but what should `safeExit` do in that case? with the current patch this would cause `other /= 0` and thus terminate normally with exit code 255. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:31> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 11 Nov '13

11 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by andersk): Ugly but acceptable; I’m happy to come to a resolution on this issue, provided * The documentation clearly calls out that our encoding is byte-swapped from the standard one for historical reasons. * We might as well include the core dump bit as bit 15 for completeness. It’s useful for printing messages like `Segmentation fault (core dumped)`, and I don’t see a downside as long as we do it now. glibc, Perl, and Python all provide it as bit 7. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:30> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 11 Nov '13

11 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by hvr): So, the implementation of the last proposal ammmounts to two simple modifications: a patch to `process`: {{{#!diff diff --git a/cbits/runProcess.c b/cbits/runProcess.c index 3462cfc..3a6f2f3 100644 --- a/cbits/runProcess.c +++ b/cbits/runProcess.c @@ -22,12 +22,12 @@ UNIX versions ------------------------------------------------------------------------- */ -// -// If a process terminates with a signal, the exit status we return to -// via the System.Process API follows the Unix shell convention of -// (128 + signal). -// -#define TERMSIG_STATUS(r) ((r) | 0x80) +// If a process was terminated by a signal, the exit status we return +// via the System.Process API is (signum << 8); this avoids collision +// with normal process termination status codes, as according to +// http://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html +// WEXITSTATUS(s) returns an 8-bit value. See also #7229. +#define TERMSIG_STATUS(r) (r << 8) static long max_fd = 0; }}} ...and a patch for `base` (provided by duncan): {{{#!diff diff --git a/GHC/TopHandler.lhs b/GHC/TopHandler.lhs index 9e4bc07..b0c5d0d 100644 --- a/GHC/TopHandler.lhs +++ b/GHC/TopHandler.lhs @@ -180,7 +180,25 @@ flushStdHandles = do -- we have to use unsafeCoerce# to get the 'IO a' result type, since the -- compiler doesn't let us declare that as the result type of a foreign export. safeExit :: Int -> IO a +#ifdef mingw32_HOST_OS safeExit r = unsafeCoerce# (shutdownHaskellAndExit $ fromIntegral r) +#else +-- On Unix we use an encoding for the ExitCode: +-- high 7 bits signal, low 8 bits normal exit code. +-- People can also use ExitCode that do not correspond to Unix exit() +-- codes and we just use a replacement. +safeExit r + | sig /= 0 && code == 0 && other == 0 + = unsafeCoerce# (shutdownHaskellAndSignal $ fromIntegral sig) + | sig == 0 && other == 0 + = unsafeCoerce# (shutdownHaskellAndExit $ fromIntegral code) + | otherwise + = unsafeCoerce# (shutdownHaskellAndExit 0xff) + where + sig = (r .&. 0x7f00) `shiftR` 8 + code = r .&. 0x00ff + other = r .&. (complement 0x7fff) +#endif }}} If there are no objections left, I'll apply the changes above, `validate` (tweaking the testsuite if necessary) and push the changes. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:29> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 11 Nov '13

11 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by hvr): Replying to [comment:18 hvr]: > Ok, in summary I see the following possibilities for the return value of the existing `waitForProcess` call on POSIX systems: > > ... 5. PS/Just for the record: it would also be possible (since `WIFEXITED(s)` and `WIFSIGNALED(s)` are mutually exclusive) to encode signals as negative integers -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:28> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 11 Nov '13

11 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by simonmar): Sounds like this discussion is converging. I'm happy with the proposal to encode signals in bits 8-15 of the exit code, and to have `exitWith` call `kill()` when given one of these signal codes. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:27> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 11 Nov '13

11 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by duncan): See `libraries/base/GHC/TopHandler.lhs` and `rts/RtsStartup.c` -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:26> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
Re: [GHC] #7229: Detecting if a process was killed by a signal is impossible
by GHC 11 Nov '13

11 Nov '13
#7229: Detecting if a process was killed by a signal is impossible --------------------------------------+------------------------------------ Reporter: benmachine | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: libraries/process | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by duncan): hvr points out it's actually only 7bits for the signal, not 8. I can't bring myself to care about the core dump bit in this interface. I'm quite happy with leaving that for the `unix` package. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7229#comment:25> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • ...
  • 52
  • Older →

HyperKitty Powered by HyperKitty version 1.3.9.