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

Đang mở
#6,661 23 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
haskell
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện stack --resolver lts-22.43 build aeson trên thiết lập Fedora và GHC 9.6.6 được báo cáo, sau đó kiểm tra toàn bộ đầu ra --verbose và các mục --dependency cho attoparsec và attoparsec-internal. So sánh các mã định danh gói do ghc-pkg báo cáo với các mã được truyền cho GHC; được xem là hoàn tất khi quá trình build thành công mà không cần workaround os-string, hoặc đã xác nhận rằng vấn đề phụ thuộc vào hành vi bên ngoài của GHC.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)

Ngôn ngữ chính
Haskell
Star
4.1k
Fork
857
Merge trung bình
17 giờ 32 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của commercialhaskell/stack

Tất cả issue của commercialhaskell/stack

Issue tương tự

Thêm issue về Haskell

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.