[Git][ghc/ghc][wip/T16546] 12 commits: Hadrian: fix binary-dir with --docs=none

Ben Gamari gitlab at gitlab.haskell.org
Sat Apr 13 13:59:28 UTC 2019



Ben Gamari pushed to branch wip/T16546 at Glasgow Haskell Compiler / GHC


Commits:
c401f8a4 by Sylvain Henry at 2019-04-11T23:51:24Z
Hadrian: fix binary-dir with --docs=none

Hadrian's "binary-dist" target must check that the "docs" directory
exists (it may not since we can disable docs generation).

- - - - -
091195a4 by Ömer Sinan Ağacan at 2019-04-11T23:57:38Z
Remove unused remilestoning script

- - - - -
fa0ccbb8 by Ömer Sinan Ağacan at 2019-04-11T23:57:38Z
Update a panic message

Point users to the right URL

- - - - -
beaa07d2 by Sylvain Henry at 2019-04-12T17:17:21Z
Hadrian: fix ghci wrapper script generation (#16508)

- - - - -
e05df3e1 by Ben Gamari at 2019-04-12T17:23:30Z
gitlab-ci: Ensure that version number has three components

- - - - -
885d2e04 by klebinger.andreas at gmx.at at 2019-04-12T18:40:04Z
Add -ddump-stg-final to dump stg as it is used for codegen.

Intermediate STG does not contain free variables which can be useful
sometimes. So adding a flag to dump that info.

- - - - -
3c759ced by Alp Mestanogullari at 2019-04-12T18:46:54Z
Hadrian: add a --test-accept/-a flag, to mimic 'make accept'

When -a or --test-accept is passed, and if one runs the 'test' target, then
any test failing because of mismatching output and which is not expected to
fail will have its expected output adjusted by the test driver, effectively
considering the new output correct from now on.

When this flag is passed, hadrian's 'test' target becomes sensitive to the
PLATFORM and OS environment variable, just like the Make build system:
- when the PLATFORM env var is set to "YES", when accepting a result, accept it
  for the current platform;
- when the OS env var is set to "YES", when accepting a result, accept it
  for all wordsizes of the current operating system.

This can all be combined with `--only="..."` and `TEST="..." to only accept
the new output of a subset of tests.

- - - - -
f4b5a6c0 by Alp Mestanogullari at 2019-04-12T18:46:54Z
Hadrian: document -a/--test-accept

- - - - -
30a0988d by Ben Gamari at 2019-04-12T19:41:07Z
gitlab: Disable windows-hadrian job

Not only is it reliably failing due to #16574 but all of the quickly
failing builds also causes the Windows runners to run out of disk space.

- - - - -
8870a51b by Ben Gamari at 2019-04-12T19:41:07Z
gitlab: Don't run lint-submods job on Marge branches

This broke Marge by creating a second pipeline (consisting of only the
`lint-submods` job). Marge then looked at this pipeline and concluded
that CI for her merge branch passed. However, this is ignores the fact
that the majority of the CI jobs are triggered on `merge_request` and
are therefore in another pipeline.

- - - - -
7876d088 by Ben Gamari at 2019-04-13T13:51:59Z
linters: Fix check-version-number

This should have used `grep -E`, not `grep -e`
- - - - -
cf14e5e0 by Ben Gamari at 2019-04-13T13:59:24Z
base: Better document implementation implications of Data.Timeout

As noted in #16546 timeout uses asynchronous exceptions internally, an
implementation detail which can leak out in surprising ways.  Note this
fact.

Also expose the `Timeout` tycon.

[skip ci]

- - - - -


20 changed files:

- .gitlab-ci.yml
- + .gitlab/linters/check-version-number.sh
- compiler/ghci/ByteCodeLink.hs
- compiler/main/DynFlags.hs
- compiler/main/HscMain.hs
- configure.ac
- − distrib/remilestoning.pl
- docs/users_guide/debugging.rst
- hadrian/doc/make.md
- hadrian/doc/testsuite.md
- hadrian/src/CommandLine.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Settings/Builders/RunTest.hs
- libraries/base/System/Timeout.hs
- testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr
- testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-ws-32-mingw32
- testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-ws-64-mingw32
- testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr
- testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-32-mingw32
- testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-64-mingw32


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -59,6 +59,7 @@ ghc-linters:
     - validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
     - .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
     - .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
+    - .gitlab/linters/check-version-number.sh
   dependencies: []
   tags:
     - lint
@@ -84,7 +85,14 @@ lint-submods:
     refs:
       - master
       - /ghc-[0-9]+\.[0-9]+/
-      - wip/marge_bot_batch_merge_job
+
+lint-submods-marge:
+  extends: .lint-submods
+  only:
+    refs:
+      - merge_requests
+    variables:
+      - $CI_MERGE_REQUEST_LABELS =~ /.*wip/marge_bot_batch_merge_job.*/
 
 lint-submods-mr:
   extends: .lint-submods
@@ -524,7 +532,7 @@ validate-x86_64-linux-fedora27:
     paths:
       - ghc.tar.xz
 
-validate-x86_64-windows-hadrian:
+.validate-x86_64-windows-hadrian:
   extends: .build-windows-hadrian
   variables:
     MSYSTEM: MINGW64


=====================================
.gitlab/linters/check-version-number.sh
=====================================
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -e
+
+grep -E -q '\[[0-9]+\.[0-9]+\.[0-9]+\]' configure.ac ||
+  ( echo "error: configure.ac: GHC version number must have three components."; exit 1 )


=====================================
compiler/ghci/ByteCodeLink.hs
=====================================
@@ -154,8 +154,8 @@ linkFail who what
                 , "the missing library using the -L/path/to/object/dir and -lmissinglibname"
                 , "flags, or simply by naming the relevant files on the GHCi command line."
                 , "Alternatively, this link failure might indicate a bug in GHCi."
-                , "If you suspect the latter, please send a bug report to:"
-                , "  glasgow-haskell-bugs at haskell.org"
+                , "If you suspect the latter, please report this as a GHC bug:"
+                , "  https://www.haskell.org/ghc/reportabug"
                 ])
 
 


=====================================
compiler/main/DynFlags.hs
=====================================
@@ -384,6 +384,7 @@ data DumpFlag
    | Opt_D_dump_spec
    | Opt_D_dump_prep
    | Opt_D_dump_stg
+   | Opt_D_dump_stg_final
    | Opt_D_dump_call_arity
    | Opt_D_dump_exitify
    | Opt_D_dump_stranal
@@ -3339,6 +3340,8 @@ dynamic_flags_deps = [
         (setDumpFlag Opt_D_dump_prep)
   , make_ord_flag defGhcFlag "ddump-stg"
         (setDumpFlag Opt_D_dump_stg)
+  , make_ord_flag defGhcFlag "ddump-stg-final"
+        (setDumpFlag Opt_D_dump_stg_final)
   , make_ord_flag defGhcFlag "ddump-call-arity"
         (setDumpFlag Opt_D_dump_call_arity)
   , make_ord_flag defGhcFlag "ddump-exitify"


=====================================
compiler/main/HscMain.hs
=====================================
@@ -1470,6 +1470,8 @@ doCodeGen hsc_env this_mod data_tycons
     let dflags = hsc_dflags hsc_env
 
     let stg_binds_w_fvs = annTopBindingsFreeVars stg_binds
+    dumpIfSet_dyn dflags Opt_D_dump_stg_final
+                  "STG for code gen:" (pprGenStgTopBindings stg_binds_w_fvs)
     let cmm_stream :: Stream IO CmmGroup ()
         cmm_stream = {-# SCC "StgCmm" #-}
             StgCmm.codeGen dflags this_mod data_tycons


=====================================
configure.ac
=====================================
@@ -13,7 +13,7 @@ dnl
 # see what flags are available. (Better yet, read the documentation!)
 #
 
-AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.9], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION])
+AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.9.0], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION])
 
 # Set this to YES for a released version, otherwise NO
 : ${RELEASE=NO}


=====================================
distrib/remilestoning.pl deleted
=====================================
@@ -1,119 +0,0 @@
-#!/usr/bin/env perl
-
-use warnings;
-use strict;
-
-use DBI;
-
-# ===== Config:
-
-my $dbfile = "trac.db";
-my $milestone = "7.4.1";
-my $test = 0;
-
-# ===== Code:
-
-my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile","","", {});
-
-my %emailof;
-my %ticketsfor;
-
-sub getUserAddress {
-    my $sth = $dbh->prepare("SELECT sid, value FROM session_attribute WHERE name = 'email'");
-    $sth->execute();
-    while (my $result = $sth->fetchrow_hashref("NAME_lc")) {
-        my $username = $result->{sid};
-        my $email    = $result->{value};
-        if (defined($emailof{$username})) {
-            die "Two e-mail addresses found for $username";
-        }
-        if ($email =~ /@/) {
-            $emailof{$username} = $email;
-        }
-        else {
-            # warn "The e-mail address $email for $username contains no @";
-        }
-    }
-    $sth->finish;
-}
-
-sub doTickets {
-    my $sth = $dbh->prepare("SELECT id, summary, reporter, cc FROM ticket WHERE milestone = ? AND status = 'new'");
-    $sth->execute($milestone);
-    while (my $result = $sth->fetchrow_hashref("NAME_lc")) {
-        my $ticket   = $result->{id};
-        my $title    = $result->{summary};
-        my $reporter = $result->{reporter};
-        my $cc       = $result->{cc};
-        my %addresses;
-        my $address_added;
-        for my $who ($reporter, split /[ ,]+/, $cc) {
-            $address_added = 0;
-            if ($who =~ /@/) {
-                $addresses{$who} = 1;
-                $address_added = 1;
-            }
-            if (defined($emailof{$who})) {
-                $addresses{$emailof{$who}} = 1;
-                $address_added = 1;
-            }
-            if ($who ne "nobody" && $address_added eq 0) {
-                # warn "No address found for $who";
-            }
-        }
-        for my $address (keys(%addresses)) {
-            $ticketsfor{$address}{$ticket}{"title"} = $title;
-        }
-    }
-    $sth->finish;
-}
-
-sub doEmails {
-    for my $email (sort (keys %ticketsfor)) {
-        if ($test ne 0) {
-            open FH, ">&STDOUT";
-        }
-        else {
-            open(FH, '|-', 'mail', '-s', 'GHC bugs', '-a', 'From: glasgow-haskell-bugs at haskell.org', $email) or die "Running mail failed: $!";
-        }
-        print FH <<'EOF';
-
-Hello,
-
-You are receiving this mail because you are the reporter, or on the CC
-list, for one or more GHC tickets that are automatically having their
-priority reduced due to our post-release ticket handling policy:
-    https://gitlab.haskell.org/ghc/ghc/wikis/working-conventions/bug-tracker#re-milestoning-tickets-after-a-release
-
-The list of tickets for which you are the reporter or on the CC list is
-given below. If any of these are causing problems for you, please let us
-know on glasgow-haskell-bugs at haskell.org and we'll look at raising the
-priority.
-
-Better still, if you are able to make any progress on any of the tickets
-yourself (whether that be actually fixing the bug, or just making it
-easier for someone else to - for example, by making a small,
-self-contained test-case), then that would be a great help. We at GHC HQ
-have limited resources, so if anything is waiting for us to make
-progress then it can be waiting a long time!
-EOF
-        for my $ticket (sort {$a <=> $b} (keys %{$ticketsfor{$email}})) {
-            my $title = $ticketsfor{$email}{$ticket}{"title"};
-            print FH "\n";
-            print FH "#$ticket $title:\n";
-            print FH "    https://gitlab.haskell.org/ghc/ghc/issues/$ticket\n";
-        }
-        print FH <<'EOF';
-
---
-The GHC Team
-http://www.haskell.org/ghc/
-EOF
-        close FH or die "Close failed: $!";
-    }
-}
-
-&getUserAddress();
-&doTickets();
-&doEmails();
-


=====================================
docs/users_guide/debugging.rst
=====================================
@@ -380,6 +380,11 @@ These flags dump various phases of GHC's STG pipeline.
 
     Show the output of the intermediate STG-to-STG pass. (*lots* of output!)
 
+.. ghc-flag:: -ddump-stg-final
+    :shortdesc: Show output of last STG pass.
+    :type: dynamic
+
+    Show the output of the last STG pass before we generate Cmm.
 
 C-\\- representation
 ~~~~~~~~~~~~~~~~~~~~


=====================================
hadrian/doc/make.md
=====================================
@@ -123,6 +123,8 @@ time you fire up a build. This is not possible with the Make build system.
   make test                             # (1)
   make test TEST=plugins01              # (2)
   make test TEST="plugins01 plugins02"  # (3)
+  make accept                           # (4)
+  PLATFORM=YES OS=YES make accept       # (5)
 
 
   # Hadrian
@@ -134,6 +136,12 @@ time you fire up a build. This is not possible with the Make build system.
   build test --only="plugins01 plugins02"    # equivalent to (3)
   TEST="plugins01 plugins02" build test      # equivalent to (3)
   TEST=plugins01 build test --only=plugins02 # equivalent to (3)
+
+  build test -a            # equivalent to (4)
+  build test --test-accept # equivalent to (4)
+
+  PLATFORM=YES OS=YES build test -a            # equivalent to (5)
+  PLATFORM=YES OS=YES build test --test-accept # equivalent to (5)
   ```
 
   As illustrated in the examples above, you can use the `TEST` environment


=====================================
hadrian/doc/testsuite.md
=====================================
@@ -40,6 +40,31 @@ TEST="test1 test2" build test
 TEST="test1 test2" build test --only="test3 test4"
 ```
 
+## Accepting new output
+
+You can use the `-a` or `--test-accept` flag to "accept" the new
+output of your tests. This has the effect of updating the expected
+output of all the tests that fail due to mismatching output, so as to
+consider the new output the correct one.
+
+When the `PLATFORM` environment variable is set to `YES`, passing this flag has
+the effect of accepting the new output for the current platform.
+
+When the `OS` environment variable is set to `YES`, passing this flag has the
+effect of accepting the new output for all word sizes on the current OS.
+
+``` sh
+# accept new output for all tests
+build test -a
+
+# just run and accept new output for 'test123' and 'test456'
+build test -a --only="test123 test456"
+
+# accept new output for current platform and all word sizes for
+# the current OS, for all tests
+PLATFORM=YES OS=YES build test -a
+```
+
 ## Performance tests
 
 You can use the `--only-perf` and `--skip-perf` flags to


=====================================
hadrian/src/CommandLine.hs
=====================================
@@ -56,7 +56,8 @@ data TestArgs = TestArgs
     , testSpeed      :: TestSpeed
     , testSummary    :: Maybe FilePath
     , testVerbosity  :: Maybe String
-    , testWays       :: [String] }
+    , testWays       :: [String]
+    , testAccept     :: Bool}
     deriving (Eq, Show)
 
 -- | Default value for `TestArgs`.
@@ -73,7 +74,8 @@ defaultTestArgs = TestArgs
     , testSpeed      = TestNormal
     , testSummary    = Nothing
     , testVerbosity  = Nothing
-    , testWays       = [] }
+    , testWays       = []
+    , testAccept     = False }
 
 readConfigure :: Either String (CommandLineArgs -> CommandLineArgs)
 readConfigure = Right $ \flags -> flags { configure = True }
@@ -124,6 +126,9 @@ readProgressInfo ms =
 readTestKeepFiles :: Either String (CommandLineArgs -> CommandLineArgs)
 readTestKeepFiles = Right $ \flags -> flags { testArgs = (testArgs flags) { testKeepFiles = True } }
 
+readTestAccept :: Either String (CommandLineArgs -> CommandLineArgs)
+readTestAccept = Right $ \flags -> flags { testArgs = (testArgs flags) { testAccept = True } }
+
 readTestCompiler :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
 readTestCompiler compiler = maybe (Left "Cannot parse compiler") (Right . set) compiler
   where
@@ -245,7 +250,8 @@ optDescrs =
     , Option [] ["test-verbose"] (OptArg readTestVerbose "TEST_VERBOSE")
       "A verbosity value between 0 and 5. 0 is silent, 4 and higher activates extra output."
     , Option [] ["test-way"] (OptArg readTestWay "TEST_WAY")
-      "only run these ways" ]
+      "only run these ways"
+    , Option ['a'] ["test-accept"] (NoArg readTestAccept) "Accept new output of tests" ]
 
 -- | A type-indexed map containing Hadrian command line arguments to be passed
 -- to Shake via 'shakeExtra'.


=====================================
hadrian/src/Rules/BinaryDist.hs
=====================================
@@ -121,7 +121,13 @@ bindistRules = do
         copyDirectory (ghcBuildDir -/- "lib") bindistFilesDir
         copyDirectory (rtsIncludeDir)         bindistFilesDir
         need ["docs"]
-        copyDirectory (root -/- "docs") bindistFilesDir
+        -- TODO: we should only embed the docs that have been generated
+        -- depending on the current settings (flavours' "ghcDocs" field and
+        -- "--docs=.." command-line flag)
+        -- Currently we embed the "docs" directory if it exists but it may
+        -- contain outdated or even invalid data.
+        whenM (doesDirectoryExist (root -/- "docs")) $ do
+          copyDirectory (root -/- "docs") bindistFilesDir
         when windows $ do
           copyDirectory (root -/- "mingw") bindistFilesDir
           -- we use that opportunity to delete the .stamp file that we use
@@ -141,7 +147,7 @@ bindistRules = do
                    (["configure", "Makefile"] ++ bindistInstallFiles)
         need $ map ((bindistFilesDir -/- "wrappers") -/-) ["check-api-annotations"
                    , "check-ppr", "ghc", "ghc-iserv", "ghc-pkg"
-                   , "ghci-script", "ghci", "haddock", "hpc", "hp2ps", "hsc2hs"
+                   , "ghci-script", "haddock", "hpc", "hp2ps", "hsc2hs"
                    , "runghc"]
 
         -- Finally, we create the archive <root>/bindist/ghc-X.Y.Z-platform.tar.xz
@@ -287,9 +293,8 @@ bindistMakefile = unlines
     , "\tdone"
     , ""
     , "install_ghci:"
-    , "\t at echo \"Copying and installing ghci\""
-    , "\t$(CREATE_SCRIPT) '$(WrapperBinsDir)/ghci'"
-    , "\t at echo \"#!$(SHELL)\" >>  '$(WrapperBinsDir)/ghci'"
+    , "\t at echo \"Installing ghci wrapper\""
+    , "\t at echo \"#!$(SHELL)\" >  '$(WrapperBinsDir)/ghci'"
     , "\tcat wrappers/ghci-script >> '$(WrapperBinsDir)/ghci'"
     , "\t$(EXECUTABLE_FILE) '$(WrapperBinsDir)/ghci'"
     , ""
@@ -325,6 +330,7 @@ bindistMakefile = unlines
     , "\t\t$(call installscript,$p,$(WrapperBinsDir)/$p," ++
       "$(WrapperBinsDir),$(ActualBinsDir),$(ActualBinsDir)/$p," ++
       "$(ActualLibsDir),$(docdir),$(includedir)))"
+    , "\trm -f '$(WrapperBinsDir)/ghci-script'" -- FIXME: we shouldn't generate it in the first place
     , ""
     , "PKG_CONFS = $(wildcard $(ActualLibsDir)/package.conf.d/*)"
     , "update_package_db:"
@@ -350,7 +356,6 @@ bindistMakefile = unlines
 wrapper :: FilePath -> String
 wrapper "ghc"         = ghcWrapper
 wrapper "ghc-pkg"     = ghcPkgWrapper
-wrapper "ghci"        = ghciWrapper
 wrapper "ghci-script" = ghciScriptWrapper
 wrapper "haddock"     = haddockWrapper
 wrapper "hsc2hs"      = hsc2hsWrapper
@@ -367,9 +372,6 @@ ghcPkgWrapper = unlines
     [ "PKGCONF=\"$libdir/package.conf.d\""
     , "exec \"$executablename\" --global-package-db \"$PKGCONF\" ${1+\"$@\"}" ]
 
-ghciWrapper :: String
-ghciWrapper = "exec \"$executablename\" --interactive \"$@\"\n"
-
 haddockWrapper :: String
 haddockWrapper = "exec \"$executablename\" -B\"$libdir\" -l\"$libdir\" ${1+\"$@\"}\n"
 


=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -71,6 +71,11 @@ runTestBuilderArgs = builder RunTest ? do
     debugged            <- read <$> getTestSetting TestGhcDebugged
     keepFiles           <- expr (testKeepFiles <$> userSetting defaultTestArgs)
 
+    accept <- expr (testAccept <$> userSetting defaultTestArgs)
+    (acceptPlatform, acceptOS) <- expr . liftIO $
+        (,) <$> (maybe False (=="YES") <$> lookupEnv "PLATFORM")
+            <*> (maybe False (=="YES") <$> lookupEnv "OS")
+
     windows     <- expr windowsHost
     darwin      <- expr osxHost
     threads     <- shakeThreads <$> expr getShakeOptions
@@ -95,6 +100,9 @@ runTestBuilderArgs = builder RunTest ? do
             , arg "-e", arg $ "darwin=" ++ show darwin
             , arg "-e", arg $ "config.local=False"
             , arg "-e", arg $ "config.cleanup=" ++ show (not keepFiles)
+            , arg "-e", arg $ "config.accept=" ++ show accept
+            , arg "-e", arg $ "config.accept_platform=" ++ show acceptPlatform
+            , arg "-e", arg $ "config.accept_os=" ++ show acceptOS
             , arg "-e", arg $ "config.exeext=" ++ quote exe
             , arg "-e", arg $ "config.compiler_debugged=" ++ quote (yesNo debugged)
             , arg "-e", arg $ "ghc_debugged=" ++ quote (yesNo debugged)


=====================================
libraries/base/System/Timeout.hs
=====================================
@@ -16,7 +16,7 @@
 --
 -------------------------------------------------------------------------------
 
-module System.Timeout ( timeout ) where
+module System.Timeout ( Timeout, timeout ) where
 
 #if !defined(mingw32_HOST_OS)
 import Control.Monad
@@ -35,7 +35,11 @@ import Data.Unique         (Unique, newUnique)
 -- interrupt the running IO computation when the timeout has
 -- expired.
 
-newtype Timeout = Timeout Unique deriving Eq -- ^ @since 4.0
+-- | An exception thrown to a thread by 'timeout' to interrupt a timed-out
+-- computation.
+--
+-- @since 4.0
+newtype Timeout = Timeout Unique deriving Eq
 
 -- | @since 4.0
 instance Show Timeout where
@@ -67,20 +71,25 @@ instance Exception Timeout where
 -- another thread.
 --
 -- A tricky implementation detail is the question of how to abort an @IO@
--- computation. This combinator relies on asynchronous exceptions internally.
--- The technique works very well for computations executing inside of the
--- Haskell runtime system, but it doesn't work at all for non-Haskell code.
--- Foreign function calls, for example, cannot be timed out with this
--- combinator simply because an arbitrary C function cannot receive
--- asynchronous exceptions. When @timeout@ is used to wrap an FFI call that
--- blocks, no timeout event can be delivered until the FFI call returns, which
--- pretty much negates the purpose of the combinator. In practice, however,
--- this limitation is less severe than it may sound. Standard I\/O functions
--- like 'System.IO.hGetBuf', 'System.IO.hPutBuf', Network.Socket.accept, or
--- 'System.IO.hWaitForInput' appear to be blocking, but they really don't
--- because the runtime system uses scheduling mechanisms like @select(2)@ to
--- perform asynchronous I\/O, so it is possible to interrupt standard socket
--- I\/O or file I\/O using this combinator.
+-- computation. This combinator relies on asynchronous exceptions internally
+-- (namely throwing the computation the 'Timeout' exception).  The technique
+-- works very well for computations executing inside of the Haskell runtime
+-- system, but it doesn't work at all for non-Haskell code.  Foreign function
+-- calls, for example, cannot be timed out with this combinator simply because
+-- an arbitrary C function cannot receive asynchronous exceptions. When
+-- @timeout@ is used to wrap an FFI call that blocks, no timeout event can be
+-- delivered until the FFI call returns, which pretty much negates the purpose
+-- of the combinator. In practice, however, this limitation is less severe than
+-- it may sound. Standard I\/O functions like 'System.IO.hGetBuf',
+-- 'System.IO.hPutBuf', Network.Socket.accept, or 'System.IO.hWaitForInput'
+-- appear to be blocking, but they really don't because the runtime system uses
+-- scheduling mechanisms like @select(2)@ to perform asynchronous I\/O, so it
+-- is possible to interrupt standard socket I\/O or file I\/O using this
+-- combinator.
+---
+-- Note that 'timeout' cancels the computation by throwing it the 'Timeout'
+-- exception. Consequently blanket exception handlers (e.g. catching
+-- 'SomeException') within the computation will break the timeout behavior.
 timeout :: Int -> IO a -> IO (Maybe a)
 timeout n f
     | n <  0    = fmap Just f


=====================================
testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr
=====================================
@@ -20,6 +20,6 @@ archives or DLLs needed by your current session.  Restart GHCi, specifying
 the missing library using the -L/path/to/object/dir and -lmissinglibname
 flags, or simply by naming the relevant files on the GHCi command line.
 Alternatively, this link failure might indicate a bug in GHCi.
-If you suspect the latter, please send a bug report to:
-  glasgow-haskell-bugs at haskell.org
+If you suspect the latter, please report this as a GHC bug:
+  https://www.haskell.org/ghc/reportabug
 


=====================================
testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-ws-32-mingw32
=====================================
@@ -20,6 +20,6 @@ archives or DLLs needed by your current session.  Restart GHCi, specifying
 the missing library using the -L/path/to/object/dir and -lmissinglibname
 flags, or simply by naming the relevant files on the GHCi command line.
 Alternatively, this link failure might indicate a bug in GHCi.
-If you suspect the latter, please send a bug report to:
-  glasgow-haskell-bugs at haskell.org
+If you suspect the latter, please report this as a GHC bug:
+  https://www.haskell.org/ghc/reportabug
 


=====================================
testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-ws-64-mingw32
=====================================
@@ -20,6 +20,6 @@ archives or DLLs needed by your current session.  Restart GHCi, specifying
 the missing library using the -L/path/to/object/dir and -lmissinglibname
 flags, or simply by naming the relevant files on the GHCi command line.
 Alternatively, this link failure might indicate a bug in GHCi.
-If you suspect the latter, please send a bug report to:
-  glasgow-haskell-bugs at haskell.org
+If you suspect the latter, please report this as a GHC bug:
+  https://www.haskell.org/ghc/reportabug
 


=====================================
testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr
=====================================
@@ -20,6 +20,6 @@ archives or DLLs needed by your current session.  Restart GHCi, specifying
 the missing library using the -L/path/to/object/dir and -lmissinglibname
 flags, or simply by naming the relevant files on the GHCi command line.
 Alternatively, this link failure might indicate a bug in GHCi.
-If you suspect the latter, please send a bug report to:
-  glasgow-haskell-bugs at haskell.org
+If you suspect the latter, please report this as a GHC bug:
+  https://www.haskell.org/ghc/reportabug
 


=====================================
testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-32-mingw32
=====================================
@@ -20,6 +20,6 @@ archives or DLLs needed by your current session.  Restart GHCi, specifying
 the missing library using the -L/path/to/object/dir and -lmissinglibname
 flags, or simply by naming the relevant files on the GHCi command line.
 Alternatively, this link failure might indicate a bug in GHCi.
-If you suspect the latter, please send a bug report to:
-  glasgow-haskell-bugs at haskell.org
+If you suspect the latter, please report this as a GHC bug:
+  https://www.haskell.org/ghc/reportabug
 


=====================================
testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-64-mingw32
=====================================
@@ -20,6 +20,6 @@ archives or DLLs needed by your current session.  Restart GHCi, specifying
 the missing library using the -L/path/to/object/dir and -lmissinglibname
 flags, or simply by naming the relevant files on the GHCi command line.
 Alternatively, this link failure might indicate a bug in GHCi.
-If you suspect the latter, please send a bug report to:
-  glasgow-haskell-bugs at haskell.org
+If you suspect the latter, please report this as a GHC bug:
+  https://www.haskell.org/ghc/reportabug
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/466fb8462f0131a5acc0c36dbdb8689c89334d9b...cf14e5e0ad910e8d0f8a0ea78bafd7800106f2a9

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/466fb8462f0131a5acc0c36dbdb8689c89334d9b...cf14e5e0ad910e8d0f8a0ea78bafd7800106f2a9
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190413/cfeb54d1/attachment-0001.html>


More information about the ghc-commits mailing list