certificates icon indicating copy to clipboard operation
certificates copied to clipboard

[Bug]: wrong clie outputs on windows

Open lordrak007 opened this issue 1 year ago • 8 comments

Steps to Reproduce

download latest step and run in cli or powershell

Your Environment

  • OS - server 2022 or windows 11
  • step-ca Version -

Expected Behavior

Write output correctly

Actual Behavior

C:\Users\myuser\Desktop>step ←[0;1;99mNAME←[0m ←[0;1;99mstep←[0m -- plumbing for distributed systems

←[0;1;99mUSAGE←[0m ←[0;1;99mstep←[0m ←[0;4;39mcommand←[0m ←[0;4;39m[arguments]←[0m

←[0;1;99mOPTIONS←[0m ←[0;1;99m--help←[0m, ←[0;1;99m-h←[0m show help

  ←[0;1;99m--config←[0m=←[0;4;39mvalue←[0m
      path to the config file to use for CLI flags

  ←[0;1;99m--version←[0m, ←[0;1;99m-v←[0m
      print the version

←[0;1;99mCOMMANDS←[0m ←[0;1;99mhelp, h←[0m display help for the specified command or command group ←[0;1;99mpath←[0m print the configured step path and exit ←[0;1;99mbase64←[0m encodes and decodes using base64 representation ←[0;1;99mcertificate←[0m create, revoke, validate, bundle, and otherwise manage certificates ←[0;1;99mcompletion←[0m print the shell completion script ←[0;1;99mcontext←[0m manage certificate authority contexts ←[0;1;99mcrl←[0m initialize and manage a certificate revocation list ←[0;1;99mcrypto←[0m useful cryptographic plumbing ←[0;1;99moauth←[0m authorization and single sign-on using OAuth & OIDC ←[0;1;99mversion←[0m display the current version of the cli ←[0;1;99mca←[0m initialize and manage a certificate authority ←[0;1;99mbeta←[0m commands that are being tested; these APIs are likely to change ←[0;1;99mssh←[0m create and manage ssh certificates

Additional Context

no

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

lordrak007 avatar Oct 11 '24 13:10 lordrak007

Hey @lordrak007 👋, thanks for opening the issue.

I believe what you're seeing are color codes that aren't being correctly parsed by your terminal. We opened up this issue (https://github.com/smallstep/cli/issues/648) a few years ago to track this feature request. Unfortunately, there hasn't been much engagement on that issue and, given our team size and other product focuses, we have to be very careful about only prioritizing those issues that would most benefit the community.

That said, we'd be happy to accept a PR from the community. If anyone is interested in working on this, let us know and we'd be happy to chat through it.

cheers 🍻

dopey avatar Nov 08 '24 07:11 dopey

If it's ok with you, I will close this as a duplicate of the existing feature request.

dopey avatar Nov 08 '24 07:11 dopey

Hi, i think this is bug for latest version of step. Previoud release seems be ok.

lordrak007 avatar Nov 08 '24 11:11 lordrak007

Can you provide more specific information regarding your environment? E.g. (official) Windows version, PowerShell version, etc.

hslatman avatar Nov 08 '24 13:11 hslatman

If you are experiencing this issue, please save the following script as a .ps1 file and run it using Powershell.

Write-Host "=== System Information ==="
systeminfo | Select-String "^OS Name|^OS Version"

Write-Host "`n=== Windows Version (ver) ==="
cmd.exe /c ver

Write-Host "`n=== PowerShell Version ==="
$PSVersionTable

Write-Host "`n=== Console Encoding ==="
Write-Host "OutputEncoding: $([Console]::OutputEncoding)"
Write-Host "InputEncoding : $([Console]::InputEncoding)"

Write-Host "`n=== .NET Encoding Defaults ==="
[System.Text.Encoding]::Default
[System.Text.Encoding]::ASCII
[System.Text.Encoding]::UTF8

Write-Host "`n=== Locale and Culture ==="
Get-Culture
Get-WinSystemLocale
Get-WinUserLanguageList

Write-Host "`n=== Code Page Info (chcp) ==="
cmd.exe /c chcp

Write-Host "`n=== Environment Variables Related to Encoding ==="
Get-ChildItem Env: | Where-Object { $_.Name -match 'LANG|LC_|CODEPAGE' }

sevenrats avatar Apr 15 '25 15:04 sevenrats

It will output helpful info like this:

=== System Information ===

OS Name:                   Microsoft Windows 10 Enterprise
OS Version:                10.0.19044 N/A Build 19044

=== Windows Version (ver) ===

Microsoft Windows [Version 10.0.19044.1865]

=== PowerShell Version ===

Key   : PSVersion
Value : 5.1.19041.1682
Name  : PSVersion


Key   : PSEdition
Value : Desktop
Name  : PSEdition


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name  : PSCompatibleVersions


Key   : BuildVersion
Value : 10.0.19041.1682
Name  : BuildVersion


Key   : CLRVersion
Value : 4.0.30319.42000
Name  : CLRVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion


Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


=== Console Encoding ===
OutputEncoding: System.Text.SBCSCodePageEncoding
InputEncoding : System.Text.SBCSCodePageEncoding

=== .NET Encoding Defaults ===

IsSingleByte      : True
BodyName          : iso-8859-1
EncodingName      : Western European (Windows)
HeaderName        : Windows-1252
WebName           : Windows-1252
WindowsCodePage   : 1252
IsBrowserDisplay  : True
IsBrowserSave     : True
IsMailNewsDisplay : True
IsMailNewsSave    : True
EncoderFallback   : System.Text.InternalEncoderBestFitFallback
DecoderFallback   : System.Text.InternalDecoderBestFitFallback
IsReadOnly        : True
CodePage          : 1252


IsSingleByte      : True
BodyName          : us-ascii
EncodingName      : US-ASCII
HeaderName        : us-ascii
WebName           : us-ascii
WindowsCodePage   : 1252
IsBrowserDisplay  : False
IsBrowserSave     : False
IsMailNewsDisplay : True
IsMailNewsSave    : True
EncoderFallback   : System.Text.EncoderReplacementFallback
DecoderFallback   : System.Text.DecoderReplacementFallback
IsReadOnly        : True
CodePage          : 20127


BodyName          : utf-8
EncodingName      : Unicode (UTF-8)
HeaderName        : utf-8
WebName           : utf-8
WindowsCodePage   : 1200
IsBrowserDisplay  : True
IsBrowserSave     : True
IsMailNewsDisplay : True
IsMailNewsSave    : True
IsSingleByte      : False
EncoderFallback   : System.Text.EncoderReplacementFallback
DecoderFallback   : System.Text.DecoderReplacementFallback
IsReadOnly        : True
CodePage          : 65001


=== Locale and Culture ===

Parent                         : en
LCID                           : 1033
KeyboardLayoutId               : 1033
Name                           : en-US
IetfLanguageTag                : en-US
DisplayName                    : English (United States)
NativeName                     : English (United States)
EnglishName                    : English (United States)
TwoLetterISOLanguageName       : en
ThreeLetterISOLanguageName     : eng
ThreeLetterWindowsLanguageName : ENU
CompareInfo                    : CompareInfo - en-US
TextInfo                       : TextInfo - en-US
IsNeutralCulture               : False
CultureTypes                   : SpecificCultures, InstalledWin32Cultures, FrameworkCultures
NumberFormat                   : System.Globalization.NumberFormatInfo
DateTimeFormat                 : System.Globalization.DateTimeFormatInfo
Calendar                       : System.Globalization.GregorianCalendar
OptionalCalendars              : {System.Globalization.GregorianCalendar, System.Globalization.GregorianCalendar}
UseUserOverride                : True
IsReadOnly                     : False


Parent                         : en
LCID                           : 1033
KeyboardLayoutId               : 1033
Name                           : en-US
IetfLanguageTag                : en-US
DisplayName                    : English (United States)
NativeName                     : English (United States)
EnglishName                    : English (United States)
TwoLetterISOLanguageName       : en
ThreeLetterISOLanguageName     : eng
ThreeLetterWindowsLanguageName : ENU
CompareInfo                    : CompareInfo - en-US
TextInfo                       : TextInfo - en-US
IsNeutralCulture               : False
CultureTypes                   : SpecificCultures, InstalledWin32Cultures, FrameworkCultures
NumberFormat                   : System.Globalization.NumberFormatInfo
DateTimeFormat                 : System.Globalization.DateTimeFormatInfo
Calendar                       : System.Globalization.GregorianCalendar
OptionalCalendars              : {System.Globalization.GregorianCalendar, System.Globalization.GregorianCalendar}
UseUserOverride                : True
IsReadOnly                     : False


LanguageTag     : en-US
Autonym         : English (United States)
EnglishName     : English
LocalizedName   : English (United States)
ScriptName      : Latin
InputMethodTips : {0409:00000409}
Spellchecking   : True
Handwriting     : False


=== Code Page Info (chcp) ===
Active code page: 437

=== Environment Variables Related to Encoding ===

sevenrats avatar Apr 15 '25 15:04 sevenrats

@sevenrats and can you confirm that you're experiencing this issue on a system with the output that you posted here?

tashian avatar Apr 15 '25 15:04 tashian

@tashian yep

sevenrats avatar Apr 15 '25 15:04 sevenrats