4 ms·
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
by perching_aix 2y ago
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?
- 201984 2y agoWhat's wrong with trailing newlines?
- perching_aix 2y agoOther 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.
- bmitc 2y agoYep. Select software being Unix command line tools.
- tryauuum 2y agoI 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
- perching_aix 2y agoMy 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.
- bityard 2y agoI 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?
- perching_aix 2y ago"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.
- eviks 2y agoWait, are they're no editors that don't lie to you?
- norir 2y agoIt 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.
- viraptor 2y agoWhat? Which crazy non-binary format makes a distinction between CRLF(EOF) and just (EOF)? Apart from a plain text file, that is.
- nunobrito 2y agoI 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.
- nightpool 2y agoI have never had any issues with this using a standards compliant CSV parser.
- nunobrito 2y agoAbsolutely 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.
- nightpool 2y agoWell, 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.
- rkeene2 2y agoPeople 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 https://news.ycombinator.com/item?id=13860682
- perching_aix 2y agoMight 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.
- dijit 2y agoI 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.
- nsnshsuejeb 2y agoNot defending the producer, just making pragmatic choices!
- dwattttt 2y agoPragmatic choices is what Postel is known for now, and it makes for a pretty confused world when everyone makes different pragmatic choices.
- akira2501 2y agoDeath pact? Jeez. Standards simply prevent people from having to waste time debugging dumb issues that rightfully could have been avoided.
- eviks 2y ago
- bigstrat2003 2y agoYeah, 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).
- Ekaros 2y agoIf 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.
- nsnshsuejeb 2y agoNo need. Just convince the king (e.g. Google for HTTP) to make a tweak in the next standard version.
- vitus 2y agoGood 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.
- bityard 2y agoWhy 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.
- perching_aix 2y ago> 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.
- oasisaimlessly 2y ago"Trailing newline" isn't anymore of a special phrase than "leading whitespace" (or "leftmost banana").
- perching_aix 2y agoThat is also true, adding to the bafflement factor of it supposedly being "non-existent".
- eqvinox 2y agoA 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?
- perching_aix 2y agoI'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.