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

malformed base64 input after following instructions #226

Closed
ghostbuster91 opened this issue Feb 6, 2022 · 2 comments · Fixed by #230
Closed

malformed base64 input after following instructions #226

ghostbuster91 opened this issue Feb 6, 2022 · 2 comments · Fixed by #230

Comments

@ghostbuster91
Copy link
Contributor

Provided command to extract base64 armored gpg key outputs on my machine additional % character at the end.

gpg --armor --export-secret-keys $LONG_ID | base64 -w0

My system is:

Ubuntu 20.04.3 LTS
>  gpg --version
gpg (GnuPG) 2.2.19
libgcrypt 1.8.5

It works as expected when calling base64 without -w0.
It seems that -w0 always add % whenever the input doesn't end with a new line.

❯ echo kasper | base64 -w0
a2FzcGVyCg==%                                                                   
~                                                                      
❯ echo kasper | base64    
a2FzcGVyCg==

I'm sure that there was a reason to add that flag to the instruction, so I am not suggesting removing it until we figure out whether it is really redundant.

By creating this issue I want to at least raise awareness for people to check output of their base64 command before they waste many hours debugging publishing.

@ghostbuster91
Copy link
Contributor Author

It seems that this is caused by my shell - zsh which always adds % when output doesn't end with a new line. https://unix.stackexchange.com/questions/167582/why-zsh-ends-a-line-with-a-highlighted-percent-symbol

This also applies to fish

@olafurpg
Copy link
Member

olafurpg commented Feb 6, 2022

Thank you for reporting and identifying the root cause. I’d be happy to merge a PR updating the readme with separate instructions for Ubuntu+zsh/fish

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

Successfully merging a pull request may close this issue.

2 participants