Skip to content

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

@lehins

Description

@lehins

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions