Skip to content

Alpine bindists installation breaks if the prefix contains "xxx"

Summary

When the Alpine bindists (tested with 8.10.2 and 9.2.2) are configured to have a --prefix containing xxx anywhere in the path, the installation will fail while trying to access paths that curiously contain 3 spaces instead of xxx.

This is because of the following snippet from its Makefile where xxx is used to temporarily sanitize three spaces:

PKG_CONFS = $(shell find "$(ActualLibsDir)/package.conf.d" -name '*.conf' | sed 's:   :xxx:g')
update_package_db: install_bin install_lib
        @echo "$(PKG_CONFS)"
        @echo "Updating the package DB"
        $(foreach p, $(PKG_CONFS),\
                $(call patchpackageconf,$(shell echo $(notdir $p) | sed 's/-\([0-9]*[0-9]\.\)*conf//g'),$(shell echo "$p" | sed 's:xxx:   :g'),$(docdir),$(shell mk/relpath.s
h "$(ActualLibsDir)" "$(docdir)")))
        '$(WrapperBinsDir)/$(CrossCompilePrefix)ghc-pkg' recache

Steps to reproduce

Use an Alpine bindist for either 8.10.2 or 9.2.2 (others likely also work) and select a prefix containing xxx for configure, then install.

Expected behavior

The installation works normally. Having xxx in prefix is rare, but can happen for Nix since x is part of the alphabet used for Nix's base32 hashes.

Environment

  • GHC version used: 9.2.2, 8.10.2

Optional:

  • Operating System: NixOS
  • System Architecture: x86_64-linux
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information