How curl was accidentally Turing-complete for nine months
From version 8.12 to 8.16, curl's configuration files had the ability to slice variable values and include other configuration files without any specific depth limit. This functionality enabled curl to mimic the operation of any two-counter Minsky program. In an ideal scenario where strings and resources are unbounded, such construction would be considered Turing-complete.
With the release of curl version 8.17.0, a five-level limit on includes was introduced, effectively breaking this reduction. A counter value n is represented by n copies of x. Each instruction state utilizes one or more config files, with file names serving as labels, and expand-config determining the next file to be used. These components can be combined to compile any two-counter program into curl configuration files.
Four files contained within the curl_addition.zip archive calculate the sum of 2 and 3. This reduction assumes the presence of unbounded counters and unbounded steps. However, the actual binary version of curl lacks both of these features. The pull request for this change suggests that the cap is intended to prevent a config file from including itself indefinitely.
The accompanying regression test implements this functionality and expects an error to be thrown. The public explanation of this update does not address the topic of Turing completeness or the reasoning behind the five-level cap. To complement the bounded capabilities of curl, a Bash while loop can be used in conjunction with curl.
The loop can invoke a config file once per step, carrying the counters and instruction labels between invocations. This repetition is achieved through Bash, resulting in a composition rather than true Turing completeness within curl itself.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.