Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,866
    • Issues 4,866
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 458
    • Merge requests 458
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #21307
Closed
Open
Created Mar 28, 2022 by Javier Neira @jneira

ghc reports package-id in unused imports warning instead the package name+version+id

Summary

From https://github.com/haskell/cabal/issues/7209#issuecomment-1080118466 ghc reports bad package name in unused imports warning when the package-id name segment does not match the package name

Steps to reproduce

  • cabal build -v3 a project with any dependency containing vowels and ghc-options: -Wunused-packages -Werror=unused-packages
  • check the ghc call made by cabal pass the package id removing vowels from the package name
    • for the ieee package it would be like -package-id -0.7-c9bfa6bf
  • check the v2 store package db has the complete package name for such package id:
# ghc-pkg --package-db ~/.cabal/store/ghc-9.2.2/package.db describe ieee | head -n 5
name:                 ieee
version:              0.7
visibility:           public
id:                   -0.7-c9bfa6bf
key:                  -0.7-c9bfa6bf
  • and check the unused package warning uses the package-id instead the full package name plus version:
<no location info>: warning: [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - -0.7-c9bfa6bf
  • the behaviour is not reproduced in windows, where package names are also shortened by cabal in the package id, see https://github.com/haskell/cabal/issues/7209#issuecomment-1080327599
  • from the ghc call made by cabal we derive the bug is in the ghc side

Expected behavior

  • the error message should use the full package name + package version from package-db
<no location info>: warning: [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - ieee-0.7

Environment

  • GHC version used: 8.10.7, 9.2.2

Optional:

  • Operating System: macos
  • System Architecture: anyñ
Edited Mar 28, 2022 by Javier Neira
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking