Stack smashing when building some packages
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
When building some packages (`text-show`, `mmark`), the packages fail to build with a `-6` error code. Some introspection of logs generated by `cabal` report "stack smashing," likely originating from either `ghc` or `gcc`.
**To Reproduce**
Steps to reproduce the behavior:
```
$ git clone https://github.com/recursion-ninja/cabal-build-failure-7456
$ cd cabal-build-failure-7456
$ git checkout e0007b2d7f8e7bf6455c930330a31bcc2f0c36fa
$ cabal build -v --with-compiler=ghc-9.0.1
### Expect a -6 error code
### Look for the file path of the text-show build log
$ tail ~/.cabal/logs/ghc-9.0.1/text-show-3.9-.log
[ 1 of 66] Compiling TextShow.Data.OldTypeable ( src/TextShow/Data/OldTypeable.hs, dist/build/TextShow/Data/OldTypeable.o, dist/build/TextShow/Data/OldTypeable.dyn_o )
[ 2 of 66] Compiling TextShow.GHC.Conc.Windows ( src/TextShow/GHC/Conc/Windows.hs, dist/build/TextShow/GHC/Conc/Windows.o, dist/build/TextShow/GHC/Conc/Windows.dyn_o )
[ 3 of 66] Compiling TextShow.GHC.Stats ( src/TextShow/GHC/Stats.hs, dist/build/TextShow/GHC/Stats.o, dist/build/TextShow/GHC/Stats.dyn_o )
[ 4 of 66] Compiling TextShow.Options ( src/TextShow/Options.hs, dist/build/TextShow/Options.o, dist/build/TextShow/Options.dyn_o )
[ 5 of 66] Compiling TextShow.TH.Names ( shared/TextShow/TH/Names.hs, dist/build/TextShow/TH/Names.o, dist/build/TextShow/TH/Names.dyn_o )
[ 6 of 66] Compiling TextShow.Utils ( src/TextShow/Utils.hs, dist/build/TextShow/Utils.o, dist/build/TextShow/Utils.dyn_o )
[ 7 of 66] Compiling TextShow.Classes ( src/TextShow/Classes.hs, dist/build/TextShow/Classes.o, dist/build/TextShow/Classes.dyn_o )
[ 8 of 66] Compiling TextShow.TH.Internal ( src/TextShow/TH/Internal.hs, dist/build/TextShow/TH/Internal.o, dist/build/TextShow/TH/Internal.dyn_o )
[ 9 of 66] Compiling TextShow.Data.Tuple ( src/TextShow/Data/Tuple.hs, dist/build/TextShow/Data/Tuple.o, dist/build/TextShow/Data/Tuple.dyn_o )
*** stack smashing detected ***: terminated
```
**Expected behavior**
That `text-show` builds successfully.
**System information**
```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.0.1
$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
```
**Additional context**
Moved from #7311
Contributor guide
Assessment
This issue has not been assessed yet.