Beware of Base64 Encoded Strings
garrit.xyz
garrit.xyz
My brain immediately goes like: You nitwit, base64 comes back from E-Mails, where you would work with Mail-Server's conception that your mails were all written, legible characters. Of course you should expect newlines, potentially whitespaces and tabs in it.
But that would be stupid of me. There's so much old knowledge and know-how we carry along for many decades - around 50 years in case of mail and SMTP. Unix and Linux are a specially egregious example, with so many conventions.... just ran into a long standing bug a few days ago, with some GECOS implementation (that's 62 years old stuff). We do a lot of good in throwing out the now unnecessary old stuff and separating the wheat from the chaff. Again and again.
In so far: Thanks for the pointer on that Base64 appears strange (also please do not let us talk about groff).
-w, --wrap=COLS
wrap encoded lines after COLS character (default 76). Use 0 to disable line wrapping
The manpage is about one screen size large. 1 minute read.- base64 is a stupid easy command to use the default behavior (guessing is easily possible)
- they probably would not have retained flags from the man page unless they needed to use them the first time they used base64
- they probably didn't need to use any flags with base64 in the past
- it's perfectly reasonable to expect base64 to base64 long inputs the same way it encodes short ones. In fact I would say any other suggestion is unreasonable
- it is perfectly reasonable to not read the man page again when you have a concrete expectation of how a program should behave
The purpose of base64 is to turn binary into text that can be embedded in normal text messages such as email and Usenet. A right margin of about 80 characters is very much what one should expect such a tool to default to.
The primary purpose of these tools have changed over time as the environment has changed. You know nobody uses usenet anymore, and nobody copypastes base64 into emails anymore, right?
Also look into the text files für the public/private keys. It is always this, because the screen has only 80 characters in width.
If ever you make a mistake, never, ever write it up. It might get submitted here for everyone to tell you how stupid you were.
Sure you can write it up! But post it to maybe, Reddit?
The HN audience expects certain standard of quality and insight in the article if the article is on the front page.
Here the community has voted that this article does not meet the bar. I can't speak for others but for me this article is too obvious and uninteresting.
Instead of complaining about something that didn't happen here (nobody said the OP was stupid), maybe learn from the community feedback and refrain from posting articles that don't meet the community expectations?
It was on the front page ... it hit the top spot. Various people in the community clearly did think it met the bar.
> ... nobody said the OP was stupid ...
Reading between the lines, several people effectively said exactly that.
I know, I'm in "Old man yells at cloud" territory here, but I was kinda hoping people would find a more positive way of interpreting the situation, rather than "Can't the author just RTFM?!?" types of responses.
My agèd and fading memory of what HN was like when I first joined suggests that people used to be more interested in being constructive and learning from other people's mistakes, even the mistakes that, when they didn't make them, seemed obvious in retrospect. Perhaps especially those ones.
Since this didn't meet your bar, since it's all too obvious for you, I guess there's very little for you to learn. I'm sorry you (and others) felt you had to dump on it, instead of leaving it for people who can still learn from things as "obvious" as this. After all, the votes that got it to the front page show that not everyone knows as much as you do.
It was on the front page. It hit the top spot. Then it got flagged. Many people in the community clearly did think it was clickbait and did not meet the bar!
Now things like that get flagged, even though there's clearly a sizeable proportion of people who do still find it useful[0].
The demographics have changed[1].
So I'll remember, on your advice, that if ever I write up any simple mistakes I make, I won't post them here.
[0] FWIW, I think flags required to kill something is far fewer than votes required to get to the front page. So even if a vast majority of people think something is interesting, a far smaller collection of people can get it killed.
[1] Or my memory is faulty. I've been here 15 years now ... maybe it was always like this.
This is because of its original use which was to encode binary files to include in emails. Very long lines in emails don't work well.
See the precursor to base64 which is the uuencode command which you probably have installed too if you have the base64 command. base64 is a better, standardised version of uuencode.
Use --wrap=0 to disable.
In general I always try to use the long-form options in scripts as readability is more important that conciseness.
I would really like some quoting of that argument. Otherwise a weird password can really break things.
Since base64 seems to be not much more compact in practice (?), but also fails at transmission through the lossy channel that is human communication.
(Arguably, there's also hexadecimal, but compactness starts becoming an issue there ?)
Surprised I haven't run into this wrapping or worse, lol
Is this another "changeme is valid base64" moment?
Come on! Base64 has been around for 30 years!
No, of course you don't. You expect things to behave the way they always have.
Then when something goes wrong you don't immediately suspect the command you've successfully been using for the past 10 years and read the man page for all the commands you've been using for the past 10[1] years.
No, you suspect the new code.
[0] For some value of 10[1].
[1] In my case significantly longer than 10.
Yes, that's the first thing I do.
Do you read the man page every time you use "ls"?
Do you read the man page every time you invoke the compiler for your favourite language?
If you use someone else's machine, do you read the man page for every command you type? The distro could be different, so you can't be sure it will be the same.
I suspect the answer here in each case is "no", so I'm curious as to where you draw the line. If you used a command yesterday, and the day before and the day before that, do you read the man page today?
Again, I suspect the answer is "no", but again, I'm curious as to where that line really is.