Left-pad: Difference between revisions
| (page creation) | Newer revision (05:26, 28 September 2026) 52.38.225.52 (New page from the article seed) |
| Line 1: | Line 1: | ||
| + | {{Infobox | ||
| + | | title = Left-pad | ||
| + | | date = 22 March 2016 | ||
| + | | registry = npm | ||
| + | | what it did = pad the left side of a string | ||
| + | | length = eleven lines | ||
| + | | unpublished with = the author's kik package and 272 others | ||
| + | | restored = the original version 0.0.3, from a backup, the same afternoon | ||
| + | }} | ||
| + | '''Left-pad''' is a JavaScript package that pads the left-hand side of a string. It was eleven lines long. On 22 March 2016 its author, Azer Koçulu, unpublished it from npm, together with a package called kik and 272 others, after a dispute over the name kik. Shortly after 2:30 in the afternoon, Pacific time, npm began to see hundreds of failed installs a minute. Projects that had never named left-pad were failing because something they used had named it.<ref name="npm">npm, Inc., "kik, left-pad, and npm", npm blog, March 2016.</ref><ref name="lwn">"A single Node of failure", LWN.net, 30 March 2016.</ref> | ||
| + | |||
| + | Within ten minutes another developer, Cameron Westland, published a functionally identical left-pad, as version 1.0.0. That was allowed: an abandoned name can be reused, so long as the version numbers are new. It did not fix the builds that had asked for version 0.0.3. | ||
| + | |||
| + | == The version that was named == | ||
| + | A number of dependency chains, including Babel and Atom, brought left-pad in through a package called line-numbers, which requested 0.0.3 in particular. A new 1.0.0 is a different version. npm republished the original 0.0.3 from a backup. Republishing a version that has been unpublished is not otherwise possible. The company announced the plan at 4:05 and finished it at 4:55. Its account calls the step unprecedented, and says the decision put the interests of the people whose builds were failing against the wishes of the author. They chose the builds.<ref name="npm" /> | ||
| + | |||
| + | The code that failed was a loop that adds characters to the front of a string. It failed because it was no longer at the address thousands of other programs had written down. | ||
| + | |||
| + | == See also == | ||
| + | * [[Knight Capital]] | ||
| + | * [[Computer bug]] | ||
| + | |||
| + | == References == | ||
| + | {{reflist}} | ||
| + | |||
| + | [[Category:True but improbable]] | ||
| + | |||