Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
b45df929
Commit
b45df929
authored
Aug 22, 2016
by
Edward Z. Yang
Browse files
Give an explicit message when SIGSEGV happens.
Fixes #767. Signed-off-by:
Edward Z. Yang
<
ezyang@cs.stanford.edu
>
parent
6cca0e71
Changes
7
Hide whitespace changes
Inline
Side-by-side
cabal-install/Distribution/Client/ProjectBuilding.hs
View file @
b45df929
...
...
@@ -690,7 +690,8 @@ rebuildTargets verbosity
InstallPlan
.
execute
jobControl
keepGoing
(
BuildFailure
Nothing
.
DependentFailed
.
packageId
)
installPlan
$
\
pkg
->
handle
(
return
.
Left
)
$
fmap
Right
$
--TODO: review exception handling
--TODO: review exception handling
handle
(
\
(
e
::
BuildFailure
)
->
return
(
Left
e
))
$
fmap
Right
$
let
uid
=
installedUnitId
pkg
Just
pkgBuildStatus
=
Map
.
lookup
uid
pkgsBuildStatus
in
...
...
cabal-install/Distribution/Client/ProjectOrchestration.hs
View file @
b45df929
...
...
@@ -93,7 +93,7 @@ import Data.Either
import
Control.Exception
(
Exception
(
..
))
import
System.Exit
(
ExitCode
(
..
),
exitFailure
)
#
ifdef
MIN_VERSION_unix
import
System.Posix.Signals
(
sigKILL
)
import
System.Posix.Signals
(
sigKILL
,
sigSEGV
)
#
endif
...
...
@@ -586,11 +586,14 @@ reportBuildFailures verbosity plan buildOutcomes
|
otherwise
=
False
-- NB: if the Setup script segfaulted or was interrupted,
-- we should give more detailed information. So only
-- assume that exit code 1 is "pedestrian failure."
isFailureSelfExplanatory
(
BuildFailed
e
)
|
Just
(
ExitFailure
_
)
<-
fromException
e
=
True
|
Just
(
ExitFailure
1
)
<-
fromException
e
=
True
isFailureSelfExplanatory
(
ConfigureFailed
e
)
|
Just
(
ExitFailure
_
)
<-
fromException
e
=
True
|
Just
(
ExitFailure
1
)
<-
fromException
e
=
True
isFailureSelfExplanatory
_
=
False
...
...
@@ -651,7 +654,27 @@ reportBuildFailures verbosity plan buildOutcomes
Just
(
ExitFailure
1
)
->
""
#
ifdef
MIN_VERSION_unix
-- Note [Positive "signal" exit code]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- What's the business with the test for negative and positive
-- signal values? The API for process specifies that if the
-- process died due to a signal, it returns a *negative* exit
-- code. So that's the negative test.
--
-- What about the positive test? Well, when we find out that
-- a process died due to a signal, we ourselves exit with that
-- exit code. However, we don't "kill ourselves" with the
-- signal; we just exit with the same code as the signal: thus
-- the caller sees a *positive* exit code. So that's what
-- happens when we get a positive exit code.
Just
(
ExitFailure
n
)
|
-
n
==
fromIntegral
sigSEGV
->
" The build process segfaulted (i.e. SIGSEGV)."
|
n
==
fromIntegral
sigSEGV
->
" The build process terminated with exit code "
++
show
n
++
" which may be because some part of it segfaulted. (i.e. SIGSEGV)."
|
-
n
==
fromIntegral
sigKILL
->
" The build process was killed (i.e. SIGKILL). "
++
explanation
...
...
cabal-install/cabal-install.cabal
View file @
b45df929
...
...
@@ -35,6 +35,10 @@ Extra-Source-Files:
tests/IntegrationTests/custom/plain/A.hs
tests/IntegrationTests/custom/plain/Setup.hs
tests/IntegrationTests/custom/plain/plain.cabal
tests/IntegrationTests/custom/segfault.sh
tests/IntegrationTests/custom/segfault/Setup.hs
tests/IntegrationTests/custom/segfault/cabal.project
tests/IntegrationTests/custom/segfault/plain.cabal
tests/IntegrationTests/exec/Foo.hs
tests/IntegrationTests/exec/My.hs
tests/IntegrationTests/exec/adds_sandbox_bin_directory_to_path.out
...
...
cabal-install/tests/IntegrationTests/custom/segfault.sh
0 → 100644
View file @
b45df929
.
./common.sh
if
[
"x
$(
uname
)
"
!=
"xLinux"
]
;
then
exit
fi
# Older GHCs don't report exit via signal adequately
require_ghc_ge 708
cd
segfault
!
cabal new-build 2> log
cat
log
grep
SIGSEGV log
cabal-install/tests/IntegrationTests/custom/segfault/Setup.hs
0 → 100644
View file @
b45df929
import
System.Posix.Signals
main
=
putStrLn
"Quitting..."
>>
raiseSignal
sigSEGV
cabal-install/tests/IntegrationTests/custom/segfault/cabal.project
0 → 100644
View file @
b45df929
packages: .
cabal-install/tests/IntegrationTests/custom/segfault/plain.cabal
0 → 100644
View file @
b45df929
name: plain
version: 0.1.0.0
license: BSD3
author: Edward Z. Yang
maintainer: ezyang@cs.stanford.edu
build-type: Custom
cabal-version: >=1.10
library
build-depends: base
default-language: Haskell2010
custom-setup
setup-depends: base, unix
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment