Unlucky Linux boxes trampled by NPM code update, patch zapped
Devs stumble into pre-release beta by using command they didn't understand
The release of npm 5.7.0 on Wednesday – under the company's pre-release
next distribution tag rather than its
latest distribution tag – prompted reports of server crashes, application failures, and other undesirable behavior for users of some Linux distributions.
The issue was not particularly widespread. To be affected, NPM told The Register, users had to download the software using the
npm update npm -g command rather than the more common
npm install npm -g command.
About 4,000 individuals, or 0.6 per cent of installs, did so during the 21 hours or so that the subpar update was available.
And then those affected had to be running one of several Linux distributions and had to execute the update command with
sudo, a significantly smaller subset of the susceptible group.
Nonetheless, a GitHub Issues post highlighting the mayhem made it sound like a disaster.
Developer Jared Tiala kicked the discussion off by noting the issue "seems to have completely broken my filesystem permissions and caused me to have to manually fix the permissions of critical files and folders."
Tiala pegged the problem to running the
sudo command as a non-root user.
NPM via Twitter acknowledged the issue, noting, "We’ve reverted a patch that could cause ownership changes on some system files."
In its Thursday blog post, the code biz explained, "The original patch was added to increase consistency and reliability of methods
npm uses to avoid writing files as root in places it shouldn't, but the change was applied in places that should have used regular
mkdirp. This release reverts that patch."
In a phone interview with The Register, Laurie Voss, COO and cofounder of NPM, explained the intent with the withdrawn revision was to make
npm handle permissions in a safer way by moving away from
mkdirp. But, he said, doing so across the entire code base turned out to be not always appropriate.
mkdirp is a Node.js version of the Unix
mkdir command, which, with the
-p flag, creates new directories and necessary parent directories that may not yet exist.
The Oakland-based company insists only those participating in its staggered release system would receive code with the distribution tag "next," which is intended to prevent bugs like this from affecting everyone.
Bugs of this sort might be expected from pre-release code but some users of the software contend they were unaware the release was unstable. Allegedly, email notifications went out about the update without making it adequately clear that the release wasn't cleared for public consumption.
In the litany of complaints littering the GitHub Issues thread, doubts about the consistency of NPM's distribution mechanism abound. There's also a fair amount of blaming those affected for not knowing better.
Voss said that while users should not be blamed, there is a misunderstanding of how
npm update differs from
"NPM intends to change the behavior of
npm update in global mode to be less confusing to users," said Voss. "It’s absolutely true that the behavior of
update -g is poorly understood." ®