[GHC] #10149: The argument of mask does not always restore the masking state
#10149: The argument of mask does not always restore the masking state -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Status: new Type: bug | Milestone: Priority: normal | Version: 7.8.4 Component: | Operating System: Unknown/Multiple libraries/base | Type of failure: None/Unknown Keywords: | Blocked By: Architecture: | Related Tickets: Unknown/Multiple | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- In the documentation of `mask` and `uninterruptibleMask` it is claimed that the `restore` argument restores the masking state. However this is not true in the following programs: {{{#!hs mask_ $ -- start with exceptions masked mask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $ restore $ getMaskingState >>= print }}} {{{#!hs uninterruptibleMask_ $ -- start with exceptions uninterruptibly masked uninterruptibleMask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $ restore $ getMaskingState >>= print }}} The expected state is that `getMaskingState` would produce `MaskedInterruptible` and `MaskedUninterruptible`, however, in both cases it gives Unmasked. Either the documentation needs to be changed, or the implementation must really restore the masking state in these cases. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10149: The argument of mask does not always restore the masking state -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Status: new Type: bug | Milestone: Priority: normal | Version: 7.8.4 Component: libraries/base | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Description changed by facundo.dominguez: Old description:
In the documentation of `mask` and `uninterruptibleMask` it is claimed that the `restore` argument restores the masking state. However this is not true in the following programs:
{{{#!hs mask_ $ -- start with exceptions masked mask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $ restore $ getMaskingState >>= print }}}
{{{#!hs uninterruptibleMask_ $ -- start with exceptions uninterruptibly masked uninterruptibleMask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $ restore $ getMaskingState >>= print }}}
The expected state is that `getMaskingState` would produce `MaskedInterruptible` and `MaskedUninterruptible`, however, in both cases it gives Unmasked.
Either the documentation needs to be changed, or the implementation must really restore the masking state in these cases.
New description: In the documentation of `mask` and `uninterruptibleMask` it is claimed that the `restore` argument restores the masking state. However this is not true in the following programs: {{{#!hs mask_ $ -- start with exceptions masked mask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $ restore $ getMaskingState >>= print }}} {{{#!hs uninterruptibleMask_ $ -- start with exceptions uninterruptibly masked uninterruptibleMask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $ restore $ getMaskingState >>= print }}} The expected result is that `getMaskingState` would produce `MaskedInterruptible` and `MaskedUninterruptible`, however, in both cases it gives Unmasked. Either the documentation needs to be changed, or the implementation must really restore the masking state in these cases. -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10149: The argument of mask does not always restore the masking state -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Status: new Type: bug | Milestone: Priority: normal | Version: 7.8.4 Component: libraries/base | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by facundo.dominguez): Other failing examples not involving `forkIOWithUnmask`: {{{#!hs mask $ \unmask -> mask $ \restore -> unmask $ restore $ getMaskingState >>= print }}} {{{#!hs uninterruptibleMask $ \unmask -> uninterruptibleMask $ \restore -> unmask $ restore $ getMaskingState >>= print }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10149: The argument of mask does not always restore the masking state -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Status: new Type: bug | Milestone: Priority: normal | Version: 7.8.4 Component: libraries/base | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by qnikst): * cc: qnikst (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10149: The argument of mask does not always restore the masking state -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | facundo.dominguez Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1327 Wiki Page: | -------------------------------------+------------------------------------- Changes (by facundo.dominguez): * owner: => facundo.dominguez * differential: => Phab:D1327 * version: 7.8.4 => 7.11 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10149: The argument of mask does not always restore the masking state -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | facundo.dominguez Type: bug | Status: patch Priority: normal | Milestone: Component: libraries/base | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1327 Wiki Page: | -------------------------------------+------------------------------------- Changes (by facundo.dominguez): * status: new => patch -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10149: The argument of mask does not always restore the masking state -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | facundo.dominguez Type: bug | Status: patch Priority: normal | Milestone: Component: libraries/base | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1327 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"2b25a589ae8f6364bf086b4878f5ec26954931d3/ghc" 2b25a58/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="2b25a589ae8f6364bf086b4878f5ec26954931d3" base: Have the argument of mask restore the state. The implementation of `mask` and `uninterruptibleMask` assumed so far that the restore argument would be called in a context with the same masking state as that set by `mask` or `uninterruptibleMask`. This patch has the restore argument restore the masking, whatever the current masking state is. Test Plan: validate Reviewers: simonmar, hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie, qnikst Differential Revision: https://phabricator.haskell.org/D1327 GHC Trac Issues: #10149 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10149: The argument of mask does not always restore the masking state -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | facundo.dominguez Type: bug | Status: merge Priority: normal | Milestone: Component: libraries/base | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1327 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge Comment: Going to merge to `ghc-7.10` as well. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10149: The argument of mask does not always restore the masking state -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | facundo.dominguez Type: bug | Status: closed Priority: normal | Milestone: Component: libraries/base | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1327 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC