Skip to content

ghcup install sets default to installed version even without --set on command line #1281

@0cjs

Description

@0cjs

When I install a program without using the --set option, GHCup still sets the default to that program, overriding any previous setting.

$ ghcup --version
The GHCup Haskell installer, version 0.1.50.2
c$ ll .ghcup/bin/
total 119M
-rwxr-x--- 1 cjs cjs 30M Jul  9 05:16 ghcup
lrwxrwxrwx 1 cjs cjs  11 Jul  9 05:16 stack -> stack-3.7.1
-rwxr-xr-x 1 cjs cjs 90M Jul  9 05:16 stack-3.7.1
c$ ghcup install cabal latest
...
[ Info  ] Installing cabal
[ Info  ] Cabal installation successful
c$ ll .ghcup/bin/
total 156M
lrwxrwxrwx 1 cjs cjs  14 Jul  9 05:18 cabal -> cabal-3.14.2.0
-rwxr-xr-x 1 cjs cjs 38M Jul  9 05:18 cabal-3.14.2.0
-rwxr-x--- 1 cjs cjs 30M Jul  9 05:16 ghcup
lrwxrwxrwx 1 cjs cjs  11 Jul  9 05:16 stack -> stack-3.7.1
-rwxr-xr-x 1 cjs cjs 90M Jul  9 05:16 stack-3.7.1
c$ ghcup install cabal recommended
...
[ Info  ] Installing cabal
[ Info  ] Cabal installation successful
c$ ll .ghcup/bin/
total 192M
lrwxrwxrwx 1 cjs cjs  14 Jul  9 05:18 cabal -> cabal-3.12.1.0
-rwxr-xr-x 1 cjs cjs 36M Jul  9 05:18 cabal-3.12.1.0
-rwxr-xr-x 1 cjs cjs 38M Jul  9 05:18 cabal-3.14.2.0
-rwxr-x--- 1 cjs cjs 30M Jul  9 05:16 ghcup
lrwxrwxrwx 1 cjs cjs  11 Jul  9 05:16 stack -> stack-3.7.1
-rwxr-xr-x 1 cjs cjs 90M Jul  9 05:16 stack-3.7.1

I've tested this with install stack as well, and gotten the same result.

This is rather dangerous, because I not only may find the version I happened to be using for a build quietly changing, but it could even change the version being used in the middle of a build running in another window.

I don't think it's relevant, but I have nothing related to "install" or "set" in my GHCup configuration file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions