Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batch unregistering with ghc-pkg-8.0.2 "syntax error" #4951

lehins opened this issue Jul 11, 2019 · 4 comments

batch unregistering with ghc-pkg-8.0.2 "syntax error" #4951

lehins opened this issue Jul 11, 2019 · 4 comments


Copy link

@lehins lehins commented Jul 11, 2019

Please follow the steps below for reporting a bug:

Make sure that you are using the latest release (currently stack-2.1.1).
See the upgrade instructions to upgrade.

Please use the following schema for your bug report:

General summary/comments (optional)

From a few things I've tried with ghc-pkg and running --help it has --ipid, which is a flag and does not accept any arguments while here it is supplied many times:

(\gid -> ["--ipid", ghcPkgIdString gid]))

Also it says in the comment that ghc 8.0.1 supports batch unregistering, which might not be correct (at least with ghc-8.0.2), see the error message below in the ticket. I've tried running ghc-pkg-8.2.2 unregister --ipid with more than one package id and that did not produce any errors, so I suspect the statement in the above mentioned comment might not be correct.

Steps to reproduce

We need to force stack to unregister more than one package.
For example:

  1. Compile a project that has at least 3 packages in packages with resolver lts-9.21
  2. Run command stack build.
  3. Remove at least 2 packages from packages: in stack.yaml
  4. Run command stack clean.
  5. Run command stack build.

stack continues building but produces an error message from ghc-pkg


Expect no errors printed


What actually happened.

$ stack build --verbose
2019-07-11 17:52:07.722137: [debug] Checking if we are going to build multiple executables with the same name
2019-07-11 17:52:07.722251: [debug] Executing the build plan
2019-07-11 17:52:07.722974: [info] massiv- unregistering (local file changes: Setup.hs massiv.cabal src/Data/Massiv/Array.hs src/Data/Massiv/Array/Delay...)
2019-07-11 17:52:07.723028: [info] massiv-io- unregistering (Dependency being unregistered: massiv-
2019-07-11 17:52:07.723120: [info] massiv-test- unregistering (Dependency being unregistered: massiv-
2019-07-11 17:52:07.723240: [debug] Run process: /home/lehins/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg-8.0.2 --no-user-package-db --package-db=/home/lehins/github/massiv/.stack-work/install/x86_64-linux/a5b995054887d0d7cc353d824a5b990dbab3c2470ef25c1ba1c7512c8d7f27b3/8.0.2/pkgdb/ unregister --user --force --ipid massiv- --ipid massiv-io- --ipid massiv-test-
2019-07-11 17:52:07.738327: [debug] Run process: /home/lehins/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg-8.0.2 --no-user-package-db --package-db=/home/lehins/github/massiv/.stack-work/install/x86_64-linux/a5b995054887d0d7cc353d824a5b990dbab3c2470ef25c1ba1c7512c8d7f27b3/8.0.2/pkgdb/ unregister --user --force --ipid massiv- --ipid massiv-io- --ipid massiv-test-
2019-07-11 17:52:07.755689: [warn] Received ExitFailure 1 when running
Raw command: /home/lehins/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg-8.0.2 --no-user-package-db --package-db=/home/lehins/github/massiv/.stack-work/install/x86_64-linux/a5b995054887d0d7cc353d824a5b990dbab3c2470ef25c1ba1c7512c8d7f27b3/8.0.2/pkgdb/ unregister --user --force --ipid massiv- --ipid massiv-io- --ipid massiv-test-
Standard error:

ghc-pkg: command-line syntax error
For usage information see 'ghc-pkg --help'.

2019-07-11 17:52:07.756411: [debug] SELECT "id","directory","type","pkg_src","active","path_env_var","haddock" FROM "config_cache" WHERE "directory"=? AND "type"=?; [PersistText "/home/lehins/github/massiv/massiv/",PersistText "config"]
2019-07-11 17:52:07.756948: [debug] UPDATE "config_cache" SET "active"=? WHERE ("directory"=?) AND ("type"=?); [PersistBool False,PersistText "/home/lehins/github/massiv/massiv/",PersistText "config"]
2019-07-11 17:52:07.757156: [info] massiv> configure (lib)
2019-07-11 17:52:07.757766: [debug] Run process within /home/lehins/github/massiv/massiv/: /home/lehins/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-8.0.2 --make -odir /home/lehins/github/massiv/massiv/.stack-work/dist/x86_64-linux/Cabal- -hidir /home/lehins/github/massiv/massiv/.stack-work/dist/x86_64-linux/Cabal- -i -i. -clear-package-db -global-package-db -package-db=/home/lehins/.stack/snapshots/x86_64-linux/a5b995054887d0d7cc353d824a5b990dbab3c2470ef25c1ba1c7512c8d7f27b3/8.0.2/pkgdb -package-db=/home/lehins/github/massiv/.stack-work/install/x86_64-linux/a5b995054887d0d7cc353d824a5b990dbab3c2470ef25c1ba1c7512c8d7f27b3/8.0.2/pkgdb -hide-all-packages -package-id=Cabal- -package-id=base- -package-id=cabal-doctest-1.0.6-LPsGv2430NTDB6ctAyfZdR -optP-include -optP/home/lehins/github/massiv/massiv/.stack-work/dist/x86_64-linux/Cabal- /home/lehins/github/massiv/massiv/Setup.hs /home/lehins/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /home/lehins/github/massiv/massiv/.stack-work/dist/x86_64-linux/Cabal- -threaded

Stack version

$ stack --version
Version 2.2.0, Git revision c52eddfa89c104f0a44ee8601105a197701925b0 PRE-RELEASE x86_64 hpack-0.31.2

Method of installation

  • stack upgrade
Copy link

@qrilka qrilka commented Jul 11, 2019

@lehins actually you just need to trigger rebuild for at least 2 packages. And it looks like our understanding of supported GHC version wasn't correct - with GHC 8.2.2 I don't get any problems:

2019-07-11 22:20:41.208771: [debug] Process finished in 26ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg-8.2.2 --no-user-package-db --package-db=/home/qrilka/ws/h/stack-tests/ghc-pkg-unregister/.stack-work/install/x86_64-linux-tinfo6/295f08e08c982094581a87637abea955d6cb457a466f8f1f06660da9ce80c583/8.2.2/pkgdb/ unregister --user --force --ipid ghc-pkg-unregister-a- --ipid ghc-pkg-unregister-b-

Will check in GHC itself about proper versions.

Copy link
Contributor Author

@lehins lehins commented Jul 11, 2019

@qrilka Note also that in the above command duplicate --ipid is unnecessary. It will work just fine with one, since it is simply a flag:

/home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg-8.2.2 --no-user-package-db --package-db=/home/qrilka/ws/h/stack-tests/ghc-pkg-unregister/.stack-work/install/x86_64-linux-tinfo6/295f08e08c982094581a87637abea955d6cb457a466f8f1f06660da9ce80c583/8.2.2/pkgdb/ unregister --user --force --ipid ghc-pkg-unregister-a- ghc-pkg-unregister-b-

Copy link

@qrilka qrilka commented Jul 11, 2019

Oh, yes, you're completely right.
And regarding incorrect versions it looks like I was using what @dbaynard said in #2662 (comment) and maybe there was something in GHC trac but in gitlab I don't find anything about it. And the first GHC tag with that thing appears to be ghc-8.2.1-rc1. Will create a PR a bit later. There is another thing though - all this ghc-pkg batching doesn't really improve the situation -

Copy link

@dbaynard dbaynard commented Jul 13, 2019

Yes, it's still in the trac metadata — I may have misinterpreted the field, as much as anything else 🤦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants