commercialhaskell / commercialhaskell/stack

Crash with `GHCRTS=--io-manager=native` (version: git HEAD)

Open
#5,851 9 comments 0 reactions 0 assignees View on GitHub
component: pantry component: Windows resolution: upstream issue type: bug
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

**Note:** the latest version (2.7.5) of stack on Windows was compiled using GHC 8.10.4, which did not have the new native WinIO manager. This error is produced with manually compiled stack, using the source from this GitHub repo, at commit 13ba67aee29189338b9e6c07cfaeb58fd12ff2d9 (yesterday). I followed the procedure in [the GitHub CI file](https://github.com/commercialhaskell/stack/blob/master/.github/workflows/integration-tests.yml) to compile the executable, namely a `release.hs check` followed by `release.hs build`.

### General summary/comments (optional)

### Steps to reproduce

1. Install above-mentioned manually compiled stack.
2. `cd` into any stack project.
3. Set environment variable `GHCRTS=--io-manager=native`.
4. Run command `stack build`.
5. stack reports the following error:
```
Encountered error while migrating Pantry database:
\\.\NUL: hDuplicateTo: illegal operation (handles are incompatible)
Please report this on https://github.com/commercialhaskell/stack/issues
As a workaround you may delete Pantry database in C:\sr\pantry\pantry.sqlite3 triggering its recreation.
```
where `C:\sr` is my `STACK_ROOT`.
6. Remove `$STACK_ROOT/pantry/pantry.sqlite3` as instructed, and rerun `stack build`.
7. Same error reported.

**Note:** No error if we unset the `GHCRTS` environment variable.

### Expected

No error.

### Actual

Error reported, and the build process did not start.

If you suspect that a Stack command misbehaved, please include the output of
that command in `--verbose` mode:

~~~text
Version manual-build, Git revision 13ba67aee29189338b9e6c07cfaeb58fd12ff2d9 RELEASE-CANDIDATE x86_64 hpack-0.35.0
2022-09-04 13:53:02.806765: [debug] Checking for project config at: path\to\stack.yaml
2022-09-04 13:53:02.806765: [debug] Loading project config file stack.yaml
2022-09-04 13:53:02.806765: [error] Encountered error while migrating Pantry database:
\\.\NUL: hDuplicateTo: illegal operation (handles are incompatible)
Please report this on https://github.com/commercialhaskell/stack/issues
As a workaround you may delete Pantry database in C:\sr\pantry\pantry.sqlite3 triggering its recreation.
~~~

### Stack version

As explained above, a manual build. Work tree unchanged (therefore using almost the same environment as CI builds).

~~~text
stack --version
Version manual-build, Git revision 13ba67aee29189338b9e6c07cfaeb58fd12ff2d9 RELEASE-CANDIDATE x86_64 hpack-0.35.0
~~~

### Method of installation

Other: manual build as explained above. I can provide the executable if needed.

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.