diff options
author | isaacs <i@izs.me> | 2012-01-27 13:12:07 -0800 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-01-27 13:12:07 -0800 |
commit | f98999cc166918807aa8e06c26c5a15e4e353df5 (patch) | |
tree | 50763b04591094487405a3431e2983e384502d90 | |
parent | ff0f0aeb401765646fefd9bbdc0f2a68d1ad342c (diff) | |
download | node-new-f98999cc166918807aa8e06c26c5a15e4e353df5.tar.gz |
Properly update npm to 1.1.0-3
Thanks @mscdex for spotting this.
-rw-r--r-- | deps/npm/lib/install.js | 9 | ||||
-rw-r--r-- | deps/npm/node_modules/graceful-fs/graceful-fs.js | 44 | ||||
-rw-r--r-- | deps/npm/node_modules/graceful-fs/package.json | 4 |
3 files changed, 52 insertions, 5 deletions
diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index 1fb6dc30c0..211a6612ed 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -75,12 +75,15 @@ function install (args, cb_) { output = output || require("./utils/output.js") var tree = treeify(installed) - , pretty = prettify(tree, installed) + , pretty = prettify(tree, installed).trim() - output.write(pretty, function (er) { + if (pretty) output.write(pretty, afterWrite) + else afterWrite() + + function afterWrite (er) { if (er) return cb_(er) save(where, installed, tree, pretty, cb_) - }) + } } // the /path/to/node_modules/.. diff --git a/deps/npm/node_modules/graceful-fs/graceful-fs.js b/deps/npm/node_modules/graceful-fs/graceful-fs.js index 7467f304a2..8081047686 100644 --- a/deps/npm/node_modules/graceful-fs/graceful-fs.js +++ b/deps/npm/node_modules/graceful-fs/graceful-fs.js @@ -210,3 +210,47 @@ if (!fs.lutimes) { fs.lutimesSync = function () {} } } + + +// https://github.com/isaacs/node-graceful-fs/issues/4 +// Chown should not fail on einval or eperm if non-root. + +fs.chown = chownFix(fs.chown) +fs.fchown = chownFix(fs.fchown) +fs.lchown = chownFix(fs.lchown) + +fs.chownSync = chownFixSync(fs.chownSync) +fs.fchownSync = chownFixSync(fs.fchownSync) +fs.lchownSync = chownFixSync(fs.lchownSync) + +function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er, res) { + if (chownErOk(er)) er = null + cb(er, res) + }) + } +} + +function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } +} + +function chownErOk (er) { + // if there's no getuid, or if getuid() is something other than 0, + // and the error is EINVAL or EPERM, then just ignore it. + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // When running as root, or if other types of errors are encountered, + // then it's strict. + if (!er || (!process.getuid || process.getuid() !== 0) + && (er.code === "EINVAL" || er.code === "EPERM")) return true +} diff --git a/deps/npm/node_modules/graceful-fs/package.json b/deps/npm/node_modules/graceful-fs/package.json index ec72affa13..98fc7797a0 100644 --- a/deps/npm/node_modules/graceful-fs/package.json +++ b/deps/npm/node_modules/graceful-fs/package.json @@ -2,14 +2,14 @@ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)", "name": "graceful-fs", "description": "fs monkey-patching to avoid EMFILE and other problems", - "version": "1.1.2", + "version": "1.1.5", "repository": { "type": "git", "url": "git://github.com/isaacs/node-graceful-fs.git" }, "main": "graceful-fs.js", "engines": { - "node": "0.4 || 0.5 || 0.6" + "node": ">=0.4.0" }, "dependencies": { "fast-list": "1" |