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

Why is there a \r (^M) in stdout and usage and xccdf output #579

Closed
darrenmoffat opened this issue Nov 8, 2016 · 2 comments
Closed

Why is there a \r (^M) in stdout and usage and xccdf output #579

darrenmoffat opened this issue Nov 8, 2016 · 2 comments
Assignees
Milestone

Comments

@darrenmoffat
Copy link

I've noticed that the format strings for displaying the human readable progress output (when not passing --progress) have a \r in them that results in a ^M in the output.

This is a pattern also used in the usage output. For the usage it seems to result in missing output when using gnome-terminal (at least for me), but not for xterm.

eg:

$ oscap xccdf -h
oscap -> xccdf

eXtensible Configuration Checklist Description Format

Usage: oscap [options] xccdf command [command-specific-options]

Commands:
- Perform evaluation driven by XCCDF file and use OVAL as checking engine
- Resolve an XCCDF document
- Validate XCCDF XML content
- Validate XCCDF XML content
- Export XCCDF values as OVAL external-variables document(s)
- Convert XCCDF Benchmark to other formats
- Perform remediation driven by XCCDF TestResult file or ARF.

but it should look like this (but without the ^M), the output below was generated by piping to less.

oscap -> xccdf

eXtensible Configuration Checklist Description Format

Usage: oscap [options] xccdf command [command-specific-options]

Commands:
eval^M - Perform evaluation driven by XCCDF file and use OVAL as checking engine
resolve^M - Resolve an XCCDF document
validate^M - Validate XCCDF XML content
validate-xml^M - Validate XCCDF XML content
export-oval-variables^M - Export XCCDF values as OVAL external-variables document(s)
generate^M - Convert XCCDF Benchmark to other formats
remediate^M - Perform remediation driven by XCCDF TestRe

@jan-cerny
Copy link
Member

Hi, for me it works in GNOME Terminal. I am using gnome-terminal-3.20.3-1.fc24.x86_64 and I don't notice anything missing.

I think that \r (carriage return) there is a hack to align all the options - to have all the bullets on the same collumn in order to look better.

However I agree that this looks ugly when you are not in terminal but you redirect the output afterwards. We also need to remove those \r characters in oscap-docker etc.

I think that something like aligning function like Python has would be benficial for handling this.

@mpreisler mpreisler added this to the 1.3.0 milestone May 25, 2018
@mpreisler
Copy link
Member

Fixed by @jan-cerny in 6c19c67

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