Skip to content

stack run doesn't pick first executable #5232

@mnn

Description

@mnn

Steps to reproduce

  1. Have two executables in package.yaml
  2. stack run
  3. See it running a second one instead of a first one as docs suggest:

    Build and run an executable. Defaults to the first available executable if none is provided as the first argument.

Configuration file: https://gitlab.com/monnef/gododoc/-/blob/0304ed3fb3b29b9271b36ba3a7aa8b8ac4326b4f/package.yaml#L53

Expected

gododoc-dev (first executable) is started.

Actual

gododoc (second executable) is started instead.

$ stack run --verbose
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2
2020-03-22 09:15:17.482158: [debug] Checking for project config at: /mnt/dev/haskell/gododoc/stack.yaml
2020-03-22 09:15:17.482377: [debug] Loading project config file stack.yaml
2020-03-22 09:15:17.486761: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-03-21 08:15:17.486725496 UTC]
2020-03-22 09:15:17.487173: [debug] Using package location completions from a lock file
2020-03-22 09:15:17.607009: [debug] Running hpack on /mnt/dev/haskell/gododoc/package.yaml
2020-03-22 09:15:17.610012: [warn] /mnt/dev/haskell/gododoc/package.yaml: Ignoring unrecognized field $.gitlab
2020-03-22 09:15:17.610047: [debug] hpack output unchanged in /mnt/dev/haskell/gododoc/gododoc.cabal
2020-03-22 09:15:17.611504: [debug] Asking for a supported GHC version
2020-03-22 09:15:17.611691: [debug] Installed tools:
 - ghc-tinfo6-8.6.4
 - ghc-tinfo6-8.6.5
 - ghc-tinfo6-8.4.3
 - ghc-tinfo6-8.0.2
2020-03-22 09:15:17.611792: [debug] Run process: /sbin/ldconfig -p
2020-03-22 09:15:17.613829: [debug] Process finished in 2ms: /sbin/ldconfig -p
2020-03-22 09:15:17.614848: [debug] Found shared library libtinfo.so.5 in /usr/lib/
2020-03-22 09:15:17.614913: [debug] Found shared library libtinfo.so.6 in /usr/lib/
2020-03-22 09:15:17.614944: [debug] Found shared library libncursesw.so.6 in 'ldconfig -p' output
2020-03-22 09:15:17.614981: [debug] Found shared library libgmp.so.10 in 'ldconfig -p' output
2020-03-22 09:15:17.615040: [debug] Did not find shared library libgmp.so.3
2020-03-22 09:15:17.615054: [debug] Potential GHC builds: tinfo6, standard, ncurses6
2020-03-22 09:15:17.615074: [debug] Found already installed GHC builds: tinfo6
2020-03-22 09:15:17.615166: [debug] SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_path","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","global_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "/home/xxx/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/bin/ghc-8.6.5"]
2020-03-22 09:15:17.652290: [debug] Loaded compiler information from cache
2020-03-22 09:15:17.652366: [debug] Asking for a supported GHC version
2020-03-22 09:15:17.652560: [debug] Resolving package entries
2020-03-22 09:15:17.652593: [debug] Parsing the targets
2020-03-22 09:15:17.656718: [debug] Checking flags
2020-03-22 09:15:17.656980: [debug] SourceMap constructed
2020-03-22 09:15:17.660229: [debug] Starting to execute command inside EnvConfig
2020-03-22 09:15:17.661810: [debug] Parsing the targets
2020-03-22 09:15:17.662028: [debug] Checking flags
2020-03-22 09:15:17.662053: [debug] SourceMap constructed
2020-03-22 09:15:17.663553: [debug] Finding out which packages are already installed
2020-03-22 09:15:17.663628: [debug] Run process: /home/xxx/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2020-03-22 09:15:17.725457: [debug] Process finished in 62ms: /home/xxx/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2020-03-22 09:15:17.728554: [debug] Ignoring package Cabal due to wanting version 2.4.1.0 instead of 2.4.0.1
2020-03-22 09:15:17.728686: [debug] Ignoring package haskeline due to wanting version 0.7.5.0 instead of 0.7.4.3
2020-03-22 09:15:17.730134: [debug] Ignoring package parsec due to wanting version 3.1.14.0 instead of 3.1.13.0
2020-03-22 09:15:17.730280: [debug] Run process: /home/xxx/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/xxx/.stack/snapshots/x86_64-linux-tinfo6/7b7e3636fdf5e8c66bdb6ab9b948a6f908d7c8eb01f27db52350d204bb4c9789/8.6.5/pkgdb dump --expand-pkgroot
2020-03-22 09:15:17.799763: [debug] Process finished in 69ms: /home/xxx/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/xxx/.stack/snapshots/x86_64-linux-tinfo6/7b7e3636fdf5e8c66bdb6ab9b948a6f908d7c8eb01f27db52350d204bb4c9789/8.6.5/pkgdb dump --expand-pkgroot
2020-03-22 09:15:17.806830: [debug] Run process: /home/xxx/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /mnt/dev/haskell/gododoc/.stack-work/install/x86_64-linux-tinfo6/7b7e3636fdf5e8c66bdb6ab9b948a6f908d7c8eb01f27db52350d204bb4c9789/8.6.5/pkgdb dump --expand-pkgroot
2020-03-22 09:15:17.855187: [debug] Process finished in 48ms: /home/xxx/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /mnt/dev/haskell/gododoc/.stack-work/install/x86_64-linux-tinfo6/7b7e3636fdf5e8c66bdb6ab9b948a6f908d7c8eb01f27db52350d204bb4c9789/8.6.5/pkgdb dump --expand-pkgroot
2020-03-22 09:15:17.855900: [debug] Constructing the build plan
2020-03-22 09:15:17.859273: [debug] SELECT "id","directory","type","pkg_src","active","path_env_var","haddock" FROM "config_cache" WHERE "directory"=? AND "type"=?; [PersistText "/mnt/dev/haskell/gododoc/.stack-work/install/x86_64-linux-tinfo6/7b7e3636fdf5e8c66bdb6ab9b948a6f908d7c8eb01f27db52350d204bb4c9789/8.6.5/",PersistText "lib:gododoc-0.1.0.0-1wgGcf0u5OtIWDfS9YpRTr"]
2020-03-22 09:15:17.859655: [debug] SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 2]
2020-03-22 09:15:17.859855: [debug] SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_no_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 2]
2020-03-22 09:15:17.860119: [debug] SELECT "id", "config_cache_id", "ghc_pkg_id" FROM "config_cache_dep" WHERE ("config_cache_id"=?); [PersistInt64 2]
2020-03-22 09:15:17.860594: [debug] SELECT "id", "config_cache_id", "component" FROM "config_cache_component" WHERE ("config_cache_id"=?); [PersistInt64 2]
2020-03-22 09:15:17.861190: [debug] Start: getPackageFiles /mnt/dev/haskell/gododoc/gododoc.cabal
2020-03-22 09:15:17.872102: [debug] Finished in 11ms: getPackageFiles /mnt/dev/haskell/gododoc/gododoc.cabal
2020-03-22 09:15:17.874077: [debug] Checking if we are going to build multiple executables with the same name
2020-03-22 09:15:17.874141: [debug] Executing the build plan
2020-03-22 09:15:17.874786: [debug] Run process: /mnt/dev/haskell/gododoc/.stack-work/install/x86_64-linux-tinfo6/7b7e3636fdf5e8c66bdb6ab9b948a6f908d7c8eb01f27db52350d204bb4c9789/8.6.5/bin/gododoc

Interestingly stack run gododoc-dev runs the correct executable, so the configuration should be ok.

Stack version

$ stack --version
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2

Method of installation

Official binary, downloaded from haskellstack.org

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