Skip to content

Package listing is duplicated when using `-Wunused-packages`

Summary

As per title.

Originally spotted here: https://github.com/tweag/rules_haskell/issues/1309

Steps to reproduce

CAT=cat

$CAT << EOF > test-package-env
package-id base-4.14.0.0
package-id containers-0.6.2.1
EOF

$CAT << EOF > Main.hs  
module Main where  
main = putStrLn "hello world"  
EOF


ghc \
-Wunused-packages \
-package-env test-package-env \
Main.hs \                      
-main-is Main.main

Expected behavior

GHC fails with:

Loaded package environment from test-package-env
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking Main ...

<no location info>: warning: [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - containers-0.6.2.1

Actual behavior

GHC fails with:

Loaded package environment from test-package-env
Loaded package environment from test-package-env
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking Main ...

<no location info>: warning: [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - containers-0.6.2.1
      - containers-0.6.2.1

Environment

Optional:

  • Operating System:

  • System Architecture:

Linux nixos 4.19.94 #1 (closed)-NixOS SMP Thu Jan 9 09:19:10 UTC 2020 x86_64 GNU/Linux

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