[KongchangAI]
· 2 min read· 1,210 words

AI Rewrites curl: 185K Lines of C to 340K Lines of Rust, and the Original Author Nails the Point in One Sentence

AI Rewrites curl: 185K Lines of C to 340K Lines of Rust, and the Original Author Nails the Point in One Sentence

AI generates 340K lines of Rust clone in three weeks, while curl mainline fixes 200+ bugs—rewriting can't replace maintenance.

The article compares a "vibe-porting" experiment: an agent converted 185K lines of C to 340K lines of Rust in just over three weeks, while the real curl project merged 300+ commits and fixed 200+ bugs in the same window. It argues rewriting and maintenance are different—curl's value lives in commit history, issues, and regression tests, which AI clones can't sustain. Vibe-porting suits stalled or one-off code, not active infrastructure.

A "Vibe-Porting" Experiment: Code Volume Doubles, but curl Itself Never Stopped

According to a blog post by Simon Willison citing curl author Daniel Stenberg, an agent "converted" 185,000 lines of C code into 340,000 lines of Rust code. Stenberg specifically noted that he counted this himself. During the same period, the real curl project merged over 300 commits, fixed over 200 bugs, and patched several security vulnerabilities.

rss source: Quoting Daniel Stenberg

The sharp edge of this comparison isn't about whether Rust is good or bad, but a more fundamental question: AI-generated "rewrites" may be functionally runnable, but they cannot inherit the ability of the upstream project to continuously evolve. Stenberg's exact words were: how are these clone versions going to keep up?

Stenberg's Accounting: Three Weeks, 200 Fixes

Stenberg's phrasing is restrained—he doesn't directly dismiss AI rewrites, but places the outputs of both sides side by side. The agent produced 340,000 lines of Rust in "a little over three weeks"; in the same three-plus weeks, the curl mainline merged over 300 commits, 200+ bugfixes, plus several security fixes. Another month later, the mainline had completed another 200 fixes, and possibly patched more vulnerabilities.

The reason this comparison is persuasive is that it's not comparing "how fast code was written" but "how accurately fixes were made." Bugfixes and CVE fixes are the hardest part of maintenance work—they come from real user reports, fuzzing, edge-case reproductions, and cannot be generated in bulk just by reading source code.

CVE (Common Vulnerabilities and Exposures) is a standardized dictionary that assigns unique identifiers to publicly known information security vulnerabilities. When curl patches "several security vulnerabilities," the relevant entries are typically assigned CVE numbers, making it easier for users, distributions, and security tools to track them. The key difference between CVE fixes and ordinary bugfixes is that they often involve edge cases in protocol parsing, memory safety, or authentication bypass, require coordinated disclosure timelines, and are verified by the security community after the fix. Therefore, the number and speed of CVE fixes are hard indicators of a infrastructure project's maintenance activity, and also the part that AI clones find hardest to inherit automatically—clones have no corresponding vulnerability reporting channel or disclosure process.

Rewriting and Maintenance Are Two Different Things

Many people understand AI rewriting as "translating language A into language B," but in a software lifecycle, translation only occupies a small opening segment. The value of a widely depended-upon network library lies in its handling of protocol boundaries, its compromises for historical compatibility, and its response speed to security issues. This knowledge is largely sedimented in commit history, issue discussions, and regression tests, not in the literal semantics of the source code.

340,000 lines of Rust versus 185,000 lines of C—nearly double the code volume—itself shows that "line-by-line translation" is not feasible: Rust's ownership model, error handling, and FFI boundaries all need to be redesigned. What AI is doing is actually reimplementation, not translation. Reimplementation means reintroducing bugs, and also means going through all the pitfalls curl has stumbled into over the years.

FFI (Foreign Function Interface) refers to a mechanism by which one programming language calls functions written in another language or uses its data structures. In systems programming, FFI is often used to let a new language (such as Rust) reuse mature C libraries, or to embed another language's runtime in a C program. The FFI boundary is tricky because it must handle differences between the two languages in memory management, error representation, calling conventions, and data type layout. For example, Rust's ownership and borrow checking become ineffective across the FFI boundary, and developers must manually ensure pointer lifetime safety; error codes on the C side also need to be explicitly converted into Rust's Result type. Therefore, when migrating C code to Rust, even if you are just "wrapping" the original implementation, the FFI layer needs careful design and cannot be automatically generated by line-by-line translation.

Regression Testing is the practice of re-running existing test suites after modifying code to confirm that new changes have not broken existing functionality. For long-maintained infrastructure projects like curl, regression testing is a key barrier against introducing another bug while fixing one. curl's test suite contains thousands of test cases targeting protocol behavior, command-line options, and edge conditions, and every commit is run across multiple platforms and build configurations. The value of regression testing lies not only in validating current code, but also in solidifying past pitfalls into executable checks—this is the meaning of "knowledge sedimented in tests." If an AI rewrite lacks regression tests of equivalent scale and specificity, even if it compiles, it is hard to guarantee behavioral equivalence.

The Applicable Boundaries of "Vibe-Porting"

Simon Willison labels this kind of practice "vibe-porting." What scenarios is it suitable for? Those where maintenance has stalled, upstream is no longer managed, or the tool is only for internal one-off use. Quickly moving such code to a new language with AI saves real manpower.

But it is not suitable for an infrastructure project that merges commits every week and fixes vulnerabilities every month. For a component like curl that is embedded in countless systems, a Rust clone that compiles and passes basic tests is a completely different thing from a Rust clone that can continuously absorb security fixes. The former is a demo; the latter requires a team to follow upstream long-term.

A Reminder for AI Coding Tools

The most valuable part of this quote is that it provides a reusable evaluation framework: don't just look at how much code AI generated; look at how much "hard work" the human-maintained mainline completed in the same time window. Lines of code are output; bugfixes and security responses are value—the two are not interchangeable.

For teams using coding agents for migration, a pragmatic approach is to factor "upstream follow-up cost" into the project budget: if upstream is still active, then the rewritten version must either establish a continuous synchronization mechanism or accept that it will quickly fall behind. Stenberg's line "how are these clone versions going to keep up" is essentially asking this question, and he most likely knows the answer.

One-line Summary

AI generated 340K lines of Rust clone in three weeks, while the curl mainline fixed over 200 bugs in the same period, revealing that rewriting cannot replace maintenance.

Paragraph Summary

The article draws on curl author Daniel Stenberg's observation to compare a "vibe-porting" experiment: an agent converted 185K lines of C code into 340K lines of Rust in a little over three weeks, while in the same time window, the real curl project merged over 300 commits, fixed over 200 bugs, and patched security vulnerabilities. The author points out that the near-doubling of code volume shows this is more reimplementation than line-by-line translation, and that rewriting and maintenance are two different things—curl's value is sedimented in commit history, issue discussions, and regression tests, and AI clones struggle to continuously follow upstream bugfixes and security responses. The article argues that "vibe-porting" suits stalled or one-off code but not actively maintained infrastructure projects, and suggests teams factor "upstream follow-up cost" into budgets and evaluate AI output by the amount of hard work completed rather than lines of code.

rss source: Quoting Daniel Stenberg

#AI code rewrite#curl Rust rewrite#Daniel Stenberg#vibe-porting#software maintenance#regression testing#CVE fixes
Share:

Related articles