[GHC] #14648: ghc-pkg does handle unitids

#14648: ghc-pkg does handle unitids -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.2.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I base the summary and the description on a single observation, see below. Sorry should this turn out to be a deduction too aggressive. == Assumed problem description New-style package-dbs can contain the same (package, version) entry multiple times, as entries are identified using an additional hash. I'll call the full identifier "unitId". The ghc-pkg interface seems to not support specifying full unitIds, i.e. "my-package-0.1.0.0-somehash" seems to be interpreted like "my-package-0.1.0.0-*". This is both a missing functionality and a bug: 1. many operations make sense per-unitId, not just per (package, version) 2. The fact that my-package-0.1.0.0-otherhash is unregistered by "ghc-pkg unregister my-package-0.1.0.0-somehash" is quite surprising. == Observation 1. Take a package-db containing the same (package, version) entry with two different hashes, e.g. - semigroupoids-5.2.1-2f552e489ce3109c2672606e2dc6e33c4f38174da930d5db0bb0dafbb4dccae8 - semigroupoids-5.2.1-e50d44ead36c6b8428c9417007cee15bd9cbe3a2906c19553366d94b15c2471e I suggest making a copy of some existing (cabal store) db. 2. call `ghc-pkg --package-db my-copy unregister semigroupoids-5.2.1-2f552e489ce3109c2672606e2dc6e33c4f38174da930d5db0bb0dafbb4dccae8` 3. test `ghc-pkg --package-db my-copy list semigroupoids-5.2.1` Expected result: `semigroupoids-5.2.1-e50d44ea..` is still registered Observed result: empty list == Impact This blocks the use-case of a garbage-collection for the global new-style package db "store". -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14648 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14648: ghc-pkg does handle unitids -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by alexbiehl): I think you can pass ˋ—unit-Idˋ to Interpret package identifiers as UnitIds (see https://github.com/ghc/ghc/blob/master/utils/ghc- pkg/Main.hs#L204) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14648#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14648: ghc-pkg does handle unitids -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by lspitzner): Oh, indeed. I'll test that. This would eliminate the "missing feature" part but not the "surprising behaviour" part. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14648#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14648: ghc-pkg does handle unitids -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): Yes, the defaulting to pkgname-version is tiresome but it's this way for backwards compatibility (since that is how ghc-pkg worked in the old days); and the surprising behavior stems from another BC thing where version numbers parse with tags and then Cabal ignores the tag, so `semigroupoids-5.2.1-f552e489ce3109c2672606e2dc6e33c4f38174da930d5db0bb0dafbb4dccae8` parses into `semigroupoids-5.2.1` and off we go. If someone updates ghc-pkg not to use Cabal's "tag ignoring" parser and handles the parsing itself, we could make it error when it sees a tag, or better yet automatically interpret it as an IPID. It's more work in the implementation but it would smooth this edge. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14648#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14648: ghc-pkg does handle unitids -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by lspitzner): Can't we just check if `show`/`disp` on the parsed value yields the input string, and print a warning if there is a difference? Is there any risk for false positives (cases where `input /= disp (read input)` for package- version strings without a tag)? Capitalization comes to mind, but i don't think it is a problem here, right? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14648#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14648: ghc-pkg does handle unitids -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): I think that's a legitimate alternative way to achieve the same result. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14648#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC