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

Closed
metaleap opened this issue Feb 11, 2017 · 5 comments
Closed
Milestone

Comments

@metaleap
Copy link

@metaleap metaleap commented Feb 11, 2017

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? 😁

@borsboom
Copy link
Contributor

@borsboom borsboom commented Feb 12, 2017

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

@bucklereed
Copy link

@bucklereed bucklereed commented Aug 27, 2017

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

@heroin-moose
Copy link

@heroin-moose heroin-moose commented May 24, 2018

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

@heroin-moose
Copy link

@heroin-moose 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?

@snoyberg
Copy link
Contributor

@snoyberg snoyberg commented Apr 1, 2019

Should be fixed by #4679

@snoyberg snoyberg closed this in 2dc354f Apr 1, 2019
snoyberg added a commit that referenced this issue Apr 1, 2019
Warnings are dumped with color output (fixes #2997)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants