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

VAULT_CLI_NO_COLOR produces ANSI sequences #3973

Closed
ixe013 opened this issue Feb 14, 2018 · 3 comments
Closed

VAULT_CLI_NO_COLOR produces ANSI sequences #3973

ixe013 opened this issue Feb 14, 2018 · 3 comments
Milestone

Comments

@ixe013
Copy link
Contributor

ixe013 commented Feb 14, 2018

Pull request #3897 changed the handling of command line output. I believe it now goes through a BasicFormat object. It always emits some sequence to clear the style:

.[0;0mVault v0.9.3

Clearing the ANSI sequence still requires ANSI support, which is expected to be missing if VAULT_CLI_NO_COLOR is set.

Environment:

  • Set this environment variable
export VAULT_CLI_NO_COLOR=1

Or on Windows

SET VAULT_CLI_NO_COLOR=1
  • Vault Version:
    0.9.3
  • Operating System/Architecture:
    Can reproduce on Windows 64 bits or Linux 64 bits

Vault Config File:
N/A

Expected Behavior:
No ANSI sequence should be output if VAULT_CLI_NO_COLOR is set.

Actual Behavior:
ANSI escape sequences were produced in the output. Granted, there was no color, but the mere fact of having no color is a color in itself.

Steps to Reproduce:
Run any vault command line command. For example with this environment:

[~]$ export VAULT_CLI_NO_COLOR=1
[~]$ ./vault version
Vault v0.9.3 ('5acd6a21d5a69ab49d0f7c0bf540123a9b2c696d')
[~]$ ./vault version | xxd
0000000: 1b5b 303b 306d 5661 756c 7420 7630 2e39  .[0;0mVault v0.9
0000010: 2e33 2028 2735 6163 6436 6132 3164 3561  .3 ('5acd6a21d5a
0000020: 3639 6162 3439 6430 6637 6330 6266 3534  69ab49d0f7c0bf54
0000030: 3031 3233 6139 6232 6336 3936 6427 291b  0123a9b2c696d').
0000040: 5b30 6d0a                                [0m.

Same thing on Windows:

C:\Dev\Binaries\vault>set VAULT
VAULT_CLI_NO_COLOR=1
VAULT_ADDR=https://localhost:8200

Query Vault version

C:\Dev\Binaries\vault>vault version
←[0;0mVault v0.9.3 ('5acd6a21d5a69ab49d0f7c0bf540123a9b2c696d')←[0m

References:
#3897

@jefferai
Copy link
Member

Cannot reproduce:

$ vault version | xxd
00000000: 5661 756c 7420 7630 2e39 2e33 2028 2764  Vault v0.9.3 ('d
00000010: 6464 6635 6537 3236 6532 3232 3935 6337  ddf5e726e22295c7
00000020: 3930 3235 6666 6536 3461 3933 6438 6133  9025ffe64a93d8a3
00000030: 3736 6138 3431 3127 290a                 76a8411').

@jefferai jefferai added this to the 0.9.4 milestone Feb 14, 2018
@calvn
Copy link
Contributor

calvn commented Feb 14, 2018

@ixe013 you are running a build before #3897 got implemented. 5acd6a2 is the commit for the 0.9.3 release, so you need to do a build from master in order to get the changes.

@calvn calvn closed this as completed Feb 14, 2018
@ixe013
Copy link
Contributor Author

ixe013 commented Feb 14, 2018

Thanks, I will build my own version until 0.9.4 comes along.

Obviously, it is not for vault version that it is problematic, but for scripted commands like vault operator init. Parsing the shards from the output grabs those pesky sequences...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants