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

Closed
lehins opened this issue Jul 11, 2019 · 5 comments
Closed

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

lehins opened this issue Jul 11, 2019 · 5 comments

Comments

@lehins
Copy link
Contributor

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

Expected

Expect no errors printed

Actual

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-0.3.7.0: unregistering (local file changes: CHANGELOG.md README.md Setup.hs massiv.cabal src/Data/Massiv/Array.hs src/Data/Massiv/Array/Delay...)
2019-07-11 17:52:07.723028: [info] massiv-io-0.1.6.0: unregistering (Dependency being unregistered: massiv-0.3.7.0)
2019-07-11 17:52:07.723120: [info] massiv-test-0.1.0.0: unregistering (Dependency being unregistered: massiv-0.3.7.0)
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-0.3.7.0-Em3Z5elE9gaISHQi5Gn3qj --ipid massiv-io-0.1.6.0-JI6YVjp19K41FAFCsDpyVv --ipid massiv-test-0.1.0.0-9LMGSPcOy5P7L3uEBidOhk
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-0.3.7.0-Em3Z5elE9gaISHQi5Gn3qj --ipid massiv-io-0.1.6.0-JI6YVjp19K41FAFCsDpyVv --ipid massiv-test-0.1.0.0-9LMGSPcOy5P7L3uEBidOhk
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-0.3.7.0-Em3Z5elE9gaISHQi5Gn3qj --ipid massiv-io-0.1.6.0-JI6YVjp19K41FAFCsDpyVv --ipid massiv-test-0.1.0.0-9LMGSPcOy5P7L3uEBidOhk
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-1.24.2.0/setup -hidir /home/lehins/github/massiv/massiv/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup -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-1.24.2.0 -package-id=base-4.9.1.0 -package-id=cabal-doctest-1.0.6-LPsGv2430NTDB6ctAyfZdR -optP-include -optP/home/lehins/github/massiv/massiv/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup_macros.h /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-1.24.2.0/setup/setup -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
@qrilka
Copy link
Contributor

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-0.1.0.0-JLomPUCFfUV1sbEfkbbjfq --ipid ghc-pkg-unregister-b-0.1.0.0-3ex7dk8I7SvEM4TTGHXXnj

Will check in GHC itself about proper versions.

@lehins
Copy link
Contributor Author

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-0.1.0.0-JLomPUCFfUV1sbEfkbbjfq ghc-pkg-unregister-b-0.1.0.0-3ex7dk8I7SvEM4TTGHXXnj

@qrilka
Copy link
Contributor

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 - https://gitlab.haskell.org/ghc/ghc/issues/16324

@dbaynard
Copy link
Contributor

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

@mpilgrem
Copy link
Member

mpilgrem commented Apr 1, 2024

I am going to close this issue given the passage of time, the fact that Stack no longer supports GHC < 8.4, and because #6222 address bulk ghc-pkg unregister.

@mpilgrem mpilgrem closed this as completed Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants