-
Notifications
You must be signed in to change notification settings - Fork 165
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
v0.5.1 breaks base64 -d
on Alpine Linux (musl libc)
#126
Comments
Sorry, fat-fingered the post button. |
Hi, this is caused by a change in behavior of the The fix is to run it as |
I hope you don’t consider this totally unexpected and confusing behaviour a feature. Since newline is not a valid character in base64, you can easily strip the trailing newline in the input to the decoder. |
The But over the years a few issues have been raised (#8 is the one I could find quickly) that were caused by the fact that the behavior was not identical to the system But, and this is where you have a point, it seems like I didn't do a perfect job, because upon checking, the system echo foo | base64 | base64 -d So I guess this issue is now about stripping newlines from the input. |
Possible connection to #33. |
Windows 7 x64 user here. Looking forward to test a fixed version. |
I pushed an I guess I can merge it because a working but slow program is preferable over a non-working program, but it sucks to admit defeat to the system |
@aklomp, you mean I have to download that branch and compile it myself? o_O |
@sergeevabc Well yes, how else do you get a binary? This project does not publish any binaries. But anyway, I think I'll merge the branch today because it fixes the issue, and create a follow-up issue to deal with the slow decoding. The fix works, it's pretty trivial and I tested it locally. It's just quite slow because it scans the input twice. |
Found the speed regression. Don't write to |
Testing base64 0.5.2 built with w64devkit on Windows 7 x64. Oh my, the executable turned out to be almost 10 times larger than the source (116658 vs 12913 bytes). $ busybox echo -n Z2l0aHVi | base64.exe -d
github
$ busybox echo -n Z2l0aHViIAo= | base64.exe -d
github
$ busybox echo -n Z2l0aHViCg== | base64.exe -d
github
$ busybox echo -n Z2l0aHViIA0K | base64.exe -d
github I guess the devil is in the details like spaces, carriage returns and line feeds? |
@sergeevabc I don't quite understand your comment. Are you reporting a bug? Those strings seem to decode fine for me, including the whitespace, as shown with $ echo -n Z2l0aHVi | bin/base64 -d | xxd
00000000: 6769 7468 7562 github
$ echo -n Z2l0aHViIAo= | bin/base64 -d | xxd
00000000: 6769 7468 7562 200a github .
$ echo -n Z2l0aHViCg== | bin/base64 -d | xxd
00000000: 6769 7468 7562 0a github.
$ echo -n Z2l0aHViIA0K | bin/base64 -d | xxd
00000000: 6769 7468 7562 200d 0a github .. About the binary size, not sure why it's so much larger, but I think static linking might have something to do with it. |
There's an issue indeed, @aklomp. |
@sergeevabc This issue has been closed. Please open a new issue if you want to file a bug report. By the way, I can't reproduce this in Linux; are you sure you are using the latest version? |
base64 v0.5.0 works fine, v0.5.1 is broken on Alpine Linux Edge (both with gcc and cmake):
The text was updated successfully, but these errors were encountered: