tar 4.4.10 → 4.4.14
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/lib/parse.js +6 -1
- package/lib/read-entry.js +4 -0
- package/lib/strip-absolute-path.js +14 -0
- package/lib/unpack.js +5 -4
- package/lib/write-entry.js +18 -15
- package/package.json +6 -3
- package/lib/.mkdir.js.swp +0 -0
package/lib/parse.js
CHANGED
|
@@ -102,7 +102,12 @@ module.exports = warner(class Parser extends EE {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
[CONSUMEHEADER] (chunk, position) {
|
|
105
|
-
|
|
105
|
+
let header
|
|
106
|
+
try {
|
|
107
|
+
header = new Header(chunk, position, this[EX], this[GEX])
|
|
108
|
+
} catch (er) {
|
|
109
|
+
return this.warn('invalid entry', er)
|
|
110
|
+
}
|
|
106
111
|
|
|
107
112
|
if (header.nullBlock)
|
|
108
113
|
this[EMIT]('nullBlock')
|
package/lib/read-entry.js
CHANGED
|
@@ -6,6 +6,10 @@ const SLURP = Symbol('slurp')
|
|
|
6
6
|
module.exports = class ReadEntry extends MiniPass {
|
|
7
7
|
constructor (header, ex, gex) {
|
|
8
8
|
super()
|
|
9
|
+
// read entries always start life paused. this is to avoid the
|
|
10
|
+
// situation where Minipass's auto-ending empty streams results
|
|
11
|
+
// in an entry ending before we're ready for it.
|
|
12
|
+
this.pause()
|
|
9
13
|
this.extended = ex
|
|
10
14
|
this.globalExtended = gex
|
|
11
15
|
this.header = header
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// unix absolute paths are also absolute on win32, so we use this for both
|
|
2
|
+
const { isAbsolute, parse } = require('path').win32
|
|
3
|
+
|
|
4
|
+
// returns [root, stripped]
|
|
5
|
+
module.exports = path => {
|
|
6
|
+
let r = ''
|
|
7
|
+
while (isAbsolute(path)) {
|
|
8
|
+
// windows will think that //x/y/z has a "root" of //x/y/
|
|
9
|
+
const root = path.charAt(0) === '/' ? '/' : parse(path).root
|
|
10
|
+
path = path.substr(root.length)
|
|
11
|
+
r += root
|
|
12
|
+
}
|
|
13
|
+
return [r, path]
|
|
14
|
+
}
|
package/lib/unpack.js
CHANGED
|
@@ -9,6 +9,7 @@ const path = require('path')
|
|
|
9
9
|
const mkdir = require('./mkdir.js')
|
|
10
10
|
const mkdirSync = mkdir.sync
|
|
11
11
|
const wc = require('./winchars.js')
|
|
12
|
+
const stripAbsolutePath = require('./strip-absolute-path.js')
|
|
12
13
|
|
|
13
14
|
const ONENTRY = Symbol('onEntry')
|
|
14
15
|
const CHECKFS = Symbol('checkFs')
|
|
@@ -195,10 +196,10 @@ class Unpack extends Parser {
|
|
|
195
196
|
|
|
196
197
|
// absolutes on posix are also absolutes on win32
|
|
197
198
|
// so we only need to test this one to get both
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
const s = stripAbsolutePath(p)
|
|
200
|
+
if (s[0]) {
|
|
201
|
+
entry.path = s[1]
|
|
202
|
+
this.warn(`stripping ${s[0]} from absolute path`, p)
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
205
|
|
package/lib/write-entry.js
CHANGED
|
@@ -26,6 +26,7 @@ const CLOSE = Symbol('close')
|
|
|
26
26
|
const MODE = Symbol('mode')
|
|
27
27
|
const warner = require('./warn-mixin.js')
|
|
28
28
|
const winchars = require('./winchars.js')
|
|
29
|
+
const stripAbsolutePath = require('./strip-absolute-path.js')
|
|
29
30
|
|
|
30
31
|
const modeFix = require('./mode-fix.js')
|
|
31
32
|
|
|
@@ -54,12 +55,12 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
|
|
|
54
55
|
if (typeof opt.onwarn === 'function')
|
|
55
56
|
this.on('warn', opt.onwarn)
|
|
56
57
|
|
|
57
|
-
if (!this.preservePaths
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
if (!this.preservePaths) {
|
|
59
|
+
const s = stripAbsolutePath(this.path)
|
|
60
|
+
if (s[0]) {
|
|
61
|
+
this.path = s[1]
|
|
62
|
+
this.warn('stripping ' + s[0] + ' from absolute path', p)
|
|
63
|
+
}
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
this.win32 = !!opt.win32 || process.platform === 'win32'
|
|
@@ -231,7 +232,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
|
|
|
231
232
|
er.path = this.absolute
|
|
232
233
|
er.syscall = 'read'
|
|
233
234
|
er.code = 'EOF'
|
|
234
|
-
this[CLOSE](fd)
|
|
235
|
+
this[CLOSE](fd, _ => _)
|
|
235
236
|
return this.emit('error', er)
|
|
236
237
|
}
|
|
237
238
|
|
|
@@ -240,7 +241,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
|
|
|
240
241
|
er.path = this.absolute
|
|
241
242
|
er.syscall = 'read'
|
|
242
243
|
er.code = 'EOF'
|
|
243
|
-
this[CLOSE](fd)
|
|
244
|
+
this[CLOSE](fd, _ => _)
|
|
244
245
|
return this.emit('error', er)
|
|
245
246
|
}
|
|
246
247
|
|
|
@@ -343,13 +344,15 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
|
|
|
343
344
|
if (typeof opt.onwarn === 'function')
|
|
344
345
|
this.on('warn', opt.onwarn)
|
|
345
346
|
|
|
346
|
-
if (
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
347
|
+
if (!this.preservePaths) {
|
|
348
|
+
const s = stripAbsolutePath(this.path)
|
|
349
|
+
if (s[0]) {
|
|
350
|
+
this.warn(
|
|
351
|
+
'stripping ' + s[0] + ' from absolute path',
|
|
352
|
+
this.path
|
|
353
|
+
)
|
|
354
|
+
this.path = s[1]
|
|
355
|
+
}
|
|
353
356
|
}
|
|
354
357
|
|
|
355
358
|
this.remain = readEntry.size
|
package/package.json
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
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": "4.4.
|
|
5
|
+
"version": "4.4.14",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"tag": "v4-legacy"
|
|
8
|
+
},
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
8
11
|
"url": "https://github.com/npm/node-tar.git"
|
|
@@ -18,7 +21,7 @@
|
|
|
18
21
|
"dependencies": {
|
|
19
22
|
"chownr": "^1.1.1",
|
|
20
23
|
"fs-minipass": "^1.2.5",
|
|
21
|
-
"minipass": "^2.
|
|
24
|
+
"minipass": "^2.8.6",
|
|
22
25
|
"minizlib": "^1.2.1",
|
|
23
26
|
"mkdirp": "^0.5.0",
|
|
24
27
|
"safe-buffer": "^5.1.2",
|
|
@@ -30,7 +33,7 @@
|
|
|
30
33
|
"events-to-array": "^1.1.2",
|
|
31
34
|
"mutate-fs": "^2.1.1",
|
|
32
35
|
"rimraf": "^2.6.3",
|
|
33
|
-
"tap": "^14.
|
|
36
|
+
"tap": "^14.6.5",
|
|
34
37
|
"tar-fs": "^1.16.3",
|
|
35
38
|
"tar-stream": "^1.6.2"
|
|
36
39
|
},
|
package/lib/.mkdir.js.swp
DELETED
|
Binary file
|