Stack: Stack produces wrong terminal color codes for file paths

Created on 7 Jul 2018  Â·  6Comments  Â·  Source: commercialhaskell/stack

General summary/comments (optional)

Given that in stack/scr/Stack/PrettyPrint.hs style for the files is

styleFile = bold . white . ondullblack

this should correspond to ANSI code ^[[1m^[[37m^[[40m however stack outputs ^[[1m^[[97m.

See this gist for ANSI codes.

Steps to reproduce

  1. Enable script to see raw output: script debug_stack_output.
  2. Run command stack ghci outside of any project.
  3. Stack outputs a note regarding missing project and some paths in the note may be printed in a color that's invisible (depands on your terminal color scheme).
  4. Type :q into ghci propt.
  5. Type control-d to stop script command.
  6. View debug_stack_output in an editor vim debug_stack_output.
  7. You should see a line
* If you want to start a different project configuration than ^[[1m^[[97m/home/username/.stack/global-project/stack.yaml^[[0;1m^[[0m,
  1. Despite the definition in stack/scr/Stack/PrettyPrint.hs
styleFile = bold . white . ondullblack

Expected

When running stack ghci outside of any project the note should have paths printed in bold white on a black backgroud.

Actual

The paths were printed on bold white on white backgroud.

Relevant Places in stack Source:

display stackYaml
instance Display (Path b File)
styleFile

Stack version

$ stack --version
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2

Method of installation

  • Official binary, downloaded from stackage.org or fpcomplete's package repository
output (UUX) help wanted needs reproduction newcomer friendly bug

All 6 comments

Is this on Windows or any OS?

Happens on Linux, can't test on Windows.

I can't reproduce this (using Version 1.8.0, Git revision 861cf3229235ba22aa98b1fa8958e208a1cd10cf (dirty) (6002 commits) x86_64 hpack-0.28.2). I'm on Windows 10, but the underlying ansi-terminal package's code is the same for Windows 10 and Unix-like operating systems.

I have stack outputting \ESC[1m\ESC[97m\ESC40m before the filenames. (EDIT: This is true also in, say, a mintty terminal using Cygwyn.)

Note that white in styleFile = bold . white . ondullblack refers to 'vivid' white (\ESC[97m) and not to 'dull' white (\ESC[37m).

If the intent was indeed 'dull' white, the line should be:

styleFile = bold . dullwhite . ondullblack

I also can not reproduce this using version Version 1.8.0, Git revision 94d302c40d3d08dcaa0213f3f1ffdc1384842714 (6077 commits) x86_64 hpack-0.29.0 on macOS High Sierra 10.13.6 using the native Terminal.app console. Again, stack outputs the expected \ESC[1m\ESC[97m\ESC40m.

I was not able to reproduce either, neither on Linux nor on Mac. I think these are changed from between 1.7.1 and 1.8.0.

@pakettiale, can you please try with 1.8.0? Either upgrade to it via stack upgrade --git or wait a few days until the release of the new Stack version.

I can confirm that Version 1.8.0, Git revision 864c35e23a6f43129e28436b1daac8821be93117 x86_64 hpack-0.29.0 from git solves this issue for me.

Was this page helpful?
0 / 5 - 0 ratings