GHC's `-package <pkg>` can expose installed package not listed by `ghc-pkg list <pkg>`

未关闭
#6,661 23 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
冷清
技术栈
haskell

调研方向

首先在报告的 Fedora 和 GHC 9.6.6 环境中复现 stack --resolver lts-22.43 build aeson,然后检查完整的 --verbose 输出以及 attoparsec 和 attoparsec-internal 的 --dependency 条目。将 ghc-pkg 报告的包标识符与传递给 GHC 的标识符进行比较;当无需使用 os-string workaround 即可成功构建,或确认该问题取决于 GHC 的外部行为时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

resolution: upstream issue type: bug

EDIT (by @mpilgrem): The anomaly described below is likely due to the bug (from Stack's perspective) in GHC versions described at:

In short:

  • if an installed package has a name that is in the format that Cabal (the library) uses to 'mung' sub-libraries, some versions of GHC treat that name as if it were the name of the Cabal package for the purpose's of GHC's -package option; and
  • as a consequence, GHC's -package <pkg> option can, in practice, cause an installed package to be exposed that is not one listed by ghc-pkg list <pkg>.

Stack, on the other hand, relies on an installed package having a unique name specified by its name field and that GHC's -package <pkg> option will expose only a installed package listed by ghc-pkg list <pkg>.


So far noone else has seen this: so likely it is an anomaly only in my system.

General summary/comments

After updating my projects to latest lts-22 (lts >= 22.42), builds using attoparsec started to fail for me.

Steps to reproduce

(Not reproducible so far except on my laptop)

stack --resolver lts-22.43 build aeson

Expected

To build normally.

Actual

EDIT (by @mpilgrem): Some output has been reformatted for clarity

$ stack --resolver lts-22.43 build aeson
:
aeson                        > configure
aeson                        > Configuring aeson-2.1.2.1...
aeson                        > Error: Cabal-simple_LRiJ_wrZ_3.10.3.0_ghc-9.6.6: Encountered missing or
aeson                        > private dependencies:
aeson                        > attoparsec ==0.14.4
aeson                        > 
Completed 13 action(s).

Error: [S-7282]
       Stack failed to execute the build plan.
       
       While executing the build plan, Stack encountered the error:
       
       [S-7011]
       While building package aeson-2.1.2.1 (scroll up to its section to see the error) using:
       /var/home/petersen/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_LRiJ_wrZ_3.10.3.0_ghc-9.6.6 
--verbose=1 
--builddir=.stack-work/dist/x86_64-linux-tinfo6/ghc-9.6.6 
configure 
--with-ghc=/var/home/petersen/.stack/programs/x86_64-linux/ghc-tinfo6-9.6.6/bin/ghc 
--with-ghc-pkg=/usr/bin/ghc-pkg-9.6.6 
--user 
--package-db=clear 
--package-db=global 
--package-db=/var/home/petersen/.stack/snapshots/x86_64-linux-tinfo6/18cf10429d6b1427d08f2a7a920a4c784cc1f0eaa6921458e36e04319528d1da/9.6.6/pkgdb 
--libdir=/var/home/petersen/.stack/snapshots/x86_64-linux-tinfo6/18cf10429d6b1427d08f2a7a920a4c784cc1f0eaa6921458e36e04319528d1da/9.6.6/lib 
--bindir=/var/home/petersen/.stack/snapshots/x86_64-linux-tinfo6/18cf10429d6b1427d08f2a7a920a4c784cc1f0eaa6921458e36e04319528d1da/9.6.6/bin 
--datadir=/var/home/petersen/.stack/snapshots/x86_64-linux-tinfo6/18cf10429d6b1427d08f2a7a920a4c784cc1f0eaa6921458e36e04319528d1da/9.6.6/share 
--libexecdir=/var/home/petersen/.stack/snapshots/x86_64-linux-tinfo6/18cf10429d6b1427d08f2a7a920a4c784cc1f0eaa6921458e36e04319528d1da/9.6.6/libexec 
--sysconfdir=/var/home/petersen/.stack/snapshots/x86_64-linux-tinfo6/18cf10429d6b1427d08f2a7a920a4c784cc1f0eaa6921458e36e04319528d1da/9.6.6/etc 
--docdir=/var/home/petersen/.stack/snapshots/x86_64-linux-tinfo6/18cf10429d6b1427d08f2a7a920a4c784cc1f0eaa6921458e36e04319528d1da/9.6.6/doc/aeson-2.1.2.1 
--htmldir=/var/home/petersen/.stack/snapshots/x86_64-linux-tinfo6/18cf10429d6b1427d08f2a7a920a4c784cc1f0eaa6921458e36e04319528d1da/9.6.6/doc/aeson-2.1.2.1 
--haddockdir=/var/home/petersen/.stack/snapshots/x86_64-linux-tinfo6/18cf10429d6b1427d08f2a7a920a4c784cc1f0eaa6921458e36e04319528d1da/9.6.6/doc/aeson-2.1.2.1 
--dependency=OneTuple=OneTuple-0.4.2-7od06fXUUXRBNk1V3VY0g5 
--dependency=QuickCheck=QuickCheck-2.14.3-E9VttT8lnId93rGQPNsiU9 
--dependency=attoparsec=attoparsec-0.14.4-GAKm7J8Gleq2k06HFjeIeY-attoparsec-internal 
--dependency=base=base-4.18.2.1 
--dependency=base-compat-batteries=base-compat-batteries-0.13.1-5fbdeENWe9mF7TcjAFq4dk 
--dependency=bytestring=bytestring-0.11.5.3 
--dependency=containers=containers-0.6.7 
--dependency=data-fix=data-fix-0.3.4-2n4PElhIt1Q7w0n82lPfpl 
--dependency=deepseq=deepseq-1.4.8.1 
--dependency=dlist=dlist-1.0-7vDlnn0Hdvg35SyXLwMaWr 
--dependency=exceptions=exceptions-0.10.7 
--dependency=generically=generically-0.1.1-I9byc5Nil798plofO827gA 
--dependency=ghc-prim=ghc-prim-0.10.0 
--dependency=hashable=hashable-1.4.4.0-GGHvrv8RGdcAwi4fOW9L5d 
--dependency=indexed-traversable=indexed-traversable-0.1.4-8j5HZpShpE5BqFup9Ojenr 
--dependency=primitive=primitive-0.8.0.0-G7z1XrhwN0bFkYsIqIr1QU 
--dependency=scientific=scientific-0.3.7.0-BAvZdJlkHDUEf0LOVEPz37 
--dependency=semialign=semialign-1.3.1-7lhN9UdvYxAGbqZZCyRcNC 
--dependency=strict=strict-0.5-GMywuJToqFcduYfo019sj 
--dependency=tagged=tagged-0.8.8-Kzng2lnKElzJiyKd9g735c 
--dependency=template-haskell=template-haskell-2.20.0.0 
--dependency=text=text-2.0.2 
--dependency=text-short=text-short-0.1.6-2ZxoUm7jRrSBd8GMEi1Fas 
--dependency=th-abstraction=th-abstraction-0.5.0.0-HAFjiAO2nGN58SdxVZCnLH 
--dependency=these=these-1.2.1-KST5KzzcktxI0GEHGKxqQO 
--dependency=time=time-1.12.2 
--dependency=time-compat=time-compat-1.9.6.1-DIvC8GbQSzcCziVynZc4vt 
--dependency=unordered-containers=unordered-containers-0.2.20-5m928IsagguARIfUwwmGLp 
--dependency=uuid-types=uuid-types-1.0.5.1-3QSWhjKdWiE4JA9TKvvlMc 
--dependency=vector=vector-0.13.1.0-Jdel1KiNlSEIXGg2MpN3IL 
--dependency=witherable=witherable-0.4.2-D4tJt8ldIw17tHtCEGjK6w 
--dependency=attoparsec:attoparsec-internal=attoparsec-0.14.4-GAKm7J8Gleq2k06HFjeIeY-attoparsec-internal 
-f-cffi 
-fordered-keymap 
--exact-configuration 
--ghc-option=-fhide-source-paths
       Process exited with code: ExitFailure 1

See https://gist.github.com/juhp/8cf70c3e00509347ff5e5f4bbfad74c5 for the full --verbose output

Highlighting a few points:

  • - attoparsec-0.14.4 appears twice (probably once for attoparsec and once for attoparsec-internal?)
  • for attoparsec there is only --dependency=attoparsec=attoparsec-0.14.4-GAKm7J8Gleq2k06HFjeIeY-attoparsec-internal (attoparsec:attoparsec-internal gets mapped to the same pkgid)
Stack version

2.15.7 and 3.1.1

Method of installation

Fedora Linux and local build

Platform

Fedora Linux

Misc

I am using a workaround: adding os-string-2.0.6 to my project stack.yaml files (the version of os-string in lts < 22.42)

主要语言
Haskell
星标
4.1k
派生
857
平均合并
17 小时 32 分钟
30 天内合并 PR
5

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

commercialhaskell/stack 的其他 Issue

查看 commercialhaskell/stack 的全部 Issue

相似的 Issue

更多 Haskell Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。