commercialhaskell / commercialhaskell/stack

nonportable-include-path warning on case-insensitive systems

Open
#3,918 14 comments 7 reactions 0 assignees View on GitHub
component: build component: macOS component: Windows help wanted type: bug
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments

The common case of using the same name for the executable (e.g. `interplay`) and the top-level module of the corresponding library (e.g. `Interplay.Types`) leads to a spurious warning being displayed while building using `stack` on a case-insensitive filesystem:

warning: non-portable path to file '".stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Interplay/autogen/cabal_macros.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include ".stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/interplay/autogen/cabal_macros.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
".stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Interplay/autogen/cabal_macros.h"
1 warning generated.

It looks like stack tries to create both a folder named `interplay` and one named `Interplay`, but the OS considers them the same. As a result, the files generated for the module and for the executable end up in the same folder. Luckily, the files have different names so this doesn't cause any problems, except for the fact that the above warning is generated.

The problem does not occur when building using `cabal`, because it uses a different folder scheme. Similarly, `stack` could change its folder scheme (e.g. put the executable folders and the module folders in two different sub-folders) in order to avoid the warning.

### Steps to reproduce

For your convenience, I have created a [minimal project](https://github.com/gelisam/stack-bug/tree/nonportable-include-path) which demonstrates the problem. The important parts are the fact that the `package.yaml` specifies an executable named `interplay`:

name: interplay
dependencies:
- base

library:
source-dirs: src

executables:
interplay:
main: Main.hs
source-dirs: app

and the fact that the project contains a file `src/Interplay/Types.hs`, that is, there is a top-level module named `Interplay`.

Simply run `stack build` on a case-insensitive system and you will see the warning. I have tried it on macOS, and I suspect that the problem will also occur on Windows but not on Linux.

### Expected

The project builds with no warning.

### Actual

The projects builds successfully, but displays the above warning. [Here](https://gist.github.com/gelisam/7a8c31cf42aa9acae97f2734fb6e7298) is the full output of `stack build --verbose`, after a `stack clean --full`.

### Stack version

I tried with both stack-1.6.5 and stack-HEAD.

```
$ stack --version
Version 1.6.5, Git revision 24ab0d6ff07f28276e082c3ce74dfdeb1a2ca9e9 (5514 commits) x86_64 hpack-0.20.0
```

### Method of installation

* Other: `stack upgrade --git` for stack-HEAD and then `stack upgrade --force-download` for stack-1.6.5

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.