Most active commenters
  • perching_aix(8)
  • eviks(4)
  • akira2501(3)

←back to thread

422 points km | 39 comments | | HN request time: 0.002s | source | bottom
1. perching_aix ◴[] No.41831129[source]
Well, at least the title is honest. Straight up asking people to break standards out of sheer conviction is a new one for me personally, but it's definitely one of the attitudes of all time, so maybe it's just me being green.

Can we ask for the typical *nix text editors to disobey the POSIX standard of a text file next, so that I don't need to use hex editing to get trailing newlines off the end of files?

replies(4): >>41831233 #>>41831275 #>>41831592 #>>41833146 #
2. 201984 ◴[] No.41831233[source]
What's wrong with trailing newlines?
replies(2): >>41831241 #>>41831375 #
3. perching_aix ◴[] No.41831241[source]
Other than select software being pissy about it, not much. Just like how there's nothing wrong with CRLF, except for select software being pissy about that too.
replies(2): >>41832054 #>>41832819 #
4. rkeene2 ◴[] No.41831275[source]
People don't seem to mind when Chrome does it [0]. The response "standards aren't a death pact" stands out in particular.

[0] https://news.ycombinator.com/item?id=13860682

replies(2): >>41831414 #>>41833103 #
5. norir ◴[] No.41831375[source]
It makes writing parsers more complicated in certain cases because you can't tell without lookahead if a newline character should be treated as a newline or an eof.
replies(1): >>41831718 #
6. perching_aix ◴[] No.41831414[source]
Might be just my personal impression, but I'm pretty sure Chrome is extremely notorious for abusing its market leader position, including in this way. So gonna have to disagree there, from my view people do mind Chrome and its implementation particularities quite a lot.
replies(1): >>41831905 #
7. bigstrat2003 ◴[] No.41831592[source]
Yeah, I have no idea what the author is smoking. Deliberately breaking standards is simply not an acceptable solution to the problem, even if it were a serious problem (it's not).
replies(1): >>41831612 #
8. Ekaros ◴[] No.41831612[source]
If there truly is a problem with existing protocols, propose and properly design new one that can replace it. Then if it is technically superior solution it should win in long run.
replies(1): >>41831994 #
9. viraptor ◴[] No.41831718{3}[source]
What? Which crazy non-binary format makes a distinction between CRLF(EOF) and just (EOF)? Apart from a plain text file, that is.
replies(1): >>41832157 #
10. dijit ◴[] No.41831905{3}[source]
I think the parent is equally denigrating the situation.

Leaders choose the standards, especially as they approach monopoly.

Worse still: people will come out of the woodwork to actively defend the monopolist de facto standard producer.

replies(1): >>41831972 #
11. nsnshsuejeb ◴[] No.41831972{4}[source]
Not defending the producer, just making pragmatic choices!
replies(1): >>41833497 #
12. nsnshsuejeb ◴[] No.41831994{3}[source]
No need. Just convince the king (e.g. Google for HTTP) to make a tweak in the next standard version.
replies(1): >>41836672 #
13. bmitc ◴[] No.41832054{3}[source]
Yep. Select software being Unix command line tools.
14. nunobrito ◴[] No.41832157{4}[source]
I won't mention telnet because you don't use it, but in CSV and similar data it is quite a trouble to normalize the data. So instead of 2 possibilities now we 3 to detect.
replies(2): >>41832526 #>>41832567 #
15. nightpool ◴[] No.41832526{5}[source]
I have never had any issues with this using a standards compliant CSV parser.
replies(1): >>41850490 #
16. viraptor ◴[] No.41832567{5}[source]
I don't get the CSV part. You can emit a new row after a line ending and on EOF with non-empty buffer. What's the tricky part or third option here? The crlf is never a part of the data.
17. tryauuum ◴[] No.41832819{3}[source]
I do like concatenating files with cat, and if a file has its final line not ending in newline symbol the result is ugly.

I know it's just me but my worldview is that the world would be better if all editors had "insert final newline" behavior

replies(1): >>41832858 #
18. perching_aix ◴[] No.41832858{4}[source]
My problem is that what I input (and observe!) doesn't match what's persisted. Worse still, editors lie about it to me until I close the file and reopen it. And just to really turn the knife, various programs will then throw a fit that a character that I did not input and my editor lies about not being present, is present. I hope it's appreciable why I find this frustrating.

I expect my editor to do what I say, not secretly(!) guess what I might have wanted, or will potentially want sometime in the future. Having to insert a newline while concatenating files is a chore, but a predictable annoyance. Having to hunt for mystery bytes, maybe less so.

replies(2): >>41833180 #>>41834447 #
19. akira2501 ◴[] No.41833103[source]
Death pact? Jeez. Standards simply prevent people from having to waste time debugging dumb issues that rightfully could have been avoided.
replies(1): >>41834554 #
20. bityard ◴[] No.41833146[source]
Why would you want that?

All Unix text processing tools assume that every line in a text file ends in a newline. Otherwise, it's not a text file.

There's no such thing as a "trailing newline," there is only a line-terminating newline.

I've yet to hear a convincing argument why the last line should be an exception to that extremely long-standing and well understood convention.

replies(1): >>41833701 #
21. bityard ◴[] No.41833180{5}[source]
I have been using and programming Unix systems for almost 30 years and have not run into anything like what you are describing.

What Unix program "throws a fit" when encountering a perfectly normal newline in the last line in a file?

replies(1): >>41833263 #
22. perching_aix ◴[] No.41833263{6}[source]
"Unix programs" I haven't ran into throwing a fit per se. That's why I didn't write that.

What I ran into issues with was contemporary software that's shipped to Linux, such as Neo4j, which expects its license files to have no newline at the end of the file, and will actively refuse to start otherwise.

I have a feeling I'll now experience the "well that's that software's problem then" part of this debate. Just like how software not being able to handle CRLF / CR-only / LF-only, is always the problem - instead of text files being a joke, and platforms assuming things about them being the problem.

23. dwattttt ◴[] No.41833497{5}[source]
Pragmatic choices is what Postel is known for now, and it makes for a pretty confused world when everyone makes different pragmatic choices.
24. perching_aix ◴[] No.41833701[source]
> There's no such thing as a "trailing newline," there is only a line-terminating newline.

Is "line-terminating newline" a controlled / established term I'm unfamiliar with or am I right to hold deep contempt against you?

Because "trailing newline", contrary to what you claim, is 100% established terminology (in programming anyways), so I'd most definitely consider it "existing", and I find it actively puzzling that someone wouldn't.

replies(2): >>41834339 #>>41835372 #
25. oasisaimlessly ◴[] No.41834339{3}[source]
"Trailing newline" isn't anymore of a special phrase than "leading whitespace" (or "leftmost banana").
replies(1): >>41834730 #
26. eviks ◴[] No.41834447{5}[source]
Wait, are they're no editors that don't lie to you?
27. eviks ◴[] No.41834554{3}[source]
They also add to the time wasted by not removing needless complexity in due time
replies(1): >>41835297 #
28. perching_aix ◴[] No.41834730{4}[source]
That is also true, adding to the bafflement factor of it supposedly being "non-existent".
29. akira2501 ◴[] No.41835297{4}[source]
The complexity of CRLF?

The balance here, of course, being backwards compatability. I'd sooner kill EBCDIC, bad ASCII and Code Pages than worry about CRLF if we didn't have to care about ancient systems.

Programming languages still retain C's operator precedence hierarchy even though it was itself meant to be a backwards compatible compromise and leads to errors around logical operator expressions.

Anyways, this article is about actively breaking systems like some kind of protocol terrorist in order to achieve an outcome at any cost, if it was merely along the lines of "CRLF considered harmful in new protocols" I'd have nothing to say.

replies(1): >>41836400 #
30. eqvinox ◴[] No.41835372{3}[source]
A trailing newline to me is "\n\n" at the end of a file, i.e. a superfluous empty line. That doesn't seem to be what the root comment is referring to, though?
replies(1): >>41836361 #
31. perching_aix ◴[] No.41836361{4}[source]
I'm referring to files ending with a \n, and I do not see why this wouldn't be a trailing newline. It's a newline... at the end.
replies(1): >>41842084 #
32. eviks ◴[] No.41836400{5}[source]
> The complexity of CRLF?

You didn't limit your general admiration of standards to CRLF, so no, not only that.

> about actively breaking systems like some kind of protocol terrorist in order to achieve an outcome at any cost,

That's simply false, he isn't

> Almost all implementations of these protocols will accept a bare NL as an end-of-line mark, even if it is technically incorrect.

replies(2): >>41836786 #>>41841064 #
33. vitus ◴[] No.41836672{4}[source]
Good news! Both HTTP/2 and HTTP/3 use a packed binary representation for headers, so CRLF is nowhere to be found in RFC 9113 / 9114.

I don't see value in picking on Google or HTTP here, even if it is fashionable to do so.

34. LegionMammal978 ◴[] No.41836786{6}[source]
> Almost all implementations of these protocols will accept a bare NL as an end-of-line mark, even if it is technically incorrect.

See https://news.ycombinator.com/item?id=41832555 as far as HTTP/1.1 goes, it's definitely common but far from universal. The big problem with "it's 100% safe to make this change, since it doesn't break anything I know about" is that there are always a lot of things you don't know about, not all of which can be boiled down to being negligible weirdos.

35. akira2501 ◴[] No.41841064{6}[source]
> You didn't limit your general admiration of standards to CRLF, so no, not only that.

So your position, then, is that all standards include "needless complexity?" What argument are you actually trying to make here?

> That's simply false, he isn't

Yea.. that's why the word "like" is present, it implies a near association, not a direct accusation.

> Almost all implementations of these protocols will accept a bare NL as an end-of-line mark, even if it is technically incorrect.

So, right back to my original point, then, standards prevent people from having to debug dumb issues that could have been avoided. This advice is basically "go ahead, create dumb issues, see if I care."

I may have flippantly labeled that as "protocol terrorism" but I don't think it's pure hyperbole either.

replies(1): >>41841570 #
36. eviks ◴[] No.41841570{7}[source]
> What argument are you actually trying to make here?

That you're mistaken in your one-sided generalization of the benefits of standards.

> So your position, then, is that all standards include "needless complexity?"

No, that's just another extreme you've made up.

> Yea.. that's why the word "like" is present, it implies a near association, not a direct accusation.

Your mistake is before "like", you can't be "about actively breaking systems" when you explicitly say that no systems will be broken

> "see if I care."

That this is false is also easy to see - the author reverted a change after he realized it breaks something ancient, so clearly he does care.

> standards prevent people from having to debug dumb issues that could have been avoided.

Not to circle the conversaion back to my original response to your point: why do you think "Almost all implementations" break the standard and "accept a bare NL"? Could it be that such unintuitive limitations don't prevent anything, and people still have to debug "dumb issues" because common expectations are more powerful?

37. eqvinox ◴[] No.41842084{5}[source]
In my head, a trailing newline is a newline, at the end, on its own, a blank line after the last line in a file… that's a file ending in \n\n (or more).

It hadn't even occurred to me until today that anything else could be meant :o

38. nunobrito ◴[] No.41850490{6}[source]
Absolutely correct: You never had issues. Other people have built other software that does not use modern CSV libraries. They work just fine today and don't need to update, wouldn't even be possible for most cases in either case.

Please do consider that many software products will not change and they will still be actively used on production environments that you will never have interest about.

replies(1): >>41852209 #
39. nightpool ◴[] No.41852209{7}[source]
Well, GP proposed removing the idea of trailing newlines from standard *nix tools entirely, so I think it's fair to ask what shop is going to update their RHEL deployment to upgrade to a version of `cat` or `sed` that doesn't have trailing newlines but can't spend 5 minutes to handle a newline properly in their CSV parser? That doesn't make a lot of sense.

And it was pretty clear from the context of norir's comment that they were not talking about legacy software, they were talking about writing new projects/file formats that used newlines as a separator. Just because you want to shoehorn your legacy projects into this discussion doesn't mean that they fit.