mirror of
https://github.com/biobulkbende/biobulkbende.org.git
synced 2025-10-11 23:25:00 +00:00
structure, layout and automation
This commit is contained in:
53
node_modules/tar/test/00-setup-fixtures.js
generated
vendored
Normal file
53
node_modules/tar/test/00-setup-fixtures.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
// the fixtures have some weird stuff that is painful
|
||||
// to include directly in the repo for various reasons.
|
||||
//
|
||||
// So, unpack the fixtures with the system tar first.
|
||||
//
|
||||
// This means, of course, that it'll only work if you
|
||||
// already have a tar implementation, and some of them
|
||||
// will not properly unpack the fixtures anyway.
|
||||
//
|
||||
// But, since usually those tests will fail on Windows
|
||||
// and other systems with less capable filesystems anyway,
|
||||
// at least this way we don't cause inconveniences by
|
||||
// merely cloning the repo or installing the package.
|
||||
|
||||
var tap = require("tap")
|
||||
, child_process = require("child_process")
|
||||
, rimraf = require("rimraf")
|
||||
, test = tap.test
|
||||
, path = require("path")
|
||||
|
||||
test("clean fixtures", function (t) {
|
||||
rimraf(path.resolve(__dirname, "fixtures"), function (er) {
|
||||
t.ifError(er, "rimraf ./fixtures/")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test("clean tmp", function (t) {
|
||||
rimraf(path.resolve(__dirname, "tmp"), function (er) {
|
||||
t.ifError(er, "rimraf ./tmp/")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test("extract fixtures", function (t) {
|
||||
var c = child_process.spawn("tar"
|
||||
,["xzvf", "fixtures.tgz"]
|
||||
,{ cwd: __dirname })
|
||||
|
||||
c.stdout.on("data", errwrite)
|
||||
c.stderr.on("data", errwrite)
|
||||
function errwrite (chunk) {
|
||||
process.stderr.write(chunk)
|
||||
}
|
||||
|
||||
c.on("exit", function (code) {
|
||||
t.equal(code, 0, "extract fixtures should exit with 0")
|
||||
if (code) {
|
||||
t.comment("Note, all tests from here on out will fail because of this.")
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
})
|
BIN
node_modules/tar/test/cb-never-called-1.0.1.tgz
generated
vendored
Normal file
BIN
node_modules/tar/test/cb-never-called-1.0.1.tgz
generated
vendored
Normal file
Binary file not shown.
177
node_modules/tar/test/dir-normalization.js
generated
vendored
Normal file
177
node_modules/tar/test/dir-normalization.js
generated
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
// Set the umask, so that it works the same everywhere.
|
||||
process.umask(parseInt('22', 8))
|
||||
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
|
||||
var fstream = require('fstream')
|
||||
var test = require('tap').test
|
||||
|
||||
var tar = require('../tar.js')
|
||||
var file = path.resolve(__dirname, 'dir-normalization.tar')
|
||||
var target = path.resolve(__dirname, 'tmp/dir-normalization-test')
|
||||
var ee = 0
|
||||
|
||||
var expectEntries = [
|
||||
{ path: 'fixtures/',
|
||||
mode: '755',
|
||||
type: '5',
|
||||
linkpath: ''
|
||||
},
|
||||
{ path: 'fixtures/a/',
|
||||
mode: '755',
|
||||
type: '5',
|
||||
linkpath: ''
|
||||
},
|
||||
{ path: 'fixtures/the-chumbler',
|
||||
mode: '755',
|
||||
type: '2',
|
||||
linkpath: path.resolve(target, 'a/b/c/d/the-chumbler'),
|
||||
},
|
||||
{ path: 'fixtures/a/b/',
|
||||
mode: '755',
|
||||
type: '5',
|
||||
linkpath: ''
|
||||
},
|
||||
{ path: 'fixtures/a/x',
|
||||
mode: '644',
|
||||
type: '0',
|
||||
linkpath: ''
|
||||
},
|
||||
{ path: 'fixtures/a/b/c/',
|
||||
mode: '755',
|
||||
type: '5',
|
||||
linkpath: ''
|
||||
},
|
||||
{ path: 'fixtures/a/b/c/y',
|
||||
mode: '755',
|
||||
type: '2',
|
||||
linkpath: '../../x',
|
||||
}
|
||||
]
|
||||
|
||||
var ef = 0
|
||||
var expectFiles = [
|
||||
{ path: '',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 0,
|
||||
linkpath: undefined
|
||||
},
|
||||
{ path: '/fixtures',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 1,
|
||||
linkpath: undefined
|
||||
},
|
||||
{ path: '/fixtures/a',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 2,
|
||||
linkpath: undefined
|
||||
},
|
||||
{ path: '/fixtures/a/b',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 3,
|
||||
linkpath: undefined
|
||||
},
|
||||
{ path: '/fixtures/a/b/c',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 4,
|
||||
linkpath: undefined
|
||||
},
|
||||
{ path: '/fixtures/a/b/c/y',
|
||||
mode: '120755',
|
||||
type: 'SymbolicLink',
|
||||
depth: 5,
|
||||
linkpath: '../../x'
|
||||
},
|
||||
{ path: '/fixtures/a/x',
|
||||
mode: '100644',
|
||||
type: 'File',
|
||||
depth: 3,
|
||||
linkpath: undefined
|
||||
},
|
||||
{ path: '/fixtures/the-chumbler',
|
||||
mode: '120755',
|
||||
type: 'SymbolicLink',
|
||||
depth: 2,
|
||||
linkpath: path.resolve(target, 'a/b/c/d/the-chumbler')
|
||||
}
|
||||
]
|
||||
|
||||
test('preclean', function (t) {
|
||||
require('rimraf').sync(path.join(__dirname, '/tmp/dir-normalization-test'))
|
||||
t.pass('cleaned!')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('extract test', function (t) {
|
||||
var extract = tar.Extract(target)
|
||||
var inp = fs.createReadStream(file)
|
||||
|
||||
inp.pipe(extract)
|
||||
|
||||
extract.on('end', function () {
|
||||
t.equal(ee, expectEntries.length, 'should see ' + expectEntries.length + ' entries')
|
||||
|
||||
// should get no more entries after end
|
||||
extract.removeAllListeners('entry')
|
||||
extract.on('entry', function (e) {
|
||||
t.fail('Should not get entries after end!')
|
||||
})
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
extract.on('entry', function (entry) {
|
||||
var mode = entry.props.mode & (~parseInt('22', 8))
|
||||
var found = {
|
||||
path: entry.path,
|
||||
mode: mode.toString(8),
|
||||
type: entry.props.type,
|
||||
linkpath: entry.props.linkpath,
|
||||
}
|
||||
|
||||
var wanted = expectEntries[ee++]
|
||||
t.equivalent(found, wanted, 'tar entry ' + ee + ' ' + (wanted && wanted.path))
|
||||
})
|
||||
|
||||
function next () {
|
||||
var r = fstream.Reader({
|
||||
path: target,
|
||||
type: 'Directory',
|
||||
sort: 'alpha'
|
||||
})
|
||||
|
||||
r.on('ready', function () {
|
||||
foundEntry(r)
|
||||
})
|
||||
|
||||
r.on('end', finish)
|
||||
|
||||
function foundEntry (entry) {
|
||||
var p = entry.path.substr(target.length)
|
||||
var mode = entry.props.mode & (~parseInt('22', 8))
|
||||
var found = {
|
||||
path: p,
|
||||
mode: mode.toString(8),
|
||||
type: entry.props.type,
|
||||
depth: entry.props.depth,
|
||||
linkpath: entry.props.linkpath
|
||||
}
|
||||
|
||||
var wanted = expectFiles[ef++]
|
||||
t.equivalent(found, wanted, 'unpacked file ' + ef + ' ' + (wanted && wanted.path))
|
||||
|
||||
entry.on('entry', foundEntry)
|
||||
}
|
||||
|
||||
function finish () {
|
||||
t.equal(ef, expectFiles.length, 'should have ' + ef + ' items')
|
||||
t.end()
|
||||
}
|
||||
}
|
||||
})
|
BIN
node_modules/tar/test/dir-normalization.tar
generated
vendored
Normal file
BIN
node_modules/tar/test/dir-normalization.tar
generated
vendored
Normal file
Binary file not shown.
33
node_modules/tar/test/error-on-broken.js
generated
vendored
Normal file
33
node_modules/tar/test/error-on-broken.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var zlib = require('zlib')
|
||||
|
||||
var tap = require('tap')
|
||||
|
||||
var tar = require('../tar.js')
|
||||
|
||||
var file = path.join(__dirname, 'cb-never-called-1.0.1.tgz')
|
||||
var target = path.join(__dirname, 'tmp/extract-test')
|
||||
|
||||
tap.test('preclean', function (t) {
|
||||
require('rimraf').sync(__dirname + '/tmp/extract-test')
|
||||
t.pass('cleaned!')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tap.test('extract test', function (t) {
|
||||
var extract = tar.Extract(target)
|
||||
var inp = fs.createReadStream(file)
|
||||
|
||||
inp.pipe(zlib.createGunzip()).pipe(extract)
|
||||
|
||||
extract.on('error', function (er) {
|
||||
t.equal(er.message, 'unexpected eof', 'error noticed')
|
||||
t.end()
|
||||
})
|
||||
|
||||
extract.on('end', function () {
|
||||
t.fail('shouldn\'t reach this point due to errors')
|
||||
t.end()
|
||||
})
|
||||
})
|
132
node_modules/tar/test/extract-move.js
generated
vendored
Normal file
132
node_modules/tar/test/extract-move.js
generated
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
// Set the umask, so that it works the same everywhere.
|
||||
process.umask(parseInt('22', 8))
|
||||
|
||||
var tap = require("tap")
|
||||
, tar = require("../tar.js")
|
||||
, fs = require("fs")
|
||||
, gfs = require("graceful-fs")
|
||||
, path = require("path")
|
||||
, file = path.resolve(__dirname, "fixtures/dir.tar")
|
||||
, target = path.resolve(__dirname, "tmp/extract-test")
|
||||
, index = 0
|
||||
, fstream = require("fstream")
|
||||
, rimraf = require("rimraf")
|
||||
, mkdirp = require("mkdirp")
|
||||
|
||||
, ee = 0
|
||||
, expectEntries = [
|
||||
{
|
||||
"path" : "dir/",
|
||||
"mode" : "750",
|
||||
"type" : "5",
|
||||
"depth" : undefined,
|
||||
"size" : 0,
|
||||
"linkpath" : "",
|
||||
"nlink" : undefined,
|
||||
"dev" : undefined,
|
||||
"ino" : undefined
|
||||
},
|
||||
{
|
||||
"path" : "dir/sub/",
|
||||
"mode" : "750",
|
||||
"type" : "5",
|
||||
"depth" : undefined,
|
||||
"size" : 0,
|
||||
"linkpath" : "",
|
||||
"nlink" : undefined,
|
||||
"dev" : undefined,
|
||||
"ino" : undefined
|
||||
} ]
|
||||
|
||||
function slow (fs, method, t1, t2) {
|
||||
var orig = fs[method]
|
||||
if (!orig) return null
|
||||
fs[method] = function () {
|
||||
var args = [].slice.call(arguments)
|
||||
console.error("slow", method, args[0])
|
||||
var cb = args.pop()
|
||||
|
||||
setTimeout(function () {
|
||||
orig.apply(fs, args.concat(function(er, data) {
|
||||
setTimeout(function() {
|
||||
cb(er, data)
|
||||
}, t2)
|
||||
}))
|
||||
}, t1)
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we get the graceful-fs that fstream is using.
|
||||
var gfs2
|
||||
try {
|
||||
gfs2 = require("fstream/node_modules/graceful-fs")
|
||||
} catch (er) {}
|
||||
|
||||
var slowMethods = ["chown", "chmod", "utimes", "lutimes"]
|
||||
slowMethods.forEach(function (method) {
|
||||
var t1 = 500
|
||||
var t2 = 0
|
||||
slow(fs, method, t1, t2)
|
||||
slow(gfs, method, t1, t2)
|
||||
if (gfs2) {
|
||||
slow(gfs2, method, t1, t2)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
// The extract class basically just pipes the input
|
||||
// to a Reader, and then to a fstream.DirWriter
|
||||
|
||||
// So, this is as much a test of fstream.Reader and fstream.Writer
|
||||
// as it is of tar.Extract, but it sort of makes sense.
|
||||
|
||||
tap.test("preclean", function (t) {
|
||||
rimraf.sync(target)
|
||||
/mkdirp.sync(target)
|
||||
t.pass("cleaned!")
|
||||
t.end()
|
||||
})
|
||||
|
||||
tap.test("extract test", function (t) {
|
||||
var extract = tar.Extract(target)
|
||||
var inp = fs.createReadStream(file)
|
||||
|
||||
// give it a weird buffer size to try to break in odd places
|
||||
inp.bufferSize = 1234
|
||||
|
||||
inp.pipe(extract)
|
||||
|
||||
extract.on("end", function () {
|
||||
rimraf.sync(target)
|
||||
|
||||
t.equal(ee, expectEntries.length, "should see "+ee+" entries")
|
||||
|
||||
// should get no more entries after end
|
||||
extract.removeAllListeners("entry")
|
||||
extract.on("entry", function (e) {
|
||||
t.fail("Should not get entries after end!")
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
|
||||
extract.on("entry", function (entry) {
|
||||
var found =
|
||||
{ path: entry.path
|
||||
, mode: entry.props.mode.toString(8)
|
||||
, type: entry.props.type
|
||||
, depth: entry.props.depth
|
||||
, size: entry.props.size
|
||||
, linkpath: entry.props.linkpath
|
||||
, nlink: entry.props.nlink
|
||||
, dev: entry.props.dev
|
||||
, ino: entry.props.ino
|
||||
}
|
||||
|
||||
var wanted = expectEntries[ee ++]
|
||||
|
||||
t.equivalent(found, wanted, "tar entry " + ee + " " + wanted.path)
|
||||
})
|
||||
})
|
367
node_modules/tar/test/extract.js
generated
vendored
Normal file
367
node_modules/tar/test/extract.js
generated
vendored
Normal file
@ -0,0 +1,367 @@
|
||||
// Set the umask, so that it works the same everywhere.
|
||||
process.umask(parseInt('22', 8))
|
||||
|
||||
var tap = require("tap")
|
||||
, tar = require("../tar.js")
|
||||
, fs = require("fs")
|
||||
, path = require("path")
|
||||
, file = path.resolve(__dirname, "fixtures/c.tar")
|
||||
, target = path.resolve(__dirname, "tmp/extract-test")
|
||||
, index = 0
|
||||
, fstream = require("fstream")
|
||||
|
||||
, ee = 0
|
||||
, expectEntries =
|
||||
[ { path: 'c.txt',
|
||||
mode: '644',
|
||||
type: '0',
|
||||
depth: undefined,
|
||||
size: 513,
|
||||
linkpath: '',
|
||||
nlink: undefined,
|
||||
dev: undefined,
|
||||
ino: undefined },
|
||||
{ path: 'cc.txt',
|
||||
mode: '644',
|
||||
type: '0',
|
||||
depth: undefined,
|
||||
size: 513,
|
||||
linkpath: '',
|
||||
nlink: undefined,
|
||||
dev: undefined,
|
||||
ino: undefined },
|
||||
{ path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: '644',
|
||||
type: '0',
|
||||
depth: undefined,
|
||||
size: 100,
|
||||
linkpath: '',
|
||||
nlink: undefined,
|
||||
dev: undefined,
|
||||
ino: undefined },
|
||||
{ path: 'Ω.txt',
|
||||
mode: '644',
|
||||
type: '0',
|
||||
depth: undefined,
|
||||
size: 2,
|
||||
linkpath: '',
|
||||
nlink: undefined,
|
||||
dev: undefined,
|
||||
ino: undefined },
|
||||
{ path: 'Ω.txt',
|
||||
mode: '644',
|
||||
type: '0',
|
||||
depth: undefined,
|
||||
size: 2,
|
||||
linkpath: '',
|
||||
nlink: 1,
|
||||
dev: 234881026,
|
||||
ino: 51693379 },
|
||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: '644',
|
||||
type: '0',
|
||||
depth: undefined,
|
||||
size: 200,
|
||||
linkpath: '',
|
||||
nlink: 1,
|
||||
dev: 234881026,
|
||||
ino: 51681874 },
|
||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: '644',
|
||||
type: '0',
|
||||
depth: undefined,
|
||||
size: 201,
|
||||
linkpath: '',
|
||||
nlink: undefined,
|
||||
dev: undefined,
|
||||
ino: undefined },
|
||||
{ path: '200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
|
||||
mode: '777',
|
||||
type: '2',
|
||||
depth: undefined,
|
||||
size: 0,
|
||||
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
nlink: undefined,
|
||||
dev: undefined,
|
||||
ino: undefined },
|
||||
{ path: '200-hard',
|
||||
mode: '644',
|
||||
type: '0',
|
||||
depth: undefined,
|
||||
size: 200,
|
||||
linkpath: '',
|
||||
nlink: 2,
|
||||
dev: 234881026,
|
||||
ino: 51681874 },
|
||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: '644',
|
||||
type: '1',
|
||||
depth: undefined,
|
||||
size: 0,
|
||||
linkpath: path.resolve(target, '200-hard'),
|
||||
nlink: 2,
|
||||
dev: 234881026,
|
||||
ino: 51681874 } ]
|
||||
|
||||
, ef = 0
|
||||
, expectFiles =
|
||||
[ { path: '',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 0,
|
||||
linkpath: undefined },
|
||||
{ path: '/200-hard',
|
||||
mode: '100644',
|
||||
type: 'File',
|
||||
depth: 1,
|
||||
size: 200,
|
||||
linkpath: undefined,
|
||||
nlink: 2 },
|
||||
{ path: '/200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
|
||||
mode: '120777',
|
||||
type: 'SymbolicLink',
|
||||
depth: 1,
|
||||
size: 200,
|
||||
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
nlink: 1 },
|
||||
{ path: '/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: '100644',
|
||||
type: 'Link',
|
||||
depth: 1,
|
||||
size: 200,
|
||||
linkpath: path.join(target, '200-hard'),
|
||||
nlink: 2 },
|
||||
{ path: '/c.txt',
|
||||
mode: '100644',
|
||||
type: 'File',
|
||||
depth: 1,
|
||||
size: 513,
|
||||
linkpath: undefined,
|
||||
nlink: 1 },
|
||||
{ path: '/cc.txt',
|
||||
mode: '100644',
|
||||
type: 'File',
|
||||
depth: 1,
|
||||
size: 513,
|
||||
linkpath: undefined,
|
||||
nlink: 1 },
|
||||
{ path: '/r',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 1,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 2,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 3,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 4,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 5,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 6,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 7,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 8,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 9,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 10,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 11,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 12,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 13,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 14,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 15,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 16,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 17,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 18,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 19,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 20,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 21,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 22,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h',
|
||||
mode: '40755',
|
||||
type: 'Directory',
|
||||
depth: 23,
|
||||
linkpath: undefined },
|
||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: '100644',
|
||||
type: 'File',
|
||||
depth: 24,
|
||||
size: 100,
|
||||
linkpath: undefined,
|
||||
nlink: 1 },
|
||||
{ path: '/Ω.txt',
|
||||
mode: '100644',
|
||||
type: 'File',
|
||||
depth: 1,
|
||||
size: 2,
|
||||
linkpath: undefined,
|
||||
nlink: 1 } ]
|
||||
|
||||
|
||||
|
||||
// The extract class basically just pipes the input
|
||||
// to a Reader, and then to a fstream.DirWriter
|
||||
|
||||
// So, this is as much a test of fstream.Reader and fstream.Writer
|
||||
// as it is of tar.Extract, but it sort of makes sense.
|
||||
|
||||
tap.test("preclean", function (t) {
|
||||
require("rimraf").sync(__dirname + "/tmp/extract-test")
|
||||
t.pass("cleaned!")
|
||||
t.end()
|
||||
})
|
||||
|
||||
tap.test("extract test", function (t) {
|
||||
var extract = tar.Extract(target)
|
||||
var inp = fs.createReadStream(file)
|
||||
|
||||
// give it a weird buffer size to try to break in odd places
|
||||
inp.bufferSize = 1234
|
||||
|
||||
inp.pipe(extract)
|
||||
|
||||
extract.on("end", function () {
|
||||
t.equal(ee, expectEntries.length, "should see "+ee+" entries")
|
||||
|
||||
// should get no more entries after end
|
||||
extract.removeAllListeners("entry")
|
||||
extract.on("entry", function (e) {
|
||||
t.fail("Should not get entries after end!")
|
||||
})
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
extract.on("entry", function (entry) {
|
||||
var found =
|
||||
{ path: entry.path
|
||||
, mode: entry.props.mode.toString(8)
|
||||
, type: entry.props.type
|
||||
, depth: entry.props.depth
|
||||
, size: entry.props.size
|
||||
, linkpath: entry.props.linkpath
|
||||
, nlink: entry.props.nlink
|
||||
, dev: entry.props.dev
|
||||
, ino: entry.props.ino
|
||||
}
|
||||
|
||||
var wanted = expectEntries[ee ++]
|
||||
|
||||
t.equivalent(found, wanted, "tar entry " + ee + " " + wanted.path)
|
||||
})
|
||||
|
||||
function next () {
|
||||
var r = fstream.Reader({ path: target
|
||||
, type: "Directory"
|
||||
// this is just to encourage consistency
|
||||
, sort: "alpha" })
|
||||
|
||||
r.on("ready", function () {
|
||||
foundEntry(r)
|
||||
})
|
||||
|
||||
r.on("end", finish)
|
||||
|
||||
function foundEntry (entry) {
|
||||
var p = entry.path.substr(target.length)
|
||||
var found =
|
||||
{ path: p
|
||||
, mode: entry.props.mode.toString(8)
|
||||
, type: entry.props.type
|
||||
, depth: entry.props.depth
|
||||
, size: entry.props.size
|
||||
, linkpath: entry.props.linkpath
|
||||
, nlink: entry.props.nlink
|
||||
}
|
||||
|
||||
var wanted = expectFiles[ef ++]
|
||||
|
||||
t.has(found, wanted, "unpacked file " + ef + " " + wanted.path)
|
||||
|
||||
entry.on("entry", foundEntry)
|
||||
}
|
||||
|
||||
function finish () {
|
||||
t.equal(ef, expectFiles.length, "should have "+ef+" items")
|
||||
t.end()
|
||||
}
|
||||
}
|
||||
})
|
BIN
node_modules/tar/test/fixtures.tgz
generated
vendored
Normal file
BIN
node_modules/tar/test/fixtures.tgz
generated
vendored
Normal file
Binary file not shown.
183
node_modules/tar/test/header.js
generated
vendored
Normal file
183
node_modules/tar/test/header.js
generated
vendored
Normal file
@ -0,0 +1,183 @@
|
||||
var tap = require("tap")
|
||||
var TarHeader = require("../lib/header.js")
|
||||
var tar = require("../tar.js")
|
||||
var fs = require("fs")
|
||||
|
||||
|
||||
var headers =
|
||||
{ "a.txt file header":
|
||||
[ "612e747874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303430312031313635313336303333332030313234353100203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
, { cksumValid: true
|
||||
, path: 'a.txt'
|
||||
, mode: 420
|
||||
, uid: 24561
|
||||
, gid: 20
|
||||
, size: 257
|
||||
, mtime: 1319493851
|
||||
, cksum: 5417
|
||||
, type: '0'
|
||||
, linkpath: ''
|
||||
, ustar: 'ustar\0'
|
||||
, ustarver: '00'
|
||||
, uname: 'isaacs'
|
||||
, gname: 'staff'
|
||||
, devmaj: 0
|
||||
, devmin: 0
|
||||
, fill: '' }
|
||||
]
|
||||
|
||||
, "omega pax": // the extended header from omega tar.
|
||||
[ "5061784865616465722fcea92e74787400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303137302031313534333731303631312030313530353100207800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
, { cksumValid: true
|
||||
, path: 'PaxHeader/Ω.txt'
|
||||
, mode: 420
|
||||
, uid: 24561
|
||||
, gid: 20
|
||||
, size: 120
|
||||
, mtime: 1301254537
|
||||
, cksum: 6697
|
||||
, type: 'x'
|
||||
, linkpath: ''
|
||||
, ustar: 'ustar\0'
|
||||
, ustarver: '00'
|
||||
, uname: 'isaacs'
|
||||
, gname: 'staff'
|
||||
, devmaj: 0
|
||||
, devmin: 0
|
||||
, fill: '' } ]
|
||||
|
||||
, "omega file header":
|
||||
[ "cea92e7478740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303030322031313534333731303631312030313330373200203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
, { cksumValid: true
|
||||
, path: 'Ω.txt'
|
||||
, mode: 420
|
||||
, uid: 24561
|
||||
, gid: 20
|
||||
, size: 2
|
||||
, mtime: 1301254537
|
||||
, cksum: 5690
|
||||
, type: '0'
|
||||
, linkpath: ''
|
||||
, ustar: 'ustar\0'
|
||||
, ustarver: '00'
|
||||
, uname: 'isaacs'
|
||||
, gname: 'staff'
|
||||
, devmaj: 0
|
||||
, devmin: 0
|
||||
, fill: '' } ]
|
||||
|
||||
, "foo.js file header":
|
||||
[ "666f6f2e6a730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303030342031313534333637303734312030313236313700203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
, { cksumValid: true
|
||||
, path: 'foo.js'
|
||||
, mode: 420
|
||||
, uid: 24561
|
||||
, gid: 20
|
||||
, size: 4
|
||||
, mtime: 1301246433
|
||||
, cksum: 5519
|
||||
, type: '0'
|
||||
, linkpath: ''
|
||||
, ustar: 'ustar\0'
|
||||
, ustarver: '00'
|
||||
, uname: 'isaacs'
|
||||
, gname: 'staff'
|
||||
, devmaj: 0
|
||||
, devmin: 0
|
||||
, fill: '' }
|
||||
]
|
||||
|
||||
, "b.txt file header":
|
||||
[ "622e747874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030313030302031313635313336303637372030313234363100203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
, { cksumValid: true
|
||||
, path: 'b.txt'
|
||||
, mode: 420
|
||||
, uid: 24561
|
||||
, gid: 20
|
||||
, size: 512
|
||||
, mtime: 1319494079
|
||||
, cksum: 5425
|
||||
, type: '0'
|
||||
, linkpath: ''
|
||||
, ustar: 'ustar\0'
|
||||
, ustarver: '00'
|
||||
, uname: 'isaacs'
|
||||
, gname: 'staff'
|
||||
, devmaj: 0
|
||||
, devmin: 0
|
||||
, fill: '' }
|
||||
]
|
||||
|
||||
, "deep nested file":
|
||||
[ "636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363633030303634342000303537373631200030303030323420003030303030303030313434203131363532313531353333203034333331340020300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075737461720030306973616163730000000000000000000000000000000000000000000000000000737461666600000000000000000000000000000000000000000000000000000030303030303020003030303030302000722f652f612f6c2f6c2f792f2d2f642f652f652f702f2d2f662f6f2f6c2f642f652f722f2d2f702f612f742f680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
, { cksumValid: true,
|
||||
path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'
|
||||
, mode: 420
|
||||
, uid: 24561
|
||||
, gid: 20
|
||||
, size: 100
|
||||
, mtime: 1319687003
|
||||
, cksum: 18124
|
||||
, type: '0'
|
||||
, linkpath: ''
|
||||
, ustar: 'ustar\0'
|
||||
, ustarver: '00'
|
||||
, uname: 'isaacs'
|
||||
, gname: 'staff'
|
||||
, devmaj: 0
|
||||
, devmin: 0
|
||||
, fill: '' }
|
||||
]
|
||||
}
|
||||
|
||||
tap.test("parsing", function (t) {
|
||||
Object.keys(headers).forEach(function (name) {
|
||||
var h = headers[name]
|
||||
, header = new Buffer(h[0], "hex")
|
||||
, expect = h[1]
|
||||
, parsed = new TarHeader(header)
|
||||
|
||||
// console.error(parsed)
|
||||
t.has(parsed, expect, "parse " + name)
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
tap.test("encoding", function (t) {
|
||||
Object.keys(headers).forEach(function (name) {
|
||||
var h = headers[name]
|
||||
, expect = new Buffer(h[0], "hex")
|
||||
, encoded = TarHeader.encode(h[1])
|
||||
|
||||
// might have slightly different bytes, since the standard
|
||||
// isn't very strict, but should have the same semantics
|
||||
// checkSum will be different, but cksumValid will be true
|
||||
|
||||
var th = new TarHeader(encoded)
|
||||
delete h[1].block
|
||||
delete h[1].needExtended
|
||||
delete h[1].cksum
|
||||
t.has(th, h[1], "fields "+name)
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
// test these manually. they're a bit rare to find in the wild
|
||||
tap.test("parseNumeric tests", function (t) {
|
||||
var parseNumeric = TarHeader.parseNumeric
|
||||
, numbers =
|
||||
{ "303737373737373700": 2097151
|
||||
, "30373737373737373737373700": 8589934591
|
||||
, "303030303036343400": 420
|
||||
, "800000ffffffffffff": 281474976710655
|
||||
, "ffffff000000000001": -281474976710654
|
||||
, "ffffff000000000000": -281474976710655
|
||||
, "800000000000200000": 2097152
|
||||
, "8000000000001544c5": 1393861
|
||||
, "ffffffffffff1544c5": -15383354 }
|
||||
Object.keys(numbers).forEach(function (n) {
|
||||
var b = new Buffer(n, "hex")
|
||||
t.equal(parseNumeric(b), numbers[n], n + " === " + numbers[n])
|
||||
})
|
||||
t.end()
|
||||
})
|
39
node_modules/tar/test/link-file-entry-collision.js
generated
vendored
Normal file
39
node_modules/tar/test/link-file-entry-collision.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Set the umask, so that it works the same everywhere.
|
||||
process.umask(parseInt('22', 8))
|
||||
|
||||
var tap = require("tap")
|
||||
, tar = require("../tar.js")
|
||||
, fs = require("fs")
|
||||
, path = require("path")
|
||||
, file = path.resolve(__dirname, "link-file-entry-collision/bad-link.tar")
|
||||
, target = path.resolve(__dirname, "tmp/link-file-entry-collision")
|
||||
, index = 0
|
||||
, fstream = require("fstream")
|
||||
, mkdirp = require("mkdirp")
|
||||
, rimraf = require("rimraf")
|
||||
|
||||
tap.test("preclean", function (t) {
|
||||
rimraf.sync(target)
|
||||
t.pass("cleaned!")
|
||||
t.end()
|
||||
})
|
||||
|
||||
tap.test("extract test", function (t) {
|
||||
var extract = tar.Extract(target)
|
||||
var inp = fs.createReadStream(file)
|
||||
inp.pipe(extract)
|
||||
|
||||
extract.on("end", function () {
|
||||
t.equal(fs.readFileSync(target + "/bad-link-target", "utf8"),
|
||||
"this should remain the same\n")
|
||||
t.equal(fs.readFileSync(target + "/a.txt", "utf8"),
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
tap.test("cleanup", function (t) {
|
||||
rimraf.sync(target)
|
||||
t.pass("cleaned!")
|
||||
t.end()
|
||||
})
|
25
node_modules/tar/test/link-file-entry-collision/bad-link.hex
generated
vendored
Normal file
25
node_modules/tar/test/link-file-entry-collision/bad-link.hex
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
-- header for the link target --
|
||||
6261642d6c696e6b2d74617267657400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000303030363434200030303037363520003030303032342000303030303030303030333420313334363636353530353620303134333731002030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # bad-link-target.....................................................................................000644..000765..000024..00000000034.13466655056.014371..0...................................................................................................
|
||||
00757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # .ustar.00isaacs..........................staff...........................000000..000000.........................................................................................................................................................................
|
||||
|
||||
-- link target file contents (should not be overwritten) --
|
||||
746869732073686f756c642072656d61696e207468652073616d650a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # this.should.remain.the.same.....................................................................................................................................................................................................................................
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
||||
|
||||
-- header for the link named a.txt --
|
||||
612e74787400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003030303634342000303030373635200030303030323420003030303030303030303030203133343636363535303536203031353334320020316261642d6c696e6b2d746172676574000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # a.txt...............................................................................................000644..000765..000024..00000000000.13466655056.015342..1bad-link-target....................................................................................
|
||||
00757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # .ustar.00isaacs..........................staff...........................000000..000000.........................................................................................................................................................................
|
||||
|
||||
-- header for file entry which attempts to overwrite the link --
|
||||
612e7478740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000303030363434200030353737363120003030303032342000303030303030303034303120313136353133363033333320303132343531002030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # a.txt...............................................................................................000644..057761..000024..00000000401.11651360333.012451..0...................................................................................................
|
||||
00757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # .ustar.00isaacs..........................staff...........................000000..000000.........................................................................................................................................................................
|
||||
|
||||
-- contents that threaten to overwrite the link target --
|
||||
61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
61000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # a...............................................................................................................................................................................................................................................................
|
||||
|
||||
-- tar eof --
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
BIN
node_modules/tar/test/link-file-entry-collision/bad-link.tar
generated
vendored
Normal file
BIN
node_modules/tar/test/link-file-entry-collision/bad-link.tar
generated
vendored
Normal file
Binary file not shown.
886
node_modules/tar/test/pack-no-proprietary.js
generated
vendored
Normal file
886
node_modules/tar/test/pack-no-proprietary.js
generated
vendored
Normal file
@ -0,0 +1,886 @@
|
||||
// This is exactly like test/pack.js, except that it's excluding
|
||||
// any proprietary headers.
|
||||
//
|
||||
// This loses some information about the filesystem, but creates
|
||||
// tarballs that are supported by more versions of tar, especially
|
||||
// old non-spec-compliant copies of gnutar.
|
||||
|
||||
// the symlink file is excluded from git, because it makes
|
||||
// windows freak the hell out.
|
||||
var fs = require("fs")
|
||||
, path = require("path")
|
||||
, symlink = path.resolve(__dirname, "fixtures/symlink")
|
||||
try { fs.unlinkSync(symlink) } catch (e) {}
|
||||
fs.symlinkSync("./hardlink-1", symlink)
|
||||
process.on("exit", function () {
|
||||
fs.unlinkSync(symlink)
|
||||
})
|
||||
|
||||
var tap = require("tap")
|
||||
, tar = require("../tar.js")
|
||||
, pkg = require("../package.json")
|
||||
, Pack = tar.Pack
|
||||
, fstream = require("fstream")
|
||||
, Reader = fstream.Reader
|
||||
, Writer = fstream.Writer
|
||||
, input = path.resolve(__dirname, "fixtures/")
|
||||
, target = path.resolve(__dirname, "tmp/pack.tar")
|
||||
, uid = process.getuid ? process.getuid() : 0
|
||||
, gid = process.getgid ? process.getgid() : 0
|
||||
|
||||
, entries =
|
||||
|
||||
// the global header and root fixtures/ dir are going to get
|
||||
// a different date each time, so omit that bit.
|
||||
// Also, dev/ino values differ across machines, so that's not
|
||||
// included.
|
||||
[ [ 'entry',
|
||||
{ path: 'fixtures/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'extendedHeader',
|
||||
{ path: 'PaxHeader/fixtures/200cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 200 } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 200,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/a.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 257,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/b.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 512,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/c.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 513,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/cc.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 513,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/dir/',
|
||||
mode: 488,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/dir/sub/',
|
||||
mode: 488,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/foo.js',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 4,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/hardlink-1',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 200,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/hardlink-2',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '1',
|
||||
linkpath: 'fixtures/hardlink-1',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/omega.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/packtest/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/packtest/omega.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/packtest/star.4.html',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 54081,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'extendedHeader',
|
||||
{ path: 'PaxHeader/fixtures/packtest/Ω.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ path: 'fixtures/packtest/Ω.txt',
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2 } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/packtest/Ω.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 100,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/symlink',
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '2',
|
||||
linkpath: 'hardlink-1',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'extendedHeader',
|
||||
{ path: 'PaxHeader/fixtures/Ω.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ path: "fixtures/Ω.txt"
|
||||
, uid: uid
|
||||
, gid: gid
|
||||
, size: 2 } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/Ω.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
]
|
||||
|
||||
|
||||
// first, make sure that the hardlinks are actually hardlinks, or this
|
||||
// won't work. Git has a way of replacing them with a copy.
|
||||
var hard1 = path.resolve(__dirname, "fixtures/hardlink-1")
|
||||
, hard2 = path.resolve(__dirname, "fixtures/hardlink-2")
|
||||
, fs = require("fs")
|
||||
|
||||
try { fs.unlinkSync(hard2) } catch (e) {}
|
||||
fs.linkSync(hard1, hard2)
|
||||
|
||||
tap.test("with global header", { timeout: 10000 }, function (t) {
|
||||
runTest(t, true)
|
||||
})
|
||||
|
||||
tap.test("without global header", { timeout: 10000 }, function (t) {
|
||||
runTest(t, false)
|
||||
})
|
||||
|
||||
function alphasort (a, b) {
|
||||
return a === b ? 0
|
||||
: a.toLowerCase() > b.toLowerCase() ? 1
|
||||
: a.toLowerCase() < b.toLowerCase() ? -1
|
||||
: a > b ? 1
|
||||
: -1
|
||||
}
|
||||
|
||||
|
||||
function runTest (t, doGH) {
|
||||
var reader = Reader({ path: input
|
||||
, filter: function () {
|
||||
return !this.path.match(/\.(tar|hex)$/)
|
||||
}
|
||||
, sort: alphasort
|
||||
})
|
||||
|
||||
var props = doGH ? pkg : {}
|
||||
props.noProprietary = true
|
||||
var pack = Pack(props)
|
||||
var writer = Writer(target)
|
||||
|
||||
// global header should be skipped regardless, since it has no content.
|
||||
var entry = 0
|
||||
|
||||
t.ok(reader, "reader ok")
|
||||
t.ok(pack, "pack ok")
|
||||
t.ok(writer, "writer ok")
|
||||
|
||||
pack.pipe(writer)
|
||||
|
||||
var parse = tar.Parse()
|
||||
t.ok(parse, "parser should be ok")
|
||||
|
||||
pack.on("data", function (c) {
|
||||
// console.error("PACK DATA")
|
||||
if (c.length !== 512) {
|
||||
// this one is too noisy, only assert if it'll be relevant
|
||||
t.equal(c.length, 512, "parser should emit data in 512byte blocks")
|
||||
}
|
||||
parse.write(c)
|
||||
})
|
||||
|
||||
pack.on("end", function () {
|
||||
// console.error("PACK END")
|
||||
t.pass("parser ends")
|
||||
parse.end()
|
||||
})
|
||||
|
||||
pack.on("error", function (er) {
|
||||
t.fail("pack error", er)
|
||||
})
|
||||
|
||||
parse.on("error", function (er) {
|
||||
t.fail("parse error", er)
|
||||
})
|
||||
|
||||
writer.on("error", function (er) {
|
||||
t.fail("writer error", er)
|
||||
})
|
||||
|
||||
reader.on("error", function (er) {
|
||||
t.fail("reader error", er)
|
||||
})
|
||||
|
||||
parse.on("*", function (ev, e) {
|
||||
var wanted = entries[entry++]
|
||||
if (!wanted) {
|
||||
t.fail("unexpected event: "+ev)
|
||||
return
|
||||
}
|
||||
t.equal(ev, wanted[0], "event type should be "+wanted[0])
|
||||
|
||||
if (ev !== wanted[0] || e.path !== wanted[1].path) {
|
||||
console.error("wanted", wanted)
|
||||
console.error([ev, e.props])
|
||||
e.on("end", function () {
|
||||
console.error(e.fields)
|
||||
throw "break"
|
||||
})
|
||||
}
|
||||
|
||||
t.has(e.props, wanted[1], "properties "+wanted[1].path)
|
||||
if (wanted[2]) {
|
||||
e.on("end", function () {
|
||||
if (!e.fields) {
|
||||
t.ok(e.fields, "should get fields")
|
||||
} else {
|
||||
t.has(e.fields, wanted[2], "should get expected fields")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
reader.pipe(pack)
|
||||
|
||||
writer.on("close", function () {
|
||||
t.equal(entry, entries.length, "should get all expected entries")
|
||||
t.pass("it finished")
|
||||
t.end()
|
||||
})
|
||||
|
||||
}
|
952
node_modules/tar/test/pack.js
generated
vendored
Normal file
952
node_modules/tar/test/pack.js
generated
vendored
Normal file
@ -0,0 +1,952 @@
|
||||
|
||||
// the symlink file is excluded from git, because it makes
|
||||
// windows freak the hell out.
|
||||
var fs = require("fs")
|
||||
, path = require("path")
|
||||
, symlink = path.resolve(__dirname, "fixtures/symlink")
|
||||
try { fs.unlinkSync(symlink) } catch (e) {}
|
||||
fs.symlinkSync("./hardlink-1", symlink)
|
||||
process.on("exit", function () {
|
||||
fs.unlinkSync(symlink)
|
||||
})
|
||||
|
||||
|
||||
var tap = require("tap")
|
||||
, tar = require("../tar.js")
|
||||
, pkg = require("../package.json")
|
||||
, Pack = tar.Pack
|
||||
, fstream = require("fstream")
|
||||
, Reader = fstream.Reader
|
||||
, Writer = fstream.Writer
|
||||
, input = path.resolve(__dirname, "fixtures/")
|
||||
, target = path.resolve(__dirname, "tmp/pack.tar")
|
||||
, uid = process.getuid ? process.getuid() : 0
|
||||
, gid = process.getgid ? process.getgid() : 0
|
||||
|
||||
, entries =
|
||||
|
||||
// the global header and root fixtures/ dir are going to get
|
||||
// a different date each time, so omit that bit.
|
||||
// Also, dev/ino values differ across machines, so that's not
|
||||
// included.
|
||||
[ [ 'globalExtendedHeader',
|
||||
{ path: 'PaxHeader/',
|
||||
mode: 438,
|
||||
uid: 0,
|
||||
gid: 0,
|
||||
type: 'g',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ "NODETAR.author": pkg.author,
|
||||
"NODETAR.name": pkg.name,
|
||||
"NODETAR.description": pkg.description,
|
||||
"NODETAR.version": pkg.version,
|
||||
"NODETAR.repository.type": pkg.repository.type,
|
||||
"NODETAR.repository.url": pkg.repository.url,
|
||||
"NODETAR.main": pkg.main,
|
||||
"NODETAR.scripts.test": pkg.scripts.test } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'extendedHeader',
|
||||
{ path: 'PaxHeader/fixtures/200cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
'NODETAR.depth': '1',
|
||||
'NODETAR.type': 'File',
|
||||
nlink: 1,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 200,
|
||||
'NODETAR.blksize': '4096',
|
||||
'NODETAR.blocks': '8' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 200,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '',
|
||||
'NODETAR.depth': '1',
|
||||
'NODETAR.type': 'File',
|
||||
nlink: 1,
|
||||
'NODETAR.blksize': '4096',
|
||||
'NODETAR.blocks': '8' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/a.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 257,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/b.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 512,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/c.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 513,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/cc.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 513,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/dir/',
|
||||
mode: 488,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/dir/sub/',
|
||||
mode: 488,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/foo.js',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 4,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/hardlink-1',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 200,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/hardlink-2',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '1',
|
||||
linkpath: 'fixtures/hardlink-1',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/omega.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/packtest/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/packtest/omega.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/packtest/star.4.html',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 54081,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'extendedHeader',
|
||||
{ path: 'PaxHeader/fixtures/packtest/Ω.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ path: 'fixtures/packtest/Ω.txt',
|
||||
'NODETAR.depth': '2',
|
||||
'NODETAR.type': 'File',
|
||||
nlink: 1,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2,
|
||||
'NODETAR.blksize': '4096',
|
||||
'NODETAR.blocks': '8' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/packtest/Ω.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '',
|
||||
'NODETAR.depth': '2',
|
||||
'NODETAR.type': 'File',
|
||||
nlink: 1,
|
||||
'NODETAR.blksize': '4096',
|
||||
'NODETAR.blocks': '8' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/',
|
||||
mode: 493,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '5',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 100,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/symlink',
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 0,
|
||||
type: '2',
|
||||
linkpath: 'hardlink-1',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' } ]
|
||||
|
||||
, [ 'extendedHeader',
|
||||
{ path: 'PaxHeader/fixtures/Ω.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ path: "fixtures/Ω.txt"
|
||||
, "NODETAR.depth": "1"
|
||||
, "NODETAR.type": "File"
|
||||
, nlink: 1
|
||||
, uid: uid
|
||||
, gid: gid
|
||||
, size: 2
|
||||
, "NODETAR.blksize": "4096"
|
||||
, "NODETAR.blocks": "8" } ]
|
||||
|
||||
, [ 'entry',
|
||||
{ path: 'fixtures/Ω.txt',
|
||||
mode: 420,
|
||||
uid: uid,
|
||||
gid: gid,
|
||||
size: 2,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\u0000',
|
||||
ustarver: '00',
|
||||
uname: '',
|
||||
gname: '',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '',
|
||||
'NODETAR.depth': '1',
|
||||
'NODETAR.type': 'File',
|
||||
nlink: 1,
|
||||
'NODETAR.blksize': '4096',
|
||||
'NODETAR.blocks': '8' } ]
|
||||
]
|
||||
|
||||
|
||||
// first, make sure that the hardlinks are actually hardlinks, or this
|
||||
// won't work. Git has a way of replacing them with a copy.
|
||||
var hard1 = path.resolve(__dirname, "fixtures/hardlink-1")
|
||||
, hard2 = path.resolve(__dirname, "fixtures/hardlink-2")
|
||||
, fs = require("fs")
|
||||
|
||||
try { fs.unlinkSync(hard2) } catch (e) {}
|
||||
fs.linkSync(hard1, hard2)
|
||||
|
||||
tap.test("with global header", { timeout: 10000 }, function (t) {
|
||||
runTest(t, true)
|
||||
})
|
||||
|
||||
tap.test("without global header", { timeout: 10000 }, function (t) {
|
||||
runTest(t, false)
|
||||
})
|
||||
|
||||
tap.test("with from base", { timeout: 10000 }, function (t) {
|
||||
runTest(t, true, true)
|
||||
})
|
||||
|
||||
function alphasort (a, b) {
|
||||
return a === b ? 0
|
||||
: a.toLowerCase() > b.toLowerCase() ? 1
|
||||
: a.toLowerCase() < b.toLowerCase() ? -1
|
||||
: a > b ? 1
|
||||
: -1
|
||||
}
|
||||
|
||||
|
||||
function runTest (t, doGH, doFromBase) {
|
||||
var reader = Reader({ path: input
|
||||
, filter: function () {
|
||||
return !this.path.match(/\.(tar|hex)$/)
|
||||
}
|
||||
, sort: alphasort
|
||||
})
|
||||
|
||||
var props = doGH ? pkg : {}
|
||||
if(doFromBase) props.fromBase = true;
|
||||
|
||||
var pack = Pack(props)
|
||||
var writer = Writer(target)
|
||||
|
||||
// skip the global header if we're not doing that.
|
||||
var entry = doGH ? 0 : 1
|
||||
|
||||
t.ok(reader, "reader ok")
|
||||
t.ok(pack, "pack ok")
|
||||
t.ok(writer, "writer ok")
|
||||
|
||||
pack.pipe(writer)
|
||||
|
||||
var parse = tar.Parse()
|
||||
t.ok(parse, "parser should be ok")
|
||||
|
||||
pack.on("data", function (c) {
|
||||
// console.error("PACK DATA")
|
||||
if (c.length !== 512) {
|
||||
// this one is too noisy, only assert if it'll be relevant
|
||||
t.equal(c.length, 512, "parser should emit data in 512byte blocks")
|
||||
}
|
||||
parse.write(c)
|
||||
})
|
||||
|
||||
pack.on("end", function () {
|
||||
// console.error("PACK END")
|
||||
t.pass("parser ends")
|
||||
parse.end()
|
||||
})
|
||||
|
||||
pack.on("error", function (er) {
|
||||
t.fail("pack error", er)
|
||||
})
|
||||
|
||||
parse.on("error", function (er) {
|
||||
t.fail("parse error", er)
|
||||
})
|
||||
|
||||
writer.on("error", function (er) {
|
||||
t.fail("writer error", er)
|
||||
})
|
||||
|
||||
reader.on("error", function (er) {
|
||||
t.fail("reader error", er)
|
||||
})
|
||||
|
||||
parse.on("*", function (ev, e) {
|
||||
var wanted = entries[entry++]
|
||||
if (!wanted) {
|
||||
t.fail("unexpected event: "+ev)
|
||||
return
|
||||
}
|
||||
t.equal(ev, wanted[0], "event type should be "+wanted[0])
|
||||
|
||||
if(doFromBase) {
|
||||
if(wanted[1].path.indexOf('fixtures/') && wanted[1].path.length == 100)
|
||||
wanted[1].path = wanted[1].path.replace('fixtures/', '') + 'ccccccccc'
|
||||
|
||||
if(wanted[1]) wanted[1].path = wanted[1].path.replace('fixtures/', '').replace('//', '/')
|
||||
if(wanted[1].path == '') wanted[1].path = '/'
|
||||
if(wanted[2] && wanted[2].path) wanted[2].path = wanted[2].path.replace('fixtures', '').replace(/^\//, '')
|
||||
|
||||
wanted[1].linkpath = wanted[1].linkpath.replace('fixtures/', '')
|
||||
}
|
||||
|
||||
if (ev !== wanted[0] || e.path !== wanted[1].path) {
|
||||
console.error("wanted", wanted)
|
||||
console.error([ev, e.props])
|
||||
e.on("end", function () {
|
||||
console.error(e.fields)
|
||||
throw "break"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
t.has(e.props, wanted[1], "properties "+wanted[1].path)
|
||||
if (wanted[2]) {
|
||||
e.on("end", function () {
|
||||
if (!e.fields) {
|
||||
t.ok(e.fields, "should get fields")
|
||||
} else {
|
||||
t.has(e.fields, wanted[2], "should get expected fields")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
reader.pipe(pack)
|
||||
|
||||
writer.on("close", function () {
|
||||
t.equal(entry, entries.length, "should get all expected entries")
|
||||
t.pass("it finished")
|
||||
t.end()
|
||||
})
|
||||
|
||||
}
|
29
node_modules/tar/test/parse-discard.js
generated
vendored
Normal file
29
node_modules/tar/test/parse-discard.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
var tap = require("tap")
|
||||
, tar = require("../tar.js")
|
||||
, fs = require("fs")
|
||||
, path = require("path")
|
||||
, file = path.resolve(__dirname, "fixtures/c.tar")
|
||||
|
||||
tap.test("parser test", function (t) {
|
||||
var parser = tar.Parse()
|
||||
var total = 0
|
||||
var dataTotal = 0
|
||||
|
||||
parser.on("end", function () {
|
||||
|
||||
t.equals(total-513,dataTotal,'should have discarded only c.txt')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
fs.createReadStream(file)
|
||||
.pipe(parser)
|
||||
.on('entry',function(entry){
|
||||
if(entry.path === 'c.txt') entry.abort()
|
||||
|
||||
total += entry.size;
|
||||
entry.on('data',function(data){
|
||||
dataTotal += data.length
|
||||
})
|
||||
})
|
||||
})
|
359
node_modules/tar/test/parse.js
generated
vendored
Normal file
359
node_modules/tar/test/parse.js
generated
vendored
Normal file
@ -0,0 +1,359 @@
|
||||
var tap = require("tap")
|
||||
, tar = require("../tar.js")
|
||||
, fs = require("fs")
|
||||
, path = require("path")
|
||||
, file = path.resolve(__dirname, "fixtures/c.tar")
|
||||
, index = 0
|
||||
|
||||
, expect =
|
||||
[ [ 'entry',
|
||||
{ path: 'c.txt',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 513,
|
||||
mtime: new Date('Wed, 26 Oct 2011 01:10:58 GMT'),
|
||||
cksum: 5422,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
undefined ],
|
||||
[ 'entry',
|
||||
{ path: 'cc.txt',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 513,
|
||||
mtime: new Date('Wed, 26 Oct 2011 01:11:02 GMT'),
|
||||
cksum: 5525,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
undefined ],
|
||||
[ 'entry',
|
||||
{ path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 100,
|
||||
mtime: new Date('Thu, 27 Oct 2011 03:43:23 GMT'),
|
||||
cksum: 18124,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
undefined ],
|
||||
[ 'entry',
|
||||
{ path: 'Ω.txt',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 2,
|
||||
mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
|
||||
cksum: 5695,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
undefined ],
|
||||
[ 'extendedHeader',
|
||||
{ path: 'PaxHeader/Ω.txt',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 120,
|
||||
mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
|
||||
cksum: 6702,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ path: 'Ω.txt',
|
||||
ctime: 1319737909,
|
||||
atime: 1319739061,
|
||||
dev: 234881026,
|
||||
ino: 51693379,
|
||||
nlink: 1 } ],
|
||||
[ 'entry',
|
||||
{ path: 'Ω.txt',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 2,
|
||||
mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
|
||||
cksum: 5695,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '',
|
||||
ctime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
|
||||
atime: new Date('Thu, 27 Oct 2011 18:11:01 GMT'),
|
||||
dev: 234881026,
|
||||
ino: 51693379,
|
||||
nlink: 1 },
|
||||
undefined ],
|
||||
[ 'extendedHeader',
|
||||
{ path: 'PaxHeader/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 353,
|
||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
||||
cksum: 14488,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
ctime: 1319686868,
|
||||
atime: 1319741254,
|
||||
'LIBARCHIVE.creationtime': '1319686852',
|
||||
dev: 234881026,
|
||||
ino: 51681874,
|
||||
nlink: 1 } ],
|
||||
[ 'entry',
|
||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 200,
|
||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
||||
cksum: 14570,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '',
|
||||
ctime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
||||
atime: new Date('Thu, 27 Oct 2011 18:47:34 GMT'),
|
||||
'LIBARCHIVE.creationtime': '1319686852',
|
||||
dev: 234881026,
|
||||
ino: 51681874,
|
||||
nlink: 1 },
|
||||
undefined ],
|
||||
[ 'longPath',
|
||||
{ path: '././@LongLink',
|
||||
mode: 0,
|
||||
uid: 0,
|
||||
gid: 0,
|
||||
size: 201,
|
||||
mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'),
|
||||
cksum: 4976,
|
||||
type: 'L',
|
||||
linkpath: '',
|
||||
ustar: false },
|
||||
'200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' ],
|
||||
[ 'entry',
|
||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: 1000,
|
||||
gid: 1000,
|
||||
size: 201,
|
||||
mtime: new Date('Thu, 27 Oct 2011 22:21:50 GMT'),
|
||||
cksum: 14086,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: false },
|
||||
undefined ],
|
||||
[ 'longLinkpath',
|
||||
{ path: '././@LongLink',
|
||||
mode: 0,
|
||||
uid: 0,
|
||||
gid: 0,
|
||||
size: 201,
|
||||
mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'),
|
||||
cksum: 4975,
|
||||
type: 'K',
|
||||
linkpath: '',
|
||||
ustar: false },
|
||||
'200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' ],
|
||||
[ 'longPath',
|
||||
{ path: '././@LongLink',
|
||||
mode: 0,
|
||||
uid: 0,
|
||||
gid: 0,
|
||||
size: 201,
|
||||
mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'),
|
||||
cksum: 4976,
|
||||
type: 'L',
|
||||
linkpath: '',
|
||||
ustar: false },
|
||||
'200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL' ],
|
||||
[ 'entry',
|
||||
{ path: '200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
|
||||
mode: 511,
|
||||
uid: 1000,
|
||||
gid: 1000,
|
||||
size: 0,
|
||||
mtime: new Date('Fri, 28 Oct 2011 23:05:17 GMT'),
|
||||
cksum: 21603,
|
||||
type: '2',
|
||||
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
ustar: false },
|
||||
undefined ],
|
||||
[ 'extendedHeader',
|
||||
{ path: 'PaxHeader/200-hard',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 143,
|
||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
||||
cksum: 6533,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ ctime: 1320617144,
|
||||
atime: 1320617232,
|
||||
'LIBARCHIVE.creationtime': '1319686852',
|
||||
dev: 234881026,
|
||||
ino: 51681874,
|
||||
nlink: 2 } ],
|
||||
[ 'entry',
|
||||
{ path: '200-hard',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 200,
|
||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
||||
cksum: 5526,
|
||||
type: '0',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '',
|
||||
ctime: new Date('Sun, 06 Nov 2011 22:05:44 GMT'),
|
||||
atime: new Date('Sun, 06 Nov 2011 22:07:12 GMT'),
|
||||
'LIBARCHIVE.creationtime': '1319686852',
|
||||
dev: 234881026,
|
||||
ino: 51681874,
|
||||
nlink: 2 },
|
||||
undefined ],
|
||||
[ 'extendedHeader',
|
||||
{ path: 'PaxHeader/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 353,
|
||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
||||
cksum: 14488,
|
||||
type: 'x',
|
||||
linkpath: '',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '' },
|
||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
ctime: 1320617144,
|
||||
atime: 1320617406,
|
||||
'LIBARCHIVE.creationtime': '1319686852',
|
||||
dev: 234881026,
|
||||
ino: 51681874,
|
||||
nlink: 2 } ],
|
||||
[ 'entry',
|
||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
||||
mode: 420,
|
||||
uid: 24561,
|
||||
gid: 20,
|
||||
size: 0,
|
||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
||||
cksum: 15173,
|
||||
type: '1',
|
||||
linkpath: '200-hard',
|
||||
ustar: 'ustar\0',
|
||||
ustarver: '00',
|
||||
uname: 'isaacs',
|
||||
gname: 'staff',
|
||||
devmaj: 0,
|
||||
devmin: 0,
|
||||
fill: '',
|
||||
ctime: new Date('Sun, 06 Nov 2011 22:05:44 GMT'),
|
||||
atime: new Date('Sun, 06 Nov 2011 22:10:06 GMT'),
|
||||
'LIBARCHIVE.creationtime': '1319686852',
|
||||
dev: 234881026,
|
||||
ino: 51681874,
|
||||
nlink: 2 },
|
||||
undefined ] ]
|
||||
|
||||
|
||||
tap.test("parser test", function (t) {
|
||||
var parser = tar.Parse()
|
||||
|
||||
parser.on("end", function () {
|
||||
t.equal(index, expect.length, "saw all expected events")
|
||||
t.end()
|
||||
})
|
||||
|
||||
fs.createReadStream(file)
|
||||
.pipe(parser)
|
||||
.on("*", function (ev, entry) {
|
||||
var wanted = expect[index]
|
||||
if (!wanted) {
|
||||
return t.fail("Unexpected event: " + ev)
|
||||
}
|
||||
var result = [ev, entry.props]
|
||||
entry.on("end", function () {
|
||||
result.push(entry.fields || entry.body)
|
||||
|
||||
t.equal(ev, wanted[0], index + " event type")
|
||||
t.equivalent(entry.props, wanted[1], wanted[1].path + " entry properties")
|
||||
if (wanted[2]) {
|
||||
t.equivalent(result[2], wanted[2], "metadata values")
|
||||
}
|
||||
index ++
|
||||
})
|
||||
})
|
||||
})
|
20
node_modules/tar/test/zz-cleanup.js
generated
vendored
Normal file
20
node_modules/tar/test/zz-cleanup.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// clean up the fixtures
|
||||
|
||||
var tap = require("tap")
|
||||
, rimraf = require("rimraf")
|
||||
, test = tap.test
|
||||
, path = require("path")
|
||||
|
||||
test("clean fixtures", function (t) {
|
||||
rimraf(path.resolve(__dirname, "fixtures"), function (er) {
|
||||
t.ifError(er, "rimraf ./fixtures/")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test("clean tmp", function (t) {
|
||||
rimraf(path.resolve(__dirname, "tmp"), function (er) {
|
||||
t.ifError(er, "rimraf ./tmp/")
|
||||
t.end()
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user