haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 691 forks source link

Mysterious segfault with custom Setup.hs #4423

Open RyanGlScott opened 7 years ago

RyanGlScott commented 7 years ago

Idris's setup program started segfaulting recently. I'm quite baffled as to what's going on here—the only thing I can say for sure is that a custom Setup.hs is definitely required to trigger this bug. I have a cabal-gh4367 repo which attempts to minimize the steps needed to reproduce the error. You can see the segfault happen yourself on this most recent Travis run. Note that it happens on every version of GHC except for GHC 8.0.2, for some reason.

Here's an excerpt from the GHC 7.10.3 run:

$ cabal configure --enable-tests --enable-benchmarks -v2
/opt/ghc/7.10.3/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in /opt/ghc/7.10.3/bin
found ghc-pkg in /opt/ghc/7.10.3/bin/ghc-pkg
/opt/ghc/7.10.3/bin/ghc-pkg --version
/opt/ghc/7.10.3/bin/ghc --supported-languages
/opt/ghc/7.10.3/bin/ghc --info
Reading available packages...
/usr/bin/pkg-config --version
/usr/bin/pkg-config --list-all
/usr/bin/pkg-config --modversion libtasn1 gio-unix-2.0 QtHelp zlib cairo-xcb QtOpenGL gio-2.0 libcdt QtNetwork QtTest libidn libpng12 cairo-gobject xinerama p11-kit-1 randrproto menu cairo-ps gmodule-2.0 IlmBase lcms QtDeclarative glib-2.0 xdmcp ImageMagick xau QtScriptTools libgraph pango MagickWand libdrm panelw gl libcgraph fontutil libpcrecpp pangoft2 ice QtCore libexslt libevent_pthreads libffi gmodule-no-export-2.0 pangox OpenEXR xrender gdk-pixbuf-2.0 libdrm_nouveau libxdot gdk-pixbuf-xlib-2.0 xext QtDesigner xcb QtSql pthread-stubs lqr-1 xproto 'gtk+-unix-print-2.0' python-2.7 QtUiTools renderproto gdk-2.0 menuw libssl librtmp yaml-0.1 ossp-uuid libevent openssl libxml-2.0 xi xrandr libevent_openssl cairo-pdf xcursor ncurses python xcomposite fixesproto xcb-shm xt QtXml pangocairo ddjvuapi gmodule-export-2.0 damageproto libgvpr dri x11 iso-codes xdamage libpq QtScript tinfo cairo-xlib QtDesignerComponents libdrm_nouveau1 sqlite3 'ncurses++w' 'gtk+-x11-2.0' pixman-1 compositeproto gnutls Qt3Support libpathplan QtDBus kbproto inputproto cairo-xcb-shm xextproto libdrm_radeon gobject-2.0 libgvc libpng gthread-2.0 cairo-fc fontconfig 'ncurses++' libcrypto python2 form com_err libcurl libpcreposix tic pangoxft cairo-xlib-xrender cairo-ft cairo cairo-png xft QtGui libmemcached libdrm_intel atk xkeyboard-config sm udisks xineramaproto glu cairo-svg QtWebKit ncursesw Wand QtXmlPatterns gnutls-extra xcb-render shared-mime-info panel gdk-x11-2.0 libpcre libexif autoopts xtrans freetype2 MagickCore formw xfixes udev QtSvg librsvg-2.0 'gtk+-2.0' QtCLucene xorg-sgml-doctools libxslt
Choosing modular solver.
Resolving dependencies...
creating dist/setup
creating dist
creating dist/setup
copy ./Setup.hs to ./dist/setup/setup.hs
/opt/ghc/7.10.3/bin/ghc --make -odir ./dist/setup -hidir ./dist/setup -i -i. -package-id Cabal-1.22.5.0-9ea569737527320f512dad57b36ee312 ./dist/setup/setup.hs -o ./dist/setup/setup -threaded
[1 of 1] Compiling Main             ( dist/setup/setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
./dist/setup/setup configure --verbose=2 --ghc --prefix=/home/travis/.cabal
--disable-library-profiling --disable-executable-profiling --user
--extra-prog-path=/home/travis/.cabal/bin
--dependency=array=array-0.5.1.0-960bf9ae8875cc30355e086f8853a049
--dependency=base=base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
--dependency=binary=binary-0.7.5.0-5784fd031a720c3b84e73006e444c7ca
--dependency=bytestring=bytestring-0.10.6.0-c60f4c543b22c7f7293a06ae48820437
--dependency=containers=containers-0.5.6.2-e59c9b78d840fa743d4169d4bea15592
--dependency=deepseq=deepseq-1.4.1.1-614b63b36dd6e29d2b35afff57c25311
--dependency=directory=directory-1.3.1.1-GnluS50K3JJEl2Z38DQGUl
--dependency=filepath=filepath-1.4.0.0-f97d1e4aebfd7a03be6980454fe31d6e
--dependency=haskeline=haskeline-0.7.3.1-caebd446bbd40de5f68f6f6ebe1048c7
--dependency=pretty=pretty-1.1.2.0-5cc412214ea63f61ee84c4fbabdbe0ec
--dependency=time=time-1.5.0.1-edbd1a50e7922b396ada189ab8e8523b
--dependency=transformers=transformers-0.4.2.0-81450cd8f86b36eaa8fa0cbaf6efc3a3
--disable-tests --exact-configuration --disable-benchmarks
Configuring idris-0.12.3...
Dependency array ==0.5.1.0: using array-0.5.1.0
Dependency base ==4.8.2.0: using base-4.8.2.0
Dependency binary ==0.7.5.0: using binary-0.7.5.0
Dependency bytestring ==0.10.6.0: using bytestring-0.10.6.0
Dependency containers ==0.5.6.2: using containers-0.5.6.2
Dependency deepseq ==1.4.1.1: using deepseq-1.4.1.1
Dependency directory ==1.3.1.1: using directory-1.3.1.1
Dependency filepath ==1.4.0.0: using filepath-1.4.0.0
Dependency haskeline ==0.7.3.1: using haskeline-0.7.3.1
Dependency pretty ==1.1.2.0: using pretty-1.1.2.0
Dependency time ==1.5.0.1: using time-1.5.0.1
Dependency transformers ==0.4.2.0: using transformers-0.4.2.0
/home/travis/build.sh: line 62:  2629 Segmentation fault      (core dumped) cabal configure --enable-tests --enable-benchmarks -v2

Here's the Setup.hs file in question. Nothing seems terribly out of the ordinary... do you have any idea what might be causing this?

RyanGlScott commented 7 years ago

Some observations:

grayjay commented 7 years ago

This sounds very similar to a segfault that I got when building cabal, #3216. I had installed process-1.4.2.0 in the user database, and Cabal depended on an older process.

EDIT: new-build and a custom-setup section would force consistent dependencies for the setup script.