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

Binary output written to console #217

Closed
mgeisler opened this Issue Feb 15, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@mgeisler
Copy link
Contributor

mgeisler commented Feb 15, 2019

If you track binary files with Chezmoi, you will see binary output in the termianl when using chezmoi update -v.

I suggest checking if the files contain a NUL byte before printing them to the terminal. That heuristic normally works okay to determine if a file is "binary" or not.

@twpayne twpayne added the bug label Feb 15, 2019

@twpayne

This comment has been minimized.

Copy link
Owner

twpayne commented Feb 15, 2019

This isn't supposed to happen. There's a check for whether a file is binary or not before printing the diff. Obviously it's not working. What are the contents of the binary file that's getting printed? A hex dump of the first 512 bytes should be enough for reproducing this bug.

@twpayne

This comment has been minimized.

Copy link
Owner

twpayne commented Feb 15, 2019

@mgeisler

This comment has been minimized.

Copy link
Contributor Author

mgeisler commented Feb 15, 2019

Oh, I see you're already thought of this! Cool :-)

The files in question were fonts -- Inconsolata Regular and Bold taken from https://fonts.google.com/specimen/Inconsolata.

@mgeisler

This comment has been minimized.

Copy link
Contributor Author

mgeisler commented Feb 17, 2019

I tried running http.DetectContentType on the first 512 byte of the font, and it answers font/ttf as one would hope: https://play.go-lang.com/p/SQdUxpt0x1E

So I don't know why the font was shown in the terminal.

@twpayne

This comment has been minimized.

Copy link
Owner

twpayne commented Feb 17, 2019

Thanks very much for doing the further investigation. I'll close this for now until we can reproduce the problem.

@twpayne twpayne closed this Feb 17, 2019

@twpayne twpayne added invalid and removed bug labels Feb 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.