Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!jmertens.eternal-september.org!.POSTED!not-for-mail From: Joerg Mertens Newsgroups: comp.misc Subject: Re: strlcpy and how CPUs can defy common sense Date: Sun, 28 Jul 2024 11:42:29 +0200 Organization: A noiseless patient Spider Lines: 49 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 28 Jul 2024 11:42:36 +0200 (CEST) Injection-Info: jmertens.eternal-september.org; posting-host="414235435f258140e15466b87bfb5a84"; logging-data="4085148"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+tOOdJA4OEoGmzoh/5EPPgowJBCGph+n0=" User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (OpenBSD/7.5 (amd64)) tinews.pl/1.1.61 Cancel-Lock: sha1:x/5ddwGZNBIs1Rbun8huvQVxtdY= Bytes: 2981 Lawrence D'Oliveiro wrote: > On Sat, 27 Jul 2024 19:58:06 -0000 (UTC), John McCue wrote: > >> Lawrence D'Oliveiro wrote: >> >>> On Fri, 26 Jul 2024 15:36:17 -0000 (UTC), Ben Collver wrote: >>> >>>> The situation only gets worse for the openbsd version here, not >>>> better. >>> >>> Not the only time the GNU folks have done something smarter than the >>> BSD folks. >> >> I do not understand this statement in regards to true(1). >> >>> >> >> This is interesting >> >>> >> >> How is GNU's version of true better than OpenBSD's ? >> See page 2 in the articke. > > You have to put the two together to realize how hilariously wrong the > “Register” article is. The OpenBSD version of “true” may seem concise and > elegant, until you notice that it requires the loading of an entirely new > shell instance to run each time. > > Whereas the GNU version, with its much longer source code entirely in C, > loads faster and runs in less memory. Which was one of the points made in > the first article. At least Theo de Raadt agrees with you in this commit message from about eight years ago¹: ----- Switch back to C versions of true/false. I do not accept any of the arguments made 20 years ago. A small elf binary is smaller and faster than a large elf binary running a script. Noone cares about the file sizes on disk. ----- The interesting word is `back´, which means, they already had had a C version in earlier days and then at some point had switched to a script. Someone would have to go through CVS history to find the reason why. 1) https://cvsweb.openbsd.org/src/usr.bin/true/true.c