tar 2.1.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nyc_output/0471d9cf-687f-4ae8-84a5-ce7468becd03.json +1 -0
- package/.nyc_output/12bca2bc-6a2b-4f45-abc7-8483922a524d.json +1 -0
- package/.nyc_output/37d58de4-deea-4808-bb77-d27685bd1501.json +1 -0
- package/.nyc_output/5ad8066b-6b8c-4bc8-b807-c40bf80898b7.json +1 -0
- package/.nyc_output/5cbf674c-7089-4b7d-b9de-2119be4dbb0b.json +1 -0
- package/.nyc_output/7853e29b-78ef-4ab4-b8fb-e1e176c0787b.json +1 -0
- package/.nyc_output/9d414044-b18d-4f6d-b2e0-531a89bf6f4f.json +1 -0
- package/.nyc_output/c3ffeb8c-8e79-4a2c-b678-e5a917fe721e.json +1 -0
- package/.nyc_output/ea0194cb-f599-402f-8876-84fb8251e8db.json +1 -0
- package/.nyc_output/eda6b7a3-5e15-440f-8619-e11a15a07f77.json +1 -0
- package/.nyc_output/fb518800-240c-42ff-811f-79e92708d9db.json +1 -0
- package/.nyc_output/fdecfc06-a944-4897-9530-e08f62883fc1.json +1 -0
- package/.nyc_output/processinfo/0471d9cf-687f-4ae8-84a5-ce7468becd03.json +1 -0
- package/.nyc_output/processinfo/12bca2bc-6a2b-4f45-abc7-8483922a524d.json +1 -0
- package/.nyc_output/processinfo/37d58de4-deea-4808-bb77-d27685bd1501.json +1 -0
- package/.nyc_output/processinfo/5ad8066b-6b8c-4bc8-b807-c40bf80898b7.json +1 -0
- package/.nyc_output/processinfo/5cbf674c-7089-4b7d-b9de-2119be4dbb0b.json +1 -0
- package/.nyc_output/processinfo/7853e29b-78ef-4ab4-b8fb-e1e176c0787b.json +1 -0
- package/.nyc_output/processinfo/9d414044-b18d-4f6d-b2e0-531a89bf6f4f.json +1 -0
- package/.nyc_output/processinfo/c3ffeb8c-8e79-4a2c-b678-e5a917fe721e.json +1 -0
- package/.nyc_output/processinfo/ea0194cb-f599-402f-8876-84fb8251e8db.json +1 -0
- package/.nyc_output/processinfo/eda6b7a3-5e15-440f-8619-e11a15a07f77.json +1 -0
- package/.nyc_output/processinfo/fb518800-240c-42ff-811f-79e92708d9db.json +1 -0
- package/.nyc_output/processinfo/fdecfc06-a944-4897-9530-e08f62883fc1.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/LICENSE +12 -0
- package/coverage/lcov-report/base.css +212 -0
- package/coverage/lcov-report/index.html +106 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +1 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +158 -0
- package/coverage/lcov-report/tar/index.html +93 -0
- package/coverage/lcov-report/tar/index.js.html +119 -0
- package/coverage/lcov-report/tar/lib/create.js.html +380 -0
- package/coverage/lcov-report/tar/lib/extract.js.html +401 -0
- package/coverage/lcov-report/tar/lib/header.js.html +881 -0
- package/coverage/lcov-report/tar/lib/high-level-opt.js.html +152 -0
- package/coverage/lcov-report/tar/lib/index.html +314 -0
- package/coverage/lcov-report/tar/lib/large-numbers.js.html +341 -0
- package/coverage/lcov-report/tar/lib/list.js.html +449 -0
- package/coverage/lcov-report/tar/lib/mkdir.js.html +686 -0
- package/coverage/lcov-report/tar/lib/pack.js.html +1268 -0
- package/coverage/lcov-report/tar/lib/parse.js.html +1310 -0
- package/coverage/lcov-report/tar/lib/pax.js.html +500 -0
- package/coverage/lcov-report/tar/lib/read-entry.js.html +347 -0
- package/coverage/lcov-report/tar/lib/replace.js.html +722 -0
- package/coverage/lcov-report/tar/lib/types.js.html +197 -0
- package/coverage/lcov-report/tar/lib/unpack.js.html +1604 -0
- package/coverage/lcov-report/tar/lib/update.js.html +173 -0
- package/coverage/lcov-report/tar/lib/warn-mixin.js.html +107 -0
- package/coverage/lcov-report/tar/lib/winchars.js.html +134 -0
- package/coverage/lcov-report/tar/lib/write-entry.js.html +1268 -0
- package/coverage/lcov.info +3690 -0
- package/lib/entry.js +7 -0
- package/lib/parse.js +11 -1
- package/package.json +4 -4
- package/test/link-file-entry-collision/bad-link.hex +25 -0
- package/test/link-file-entry-collision/bad-link.tar +0 -0
- package/test/link-file-entry-collision.js +39 -0
- package/test/parse-discard.js +29 -0
- package/.npmignore +0 -5
- package/LICENCE +0 -25
package/lib/entry.js
CHANGED
|
@@ -24,6 +24,7 @@ function Entry (header, extended, global) {
|
|
|
24
24
|
this._ending = false
|
|
25
25
|
this._ended = false
|
|
26
26
|
this._remaining = 0
|
|
27
|
+
this._abort = false
|
|
27
28
|
this._queue = []
|
|
28
29
|
this._index = 0
|
|
29
30
|
this._queueLen = 0
|
|
@@ -209,5 +210,11 @@ Entry.prototype._setProps = function () {
|
|
|
209
210
|
this._remaining = props.size
|
|
210
211
|
}
|
|
211
212
|
|
|
213
|
+
// the parser may not call write if _abort is true.
|
|
214
|
+
// useful for skipping data from some files quickly.
|
|
215
|
+
Entry.prototype.abort = function(){
|
|
216
|
+
this._abort = true
|
|
217
|
+
}
|
|
218
|
+
|
|
212
219
|
Entry.prototype.warn = fstream.warn
|
|
213
220
|
Entry.prototype.error = fstream.error
|
package/lib/parse.js
CHANGED
|
@@ -38,6 +38,7 @@ function Parse () {
|
|
|
38
38
|
me._stream = new BlockStream(512)
|
|
39
39
|
me.position = 0
|
|
40
40
|
me._ended = false
|
|
41
|
+
me._hardLinks = {}
|
|
41
42
|
|
|
42
43
|
me._stream.on("error", function (e) {
|
|
43
44
|
me.emit("error", e)
|
|
@@ -102,7 +103,11 @@ Parse.prototype._process = function (c) {
|
|
|
102
103
|
|
|
103
104
|
if (this._entry) {
|
|
104
105
|
var entry = this._entry
|
|
105
|
-
entry.write(c)
|
|
106
|
+
if(!entry._abort) entry.write(c)
|
|
107
|
+
else {
|
|
108
|
+
entry._remaining -= c.length
|
|
109
|
+
if(entry._remaining < 0) entry._remaining = 0
|
|
110
|
+
}
|
|
106
111
|
if (entry._remaining === 0) {
|
|
107
112
|
entry.end()
|
|
108
113
|
this._entry = null
|
|
@@ -247,6 +252,11 @@ Parse.prototype._startEntry = function (c) {
|
|
|
247
252
|
if (onend) entry.on("end", onend)
|
|
248
253
|
|
|
249
254
|
this._entry = entry
|
|
255
|
+
|
|
256
|
+
if (entry.type === "Link") {
|
|
257
|
+
this._hardLinks[entry.path] = entry
|
|
258
|
+
}
|
|
259
|
+
|
|
250
260
|
var me = this
|
|
251
261
|
|
|
252
262
|
entry.on("pause", function () {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
3
3
|
"name": "tar",
|
|
4
4
|
"description": "tar for node",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.2.2",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git://github.com/isaacs/node-tar.git"
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"block-stream": "*",
|
|
16
|
-
"fstream": "^1.0.
|
|
16
|
+
"fstream": "^1.0.12",
|
|
17
17
|
"inherits": "2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"graceful-fs": "^
|
|
20
|
+
"graceful-fs": "^4.1.2",
|
|
21
21
|
"rimraf": "1.x",
|
|
22
22
|
"tap": "0.x",
|
|
23
23
|
"mkdirp": "^0.5.0"
|
|
24
24
|
},
|
|
25
|
-
"license": "
|
|
25
|
+
"license": "ISC"
|
|
26
26
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- header for the link target --
|
|
2
|
+
6261642d6c696e6b2d74617267657400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000303030363434200030303037363520003030303032342000303030303030303030333420313334363636353530353620303134333731002030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # bad-link-target.....................................................................................000644..000765..000024..00000000034.13466655056.014371..0...................................................................................................
|
|
3
|
+
00757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # .ustar.00isaacs..........................staff...........................000000..000000.........................................................................................................................................................................
|
|
4
|
+
|
|
5
|
+
-- link target file contents (should not be overwritten) --
|
|
6
|
+
746869732073686f756c642072656d61696e207468652073616d650a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # this.should.remain.the.same.....................................................................................................................................................................................................................................
|
|
7
|
+
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
|
8
|
+
|
|
9
|
+
-- header for the link named a.txt --
|
|
10
|
+
612e74787400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003030303634342000303030373635200030303030323420003030303030303030303030203133343636363535303536203031353334320020316261642d6c696e6b2d746172676574000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # a.txt...............................................................................................000644..000765..000024..00000000000.13466655056.015342..1bad-link-target....................................................................................
|
|
11
|
+
00757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # .ustar.00isaacs..........................staff...........................000000..000000.........................................................................................................................................................................
|
|
12
|
+
|
|
13
|
+
-- header for file entry which attempts to overwrite the link --
|
|
14
|
+
612e7478740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000303030363434200030353737363120003030303032342000303030303030303034303120313136353133363033333320303132343531002030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # a.txt...............................................................................................000644..057761..000024..00000000401.11651360333.012451..0...................................................................................................
|
|
15
|
+
00757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # .ustar.00isaacs..........................staff...........................000000..000000.........................................................................................................................................................................
|
|
16
|
+
|
|
17
|
+
-- contents that threaten to overwrite the link target --
|
|
18
|
+
61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
19
|
+
61000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # a...............................................................................................................................................................................................................................................................
|
|
20
|
+
|
|
21
|
+
-- tar eof --
|
|
22
|
+
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
|
23
|
+
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
|
24
|
+
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
|
25
|
+
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
|
|
Binary file
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Set the umask, so that it works the same everywhere.
|
|
2
|
+
process.umask(parseInt('22', 8))
|
|
3
|
+
|
|
4
|
+
var tap = require("tap")
|
|
5
|
+
, tar = require("../tar.js")
|
|
6
|
+
, fs = require("fs")
|
|
7
|
+
, path = require("path")
|
|
8
|
+
, file = path.resolve(__dirname, "link-file-entry-collision/bad-link.tar")
|
|
9
|
+
, target = path.resolve(__dirname, "tmp/link-file-entry-collision")
|
|
10
|
+
, index = 0
|
|
11
|
+
, fstream = require("fstream")
|
|
12
|
+
, mkdirp = require("mkdirp")
|
|
13
|
+
, rimraf = require("rimraf")
|
|
14
|
+
|
|
15
|
+
tap.test("preclean", function (t) {
|
|
16
|
+
rimraf.sync(target)
|
|
17
|
+
t.pass("cleaned!")
|
|
18
|
+
t.end()
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
tap.test("extract test", function (t) {
|
|
22
|
+
var extract = tar.Extract(target)
|
|
23
|
+
var inp = fs.createReadStream(file)
|
|
24
|
+
inp.pipe(extract)
|
|
25
|
+
|
|
26
|
+
extract.on("end", function () {
|
|
27
|
+
t.equal(fs.readFileSync(target + "/bad-link-target", "utf8"),
|
|
28
|
+
"this should remain the same\n")
|
|
29
|
+
t.equal(fs.readFileSync(target + "/a.txt", "utf8"),
|
|
30
|
+
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
|
31
|
+
t.end()
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
tap.test("cleanup", function (t) {
|
|
36
|
+
rimraf.sync(target)
|
|
37
|
+
t.pass("cleaned!")
|
|
38
|
+
t.end()
|
|
39
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var tap = require("tap")
|
|
2
|
+
, tar = require("../tar.js")
|
|
3
|
+
, fs = require("fs")
|
|
4
|
+
, path = require("path")
|
|
5
|
+
, file = path.resolve(__dirname, "fixtures/c.tar")
|
|
6
|
+
|
|
7
|
+
tap.test("parser test", function (t) {
|
|
8
|
+
var parser = tar.Parse()
|
|
9
|
+
var total = 0
|
|
10
|
+
var dataTotal = 0
|
|
11
|
+
|
|
12
|
+
parser.on("end", function () {
|
|
13
|
+
|
|
14
|
+
t.equals(total-513,dataTotal,'should have discarded only c.txt')
|
|
15
|
+
|
|
16
|
+
t.end()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
fs.createReadStream(file)
|
|
20
|
+
.pipe(parser)
|
|
21
|
+
.on('entry',function(entry){
|
|
22
|
+
if(entry.path === 'c.txt') entry.abort()
|
|
23
|
+
|
|
24
|
+
total += entry.size;
|
|
25
|
+
entry.on('data',function(data){
|
|
26
|
+
dataTotal += data.length
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
})
|
package/.npmignore
DELETED
package/LICENCE
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
Copyright (c) Isaac Z. Schlueter
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
The BSD License
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions
|
|
8
|
-
are met:
|
|
9
|
-
1. Redistributions of source code must retain the above copyright
|
|
10
|
-
notice, this list of conditions and the following disclaimer.
|
|
11
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
12
|
-
notice, this list of conditions and the following disclaimer in the
|
|
13
|
-
documentation and/or other materials provided with the distribution.
|
|
14
|
-
|
|
15
|
-
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
16
|
-
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
17
|
-
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
18
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
19
|
-
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
20
|
-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
21
|
-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
22
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
23
|
-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
24
|
-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
25
|
-
POSSIBILITY OF SUCH DAMAGE.
|