Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contrary to docs, not seeing warnings that were logged in multi-pkg project #2997

metaleap opened this issue Feb 11, 2017 · 5 comments


Copy link

The docs state:

By default, when building multiple target packages, the output from these will end up in a log file instead of on the console unless it contains errors or warnings

Not the case at my end with 1.3.2 (latest I reckon, Win64 build), so I'd have to dump-logs to see those warnings.. errors do get properly emitted as described above however. Did GHC's output format for warnings change in 8.0.2 or something? 😁

Copy link

Also possible the different line endings on Windows are interfering with warning detection.

Copy link

I'm also seeing this (or, rather, not seeing them) on Linux with GHC 8.2.1.

Copy link

I can confirm that on GHC 8.2.x it shows me warnings only with

dump-logs: all

but in fact it should work out of the box because the defaults is

dump-logs: warning

Copy link

heroin-moose commented May 24, 2018

It seems like the problem is the colored output. GHC 8.0 does not use any ANSI escapes, but GHC 8.2 does.

For example:

$ cat test.hs
main = putStrLn "Test"
$ ghc-8.0.2 -Wall test.hs 2>&1 | tee output
$ cat -v output
[1 of 1] Compiling Main             ( test.hs, test.o )

test.hs:1:1: warning: [-Wmissing-signatures]
    Top-level binding with no type signature: main :: IO ()
Linking test ...
$ ghc-8.2.2 -Wall -fdiagnostics-color=always  test.hs > output 2>&1 
$ cat -v output
[1 of 1] Compiling Main             ( test.hs, test.o )

^[[;1mtest.hs:1:1: ^[[;1m^[[35mwarning:^[[0m^[[0m^[[;1m [^[[;1m^[[35m-Wmissing-signatures^[[0m^[[0m^[[;1m]^[[0m^[[0m^[[;1m
    Top-level binding with no type signature: main :: IO ()^[[0m^[[0m
^[[;1m^[[34m  |^[[0m^[[0m
^[[;1m^[[34m1 |^[[0m^[[0m ^[[;1m^[[35mmain^[[0m^[[0m = putStrLn "Test"
^[[;1m^[[34m  |^[[0m^[[0m^[[;1m^[[35m ^^^^^[[0m^[[0m
^[[0m^[[0m^[[0mLinking test ...

The flag -fdiagnostics-color=always is passed by stack to GHC if GHC version is > 8.2.1 (see shouldForceColorFlag).

And this change confuses this function:

    isWarning :: Text -> Bool
    isWarning t = ": Warning:" `T.isSuffixOf` t -- prior to GHC 8
               || ": warning:" `T.isInfixOf` t -- GHC 8 is slightly different

The easiest fix is to get rid of the ": " prefix (replace ": warning-word:" with "warning-word:"). Or just sanitize the string with another filter to remove escapes.

Any thoughts?

Copy link

snoyberg commented Apr 1, 2019

Should be fixed by #4679

snoyberg added a commit that referenced this issue Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

6 participants