commercialhaskell / commercialhaskell/stack

Setting a flag on the command-line resets other flag defaults overridden in `stack.yaml`

Open
#4,960 0 comments 0 reactions 0 assignees View on GitHub
component: build further investigation required
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments (optional)

### Steps to reproduce

This can be reproduced when by building Stack itself:

```
stack build stack --verbose --flag stack:integration-tests
```

### Expected

Stack should be configured with the `integration-tests` flag **true** (as specified on the command-line), and the `hide-dependency-versions` and `supported-build` also **true** (since those are set to **true** in `stack.yaml`, although they are **false** by default in `package.yaml`).

The flags passed in the `configure` step _should_ be:
```
-fhide-dependency-versions -fintegration-tests -fsupported-build
```

### Actual

Stack is built with `integration-tests` flag **true** (as expected), but the `hide-dependency-versions` and `supported-build` are changed to **false**.

The flags passed in the `configure` step are:
```
-f-hide-dependency-versions -fintegration-tests -f-supported-build
```

### Notes

If we build Stack _without_ `--flag stack:integration-tests`, the `hide-dependency-versions` and `supported-build` flags keep their expected **true** values. The flags pass in the `configure` step are, as expected:
```
-fhide-dependency-versions -f-integration-tests -fsupported-build
```

stack-1.9.3 has the expected behaviour, so this appears to be a regression in stack 2.x. stack-1.9.3 passes the expected flags in the `configure` step:
```
-fhide-dependency-versions -fintegration-tests -fsupported-build
```

### Stack version

```
$ stack --version
Version 2.1.1, Git revision f612ea85316bbc327a64e4ad8d9f0b150dc12d4b (7648 commits) x86_64 hpack-0.31.2
```

* Also observed in stack-2.1.3.
* **Not** observed in stack-1.9.3

### Method of installation

* Official binary, downloaded from stackage.org or fpcomplete's package repository

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.