Permalink
Browse files

Closes GH-622 (I hope) Don't untar as nobody.

Since it has to walk the dir chown/chmod'ing anyway, untarring with a
specific uid/gid is largely unnecessary, and only causes problems.
  • Loading branch information...
isaacs committed Feb 22, 2011
1 parent 3024e96 commit e7e5292fa7aa8e06bc69aec261daaa6c7aaab27f
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/cache.js
View
@@ -410,18 +410,22 @@ function unpackTar (tarball, unpackTarget, dMode, fMode, uid, gid, cb) {
function unpackTar_ ( tarball, unpackTarget, dMode, fMode, uid, gid, cb ) {
mkdir(unpackTarget, dMode || DMODE, uid, gid, function (er) {
+ log.verbose([uid, gid], "unpackTar_ uid, gid")
if (er) return log.er(cb, "Could not create "+unpackTarget)(er)
// cp the gzip of the tarball, pipe the stdout into tar's stdin
// gzip {tarball} --decompress --stdout | tar xf - --strip-components=1 -C {unpackTarget}
pipe( spawn( npm.config.get("gzipbin")
, ["--decompress", "--stdout", tarball]
- , process.env, false, null, uid, gid )
+ , process.env, false )
, spawn( npm.config.get("tar")
, ["-mvxpf", "-", "-C", unpackTarget]
- , process.env, false, null, uid, gid )
+ , process.env, false )
, function (er) {
+ // if we're not doing ownership management,
+ // then we're done now.
if (er) return log.er(cb,
"Failed unpacking "+tarball+" to "+unpackTarget)(er)
+ if (npm.config.get("unsafe-perm")) return cb(er)
find(unpackTarget, function (f) {
return f !== unpackTarget
}, function (er, files) {

0 comments on commit e7e5292

Please sign in to comment.