Skip to content

9.4.8 binary archive: Installation fails. Makefile's 'cd lib' line fails if CDPATH shell variable is set

Summary

During installation of ghc, Makefile does a cd lib, a relative directory change. I have the bash variable CDPATH set, and the directory is changed to my lib (/home/eugen/lib) instead of ghc's lib..

Steps to reproduce

I'm using Debian 12 x86_64 arch. I'm using the bash shell and have in the file .bashrc, export CDPATH=~/ (and some more dirs). I have a directory lib in my home directory, so ~/lib. With ghcup tui (v. 0.1.22.0) I wanted to install the recommended ghc 9.4.8. During installation it switches to my /home/eugen/lib directory instead of ghc's.

NOTE: the Makefile seems to also do cd doc and cd wrappers. Everywhere the fix must be apply. Also, other versions might be affected too.

Potential fixes:

  • use cd ./lib instead of cd lib
  • use absolute paths
  • unset the CDPATH variable (idea from chat from @geekosaur )
  • ...

Links:

The ghc 9.4.8 binary release archive used by ghcup in my case: https://downloads.haskell.org/~ghc/9.4.8/ghc-9.4.8-x86_64-deb11-linux.tar.xz
For CDPATH usage, see: https://www.gnu.org/software/bash/manual/bash.html#index-cd

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information