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.[1][2]
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[edit]
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.[1]
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.