diff options
author | isaacs <i@izs.me> | 2014-06-11 02:56:35 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-06-11 02:56:35 +0400 |
commit | 43801b830b9a68bcc51228d2d4403542e0657ee0 (patch) | |
tree | 47035b897b6c3dd9e9f9a5789ac112402af66b36 /node_modules/graceful-fs | |
parent | a696e48a3253be828d8806eb3b5ab0d310ce2e0c (diff) |
graceful-fs@3.0.2
Diffstat (limited to 'node_modules/graceful-fs')
-rw-r--r-- | node_modules/graceful-fs/fs.js | 8 | ||||
-rw-r--r-- | node_modules/graceful-fs/package.json | 18 | ||||
-rw-r--r-- | node_modules/graceful-fs/polyfills.js | 43 |
3 files changed, 51 insertions, 18 deletions
diff --git a/node_modules/graceful-fs/fs.js b/node_modules/graceful-fs/fs.js index d69d463b2..ae9fd6f61 100644 --- a/node_modules/graceful-fs/fs.js +++ b/node_modules/graceful-fs/fs.js @@ -2,4 +2,10 @@ // more evil than monkey-patching the native builtin? // Not sure. -eval(process.binding('natives').fs) +var mod = require("module") +var pre = '(function (exports, require, module, __filename, __dirname) { ' +var post = '});' +var src = pre + process.binding('natives').fs + post +var vm = require('vm') +var fn = vm.runInThisContext(src) +return fn(exports, require, module, __filename, __dirname) diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json index 4b3460aa6..a77f90c7d 100644 --- a/node_modules/graceful-fs/package.json +++ b/node_modules/graceful-fs/package.json @@ -6,7 +6,7 @@ }, "name": "graceful-fs", "description": "A drop-in replacement for fs, making various improvements.", - "version": "3.0.0", + "version": "3.0.2", "repository": { "type": "git", "url": "git://github.com/isaacs/node-graceful-fs.git" @@ -38,15 +38,15 @@ "EACCESS" ], "license": "BSD", - "gitHead": "cc05f35cf7fadb0d93587484cd0d01875537834a", + "gitHead": "0caa11544c0c9001db78bf593cf0c5805d149a41", "bugs": { "url": "https://github.com/isaacs/node-graceful-fs/issues" }, "homepage": "https://github.com/isaacs/node-graceful-fs", - "_id": "graceful-fs@3.0.0", - "_shasum": "5792ffae0ed7e318060ebf9f6e7a6e6cf5139327", - "_from": "graceful-fs@latest", - "_npmVersion": "1.4.13", + "_id": "graceful-fs@3.0.2", + "_shasum": "2cb5bf7f742bea8ad47c754caeee032b7e71a577", + "_from": "graceful-fs@~3.0.0", + "_npmVersion": "1.4.14", "_npmUser": { "name": "isaacs", "email": "i@izs.me" @@ -58,8 +58,8 @@ } ], "dist": { - "shasum": "5792ffae0ed7e318060ebf9f6e7a6e6cf5139327", - "tarball": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.0.tgz" + "shasum": "2cb5bf7f742bea8ad47c754caeee032b7e71a577", + "tarball": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.2.tgz" }, - "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.0.tgz" + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.2.tgz" } diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js index 05870c39c..9d62af586 100644 --- a/node_modules/graceful-fs/polyfills.js +++ b/node_modules/graceful-fs/polyfills.js @@ -116,15 +116,25 @@ if (!fs.lutimes) { // https://github.com/isaacs/node-graceful-fs/issues/4 // Chown should not fail on einval or eperm if non-root. +// It should not fail on enosys ever, as this just indicates +// that a fs doesn't support the intended operation. fs.chown = chownFix(fs.chown) fs.fchown = chownFix(fs.fchown) fs.lchown = chownFix(fs.lchown) +fs.chmod = chownFix(fs.chmod) +fs.fchmod = chownFix(fs.fchmod) +fs.lchmod = chownFix(fs.lchmod) + fs.chownSync = chownFixSync(fs.chownSync) fs.fchownSync = chownFixSync(fs.fchownSync) fs.lchownSync = chownFixSync(fs.lchownSync) +fs.chmodSync = chownFix(fs.chmodSync) +fs.fchmodSync = chownFix(fs.fchmodSync) +fs.lchmodSync = chownFix(fs.lchmodSync) + function chownFix (orig) { if (!orig) return orig return function (target, uid, gid, cb) { @@ -146,15 +156,32 @@ function chownFixSync (orig) { } } +// ENOSYS means that the fs doesn't support the op. Just ignore +// that, because it doesn't matter. +// +// 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. 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 + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false } |