Live data from Hacker News

Linux eliminates the strncpy API after six years of work, 360 patches

phoronix.com

271–280 of 340 posts

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#271
post #209

Earlier quoted context omitted.

No, it was an Apple, Unix, and Microsoft problem. Unix used LF, Apple used CR, Microsoft used CRLF. They are all ASCII carriage movement codes, which is about driving the paper feed and print head of an ASR-33 or equivalent. So they all made the "wrong" decision about what to store in a file. They just chose different wrong characters.

> Apple used CR Apple hasn't been using CR since the release of OSX (26 years ago). Microsoft could have made the switch at any time too (just as they could have switched to UTF-8 as universal text encoding on Windows), they just choose not to. In the end it's not the job of programming languages to clean up Microsoft's mess ;)

The switch sure sucked though. I doubt Microsoft would risk their reputation for backwards compatibility.

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#272
post #263

Earlier quoted context omitted.

HackerNews is now censoring my replies. I did the math - all of these patches would have cost around $100. Let's see if they'll let this account through.

It's like you are not even reading what is being said to you. You can't find the downstream effects using grep! You can find the "strncpy"s with grep, but you cannot find all the downstream effect of those changes, especially if something downstream is relying on the broken behaviour!

Right. I am not claiming Claude Code creates perfect software. I am refuting your claim that using it would be cost prohibitive.

I took the 10 most difficult patches from the git history - the ones that took the most back-and-forth to fix. I asked Claude to write them. Would you like to see the work?

If you believe a human performs better at finding downstream effects - you need to prove that. I see no reason why it should be true.

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#273
post #229

> In place of strncpy, Linux kernel code should use strscpy() for NUL terminated destinations, strscpy_pad() for NUl-terminated destinations with zero-padding, strtomem_pad() for non-NUL-terminated fixed-width fields, memcpy_and_pad() for bounded copies with explicit padding, or memcpy() for known-length memory copies What a nightmare, does it have to be so convoluted?

> does it have to be so convoluted?

Getting strncpy right always has been

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#274

the zero terminated string is I think is computing's biggest mistake. Pascal style strings were much safer.

Partly agree but there would have been squabbling on the data type of the size, unless it was variable length. The latter would have had other issues too. For a while, 16bit would probably have seemed too extravagant. Now 32bit would probably seem too small. For a “strongly typed” language, C is pretty damn loose where would have mattered.

[deleted]

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#275
post #209

Earlier quoted context omitted.

> non UTF-8 encoded strings on input/output UTF-8 on stdin/stdout works perfectly fine (unless you are on Windows of course, which is stuck in in the early 90s when it comes to international text encoding). > Using LF or CR or CRLF as line terminators This is also an operating system convention, and it would be better if programming languages wouldn't try to "guess" the correct line endings, since this causes more pr…

No, it was an Apple, Unix, and Microsoft problem. Unix used LF, Apple used CR, Microsoft used CRLF. They are all ASCII carriage movement codes, which is about driving the paper feed and print head of an ASR-33 or equivalent. So they all made the "wrong" decision about what to store in a file. They just chose different wrong characters.

> They just chose different wrong characters.

Unix followed Multics. Multics chose right. ASCII/EMCA-6/ISO646 drafts discussed this at least as early as 1963¹: “For equipment which uses a single combination (called New Line) [...] NL will be coded at FE₂ [Field Effector 2 = 0x0A].”

¹ doi/10.1093/comjnl/7.3.197

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#276
post #272

Earlier quoted context omitted.

It's like you are not even reading what is being said to you. You can't find the downstream effects using grep! You can find the "strncpy"s with grep, but you cannot find all the downstream effect of those changes, especially if something downstream is relying on the broken behaviour!

Right. I am not claiming Claude Code creates perfect software. I am refuting your claim that using it would be cost prohibitive. I took the 10 most difficult patches from the git history - the ones that took the most back-and-forth to fix. I asked Claude to write them. Would you like to see the work? If you believe a human performs better at finding downstream effects - you need to prove that. I see no reason why it…

> If you believe a human performs better at finding downstream effects

Once gain, you are not reading what is being said - no one made that claim!

No claim was made in fact: it was a refutation. Specifically, the refutation is "this is why it took so many years".

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#277

wow, very humbling. I'm actually amazed how many people contributed to this. It's easy to get attribution for "cool new features", but arguable removing bad features is even more important for something as fundamental as the kernel. Cudos! I'm sure these are the sorts of things that will go down as folklore from the "founding ages", when everyone will have forgotten how to understand source code in 50 years and the C…

I'm of the opinion AI slop code will become untenable way before that.

I'm of the opinion it already is. But it seems that many people have yet to reach the point of being fed up with it.

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#278

Earlier quoted context omitted.

Borland's PASCAL did it on the IBM PC. And which modern C compiler fits into 64KB? Even TCC needs 100KB. But that's beside the point. No machine of the last 36 (I'll push my chances, 40) years needs to fit a compiler in 64KB.

> Borland's PASCAL did it on the IBM PC. That's famously a single-pass compiler. Rust is famously unable to compile in a single pass. It is not possible to make a borrow-checking language that compiles in a single pass. > No machine of the last 36 (I'll push my chances, 40) years needs to fit a compiler in 64KB. Exactly - that's why C is what it is: it wasn't a mistake, they were working under the constraints of the…

> That's famously a single-pass compiler. Rust is famously unable to compile in a single pass.

I probably should have replied under the other comment. I was also referring to your

> No, I didn't - I asked how sum types were supposed to work in an era of 64KB memory systems.

But context got lost between replies.

> that's why C is what it is

C famously had a big redesign in 1990. The language of today isn't the same K&R printed.

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#279

the zero terminated string is I think is computing's biggest mistake. Pascal style strings were much safer.

Partly agree but there would have been squabbling on the data type of the size, unless it was variable length. The latter would have had other issues too. For a while, 16bit would probably have seemed too extravagant. Now 32bit would probably seem too small. For a “strongly typed” language, C is pretty damn loose where would have mattered.

I don't think 32 bits for the size would be too small. That would max out at a 4GB string, which is large enough that even today it's a big red flag saying "what are you doing bro, reconsider your approach". I can conceive of a string larger than 4GB, but I can't conceive of a situation where it's reasonable to use one.

Re: Linux eliminates the strncpy API after six years of work, 360 patches

#280
post #95
post #92

Earlier quoted context omitted.

An LLM is not a mechanical automated system. A deterministic search and replace would be a mechanical automated system. Clearly it wasn't that simple of a problem though.

> An LLM is not a mechanical automated system. Pretty sure that's exactly what LLMs in coding harnesses are.

Still not deterministic
Post reply on HN