News for hackers. Stuff that matters.
Re:What the GNU? by marcodiego on Thursday September 30, 2021 @09:29AM (#28706061)
The article is unfairly bashing GNU. For example:

> OK, now have a look at the 120 lines long source of GNU yes. And compare now that behemoth against the implementation in OpenBSD, the one from sbase, or the one from busybox. Like… why does GNU yes does so many memory operations for a task that is implemented so easily by everyone else?

The answer can be seen here: https://news.ycombinator.com/item?id=14542938 https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes...

But from the style of the author, it is clear that it is the case of a knowledgeable well informed educated person. GNU clearly has its problems, but badmouthing it like that is hard to differ from malice.

Re:What the GNU? by akkartik on Thursday September 30, 2021 @10:32AM (#28706794)
Does GNU yes need such great performance, though? I'm curious to hear where it matters. Why would we need 10 billion yeses a second, and why would 10 million yeses a second not be good enough?
Re:What the GNU? by marcodiego on Thursday September 30, 2021 @11:02AM (#28707158)
I don't know. And actually I don't care. A program that fits in a single file with 120 lines of readable code is a price I'm willing to pay for close to best possible performance.

But that is not why I commented. I commented because I wanted to illustrate that the author questioned something that can be easily answered with a simple google search. I'm sure the author is qualified enough to answer the question, but instead left in the post giving most readers a impression that the complexity is there out of incompetence of GNU developers.

EDIT: I should not assume you asked in bad faith, but as the sibling commented. The answer to your question can be easily found in the link I posted. Making your behavior strangely similar to the author of the post: making questions that can be easily answered while giving a bad impression of others. Please, avoid that. It may work in many places but will fire back at you sometimes.

Re:What the GNU? by akkartik on Thursday September 30, 2021 @11:06AM (#28707212)
I don't find it so questionable to ask questions that the right google search (out of an infinite number; we're not all equally deeply immmersed in this stuff) can answer. But if we disagree about that I guess I'll stop talking to you. The actual question we're debating will have to wait. I've had to deal with enough ornery people in my life who had the answer like, right in their head but would still insist on putting others through pain for it. These days I try to foster a workplace where anybody struggling with a question the person next to them knows the answer to is wasting the team's time.

(Skills are not the same as factual knowledge here.)

Re:What the GNU? by marcodiego on Thursday September 30, 2021 @11:22AM (#28707402)
Sorry for giving the wrong impression. My problem with the question is not that it is easy to answer. The problem is that it is easy to answer WHILE giving a bad impression of others.
Re:What the GNU? by akkartik on Thursday September 30, 2021 @11:35AM (#28707567)
I don't understand what you mean. Why can't we just debate the question without speculating about motivations of the people raising/answering the question?
Re:What the GNU? by marcodiego on Thursday September 30, 2021 @11:45AM (#28707676)
I think I misread and misjudged you. I'm sincerely sorry for that.

Maybe it is a sensible subject for me or I've been living with people asking rhetorical redundant questions as a passive agressive form for disqualifying others.

I read your question as: "I can't see any reason this performance is needed, maybe it is really incompetence or pedantism from GNU developers." But I think it is prejudice on my part.

Sorry.

EDIT: grammar.

Re:What the GNU? by akkartik on Thursday September 30, 2021 @11:53AM (#28707773)
Thank you! And yes, I admit you were partly right. Questions often have some component of rhetorical quality. It's not always yes/no on whether it's a rhetorical question or not. But either way, I find (based on experience teaching) that the best way to answer a question is just by treating it as genuine. Past a point if I decide someone's acting in bad faith I just disengage.

Anyways, back to the original question, I do believe that a lot of programmers (I don't buy OP's separation between GNU and non-GNU) over-engineer things without regard to the costs created by over-engineered code. My default assumption is that that's happening in yes. If it's happening in such a small program where it's so obvious, the same tendencies are likely to be at work in more complex programs like cat and awk and cc. Happy to debate that :)

Re:What the GNU? by marcodiego on Thursday September 30, 2021 @01:02PM (#28708531)
Debating that... I think https://news.ycombinator.com/item?id=14543640 is more plausible.
Re:What the GNU? by akkartik on Thursday September 30, 2021 @01:25PM (#28708786)
Thanks! Glad you didn't think I was in bad faith after the semi-rhetorical question and disengage.

That whole thread makes me sad. Another, more subtle way IP is ruining the world. But that's neither here nor there on this debate.

Just to flesh out my current thinking a bit more:

* I'd really like a study to understand how much complexity old GNU tools have gained in the past 2 decades. Because that would not be due to copyright concerns. But I'm not sure I have the necessary skills. (I'd like this study for non-GNU as well, but I assume copyright is not a concern there so the study doesn't have to set crisp time bounds.)

* I share some of Drew DeVault's frustration in https://drewdevault.com/2020/09/25/A-story-of-two-libcs.html. I've viscerally felt the immediate sense of disempowerment he describes when cracking open an open source package. _However_ I vehemently oppose his cavalier lack of concern for locales. Internationalization is important. ASCII is just as effective at disempowering others.

Re:What the GNU? by marcodiego on Thursday September 30, 2021 @02:09PM (#28709240)
> Thanks! Glad you didn't think I was in bad faith after the semi-rhetorical question and disengage.

You are welcome! Considering the karma I got from that answer, I don't think I'm the only one who misread you. If you want a piece of advice: starting a question like that with "Genuinely curious: ..." is my strategy to prevent this kind of misunderstanding.

> * I share some of Drew DeVault's frustration in https://drewdevault.com/2020/09/25/A-story-of-two-libcs.html. I've viscerally felt the immediate sense of disempowerment he describes when cracking open an open source package. _However_ I vehemently oppose his cavalier lack of concern for locales. Internationalization is important. ASCII is just as effective at disempowering others.

As Drew DeVault's says, it was his code which was broken. I know glic code is complex, but it is battle tested, mature and highly robust. I'd bet there are good reasons for that complexity. If I was really curious as to why, I'd try asking devs directly to avoid making them look bad by making public statements about it.

Now, I looked in scdoc code. The solution was to cast the parameters to "unsigned char". Considering the code

  uint32_t ch;
  isalnum(ch);
compiles without warning (even with -Wall -Wextra) on my machine, I'd consider this a potential vulnerability for programs using this function. I can't see why glibc developers don't turn isalnum into a macro that automatically casts its parameter (when its address is not taken). I'll consider asking them this weekend.

EDIT: possible nice finding: https://news.ycombinator.com/item?id=24597461

EDIT2: part of the reason: "unsigned char" can't hold EOF.

Re:What the GNU? by SAI_Peregrinus on Thursday September 30, 2021 @07:35PM (#28712574)
> _However_ I vehemently oppose his cavalier lack of concern for locales. Internationalization is important. ASCII is just as effective at disempowering others.

I also think internationalization is important, and that ASCII is mostly good at disempowering others. But at the same time I hate the way C locales work. They're a ridiculously terrible way of dealing with the problem, and an endless source of bugs.

And for that matter, what should `isalnum(六)` return? (in case HN mangles that, I put the Japanese "Roku" kanji there, i.e. the numeral 5). I'd say it should return `true` no matter what locale you're set to, since it's a numeral. But glibc returns `false` unless your locale is set to Japanese when `isalnum` is called, and musl returns `false` always. Yet they inconsistently return `true` for `isalnum(5)`, no matter the locale.

Re:What the GNU? by akkartik on Thursday September 30, 2021 @02:39PM (#28709589)
Regarding "genuinely curious": I've seen some real passive-aggressive comments that say that :)

Regarding "asking devs directly": I often find it challenging even to figure out where to ask. Going from a program to its package, dealing with interactions between packages, etc. All of which goes back to simplicity as a core goal. "Good reasons for complexity" isn't sufficient, IMO. Complexity requires having a place to explain the reasons, and making it easy for people to find the place. Considering that we're all volunteers when it comes to open source and this sort of documentation is difficult, I'd often rather err on the side of not having a feature rather than having a more complex feature.

On the other hand, there are fields like internationalization or power management on laptops that are irreducibly complex. Not sure where I'm going with all this. Open source today serves businesses more than people, IMO. But it also serves people indirectly through businesses. This is a difficult topic. Your comment made it seem like there's an easy thing Drew or I could do. I'm not sure that's the case.

Re:What the GNU? by marcodiego on Thursday September 30, 2021 @03:48PM (#28710493)
Agree.
Re:What the GNU? by akkartik on Thursday September 30, 2021 @02:54PM (#28709827)
I couldn't stop thinking about this link. Here's a stronger statement of the problems I see with the GNU guidelines: https://merveilles.town/@akkartik/107022123346940723
Re:What the GNU? by dfox on Thursday September 30, 2021 @11:18AM (#28707352)
The selling point of various GNU userland tools and libraries in the 80's was better performance, removal of obscure bugs and limitations and then maybe some useful extensions.

Case in point is that most people have no idea of how POSIX defines "text file" (ie. ends with \n, no line is longer than LINE_MAX), and what happens when you inout something that technically is not text file into POSIX utility that expects text file is undefined. GNU tools do something sensible or at least produce an meaningful error message, traditional Unix userspace usually does not (lines get truncated, last line sillently ignored, some buffer somewhere overflows and in better case you get SIGSEGV...).

Re:What the GNU? by ivanbakel on Thursday September 30, 2021 @10:47AM (#28706936)
GNU yes is elaborate and fast because Unix's yes is conceptually simple[0]: the HN link the GP shared cover how GNU programs were made to deliberately differ from Unix versions to avoid copyright issues.

[0]: https://www.gnu.org/prep/standards/standards.html#Reading-No...

Re:What the GNU? by pwdisswordfish0 on Thursday September 30, 2021 @10:54AM (#28707035)
I'm curious as well. On the other hand, does it need... whatever it is that GNU yes's decriers are after? The choice to focus on /usr/bin/yes as a case study is at least as bad as the GNU advocates' retort ("GNU yes is 10GiB/s fast").
Re:What the GNU? by XorNot on Thursday September 30, 2021 @11:19AM (#28707367)
When I ask for a very simple command to do something, I expect it to be the best possible implementation of that command. `grep` is pretty close to absolutely optimum (ripgrep can beat it, sometimes, maybe).

I don't see why the standard for composable utilities should allow for inefficiency.

Re:What the GNU? by pwdisswordfish0 on Thursday September 30, 2021 @11:44AM (#28707662)
Wrong thread? How is this a response to the previous comment? Arguing that you want /usr/bin/yes to "be the best possible implementation" in terms of efficiency is a weird way of being in "violent agreement" (more like "aggressive agreement", but whatever). If writing a defensive response, you should actually defend the thing on the other side. Namely, the response here should defend the position that it's more important for yes to be simple than it needs to be efficient. That's what the previous comment challenges potential respondents to come up with.
Re:What the GNU? by XorNot on Thursday September 30, 2021 @12:39PM (#28708295)
You don't take a position. That's my point. What is wrong with yes being capable of doing 10Gib/S? Nothing. It's optimum for a utility which has that sole function.

It's not a bad retort, it's the end of the story: there is a superior utility, it's implemented.

Re:What the GNU? by pwdisswordfish0 on Thursday September 30, 2021 @02:28PM (#28709478)
You're either still misreading and believing that you're arguing against a position that is at odds with yours, or you know it's not at odds but have weird ideas about how argument works.

My position is: either articulate an argument for why it's bad for /usr/bin/yes to be implemented the way GNU yes is implemented or drop the argument entirely.

Your comments manage to be in disagreement with those on the other side of this, and yet still adopt an argumentative/defensive tone with respect to what I've written. I consider this to be an even bigger waste of time than the people (like OP) who are upset about GNU yes's implementation.

Re:What the GNU? by XorNot on Friday October 01, 2021 @01:07AM (#28714790)
And I quote:

> as bad as the GNU advocates' retort ("GNU yes is 10GiB/s fast").

If you don't want to defend your position, don't take it.

Re:What the GNU? by pwdisswordfish0 on Tuesday October 05, 2021 @08:28AM (#28758454)
I can defend my position—which is and always has been from the beginning of this (annoying) argument that anyone who says that GNU yes's implementation is bad—or that "10GiB/s" is pointless feature for something like /usr/bin/yes—needs to be able to defend the decision to scrutinize "something like /usr/bin/yes" in the first place. For whatever dumb reason, you think it's a good idea to argue about this, even while apparently believing yourself that the way GNU yes is implemented is a good thing. This makes no sense.

(Are you under the impression that "X is at least as bad as Y" is the same thing as saying "Y is bad"—and that that means I need to defend the position that Y is bad? It doesn't. Maybe learn to read English better, especially before leaping so confidently into trying to argue with someone over what you're reading. Another bonus tip: not only is it important to read in complete sentences, but it's important to write in complete sentences, too, and to make sure that the sentences follow logically one after the other.)

Re:What the GNU? by sbierwagen on Thursday September 30, 2021 @07:53PM (#28712711)
Yes.
Re:What the GNU? by m463 on Thursday September 30, 2021 @01:45PM (#28709004)
The root of all evil is premature optimization. Until yes performance is the bottleneck for some problem, leave it alone.
Re:What the GNU? by tlamponi on Friday October 01, 2021 @05:18AM (#28716240)
Premature optimization is mostly an issue if I want to build a big machine and spent the first weeks on optimize and polish a tiny, not too relevant cog.

But `yes` isn't such a thing, it's a standalone tool. Here the UNIX philosophy "Write programs that do one thing and do it well" comes rather at play.

Further, the optimizations it makes are not really complicated nor expensive to maintain. A page aligned buffer twice the most common page size is standard for basically everything where something is written or memory moves around.

One certainly can argue that it is Ok doing it more simply as it still is more than fast enough for the common use case. But arguing that a bread and butter optimization, namely one that adds just a few dozen lines of code total while increase throughput by three orders of magnitudes, should not be made, or that it even points to a complexity problem, is not holding any ground IMO.