Linux Drops strncpy After Six Years and 360 Patches
*Kernel maintainers remove the legacy string-copy function in the 7.2 release following a long replacement campaign.*
Linux 7.2 eliminates the strncpy API. The change closes a six-year effort that produced 360 patches to excise the function from the kernel tree.
The removal appears in the mainline tree tracked at git.kernel.org. Maintainers had spent years locating every call site, rewriting the affected code, and verifying that replacements handled buffer termination correctly. The work touched drivers, filesystems, and core libraries that once relied on the older interface.
Hacker News users tracked the patch series with 151 points and 122 comments. Discussion centered on the difficulty of auditing string handling across decades of C code rather than on any single remaining use.
Why it matters
Kernel developers have long treated strncpy as a source of subtle bugs because it does not guarantee null termination. Removing the function forces every new contribution to use safer alternatives from the start. The cleanup reduces future maintenance cost even if it offers no immediate performance gain.
The 360-patch count shows how much scattered code can accumulate around a single deprecated API. Future removals of other legacy interfaces will likely follow the same pattern of gradual replacement before final deletion.
---
Sources:
{
"excerpt": "Linux 7.2 removes the strncpy API after six years of work and 360 patches to replace every call site.",
"suggestedSection": "software",
"suggestedTags": ["linux", "kernel", "strncpy"],
"imagePrompt": "Abstract view of scattered code fragments being pulled from an old ledger and stacked into a neat archive box on a wooden table, soft window light from the side, muted color palette, cinematic lighting, 16:9."
}
No comments yet