tar 4.4.3 → 4.4.4
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/README.md +3 -1
- package/lib/header.js +1 -1
- package/lib/mode-fix.js +14 -0
- package/lib/pack.js +1 -0
- package/lib/write-entry.js +13 -4
- package/package.json +1 -1
- package/lib/.unpack.js.swp +0 -0
package/README.md
CHANGED
|
@@ -534,7 +534,6 @@ The following options are supported:
|
|
|
534
534
|
- `mtime` Set to a `Date` object to force a specific `mtime` for
|
|
535
535
|
everything added to the archive. Overridden by `noMtime`.
|
|
536
536
|
|
|
537
|
-
|
|
538
537
|
#### add(path)
|
|
539
538
|
|
|
540
539
|
Adds an entry to the archive. Returns the Pack stream.
|
|
@@ -784,6 +783,9 @@ The following options are supported:
|
|
|
784
783
|
- `noMtime` Set to true to omit writing `mtime` values for entries.
|
|
785
784
|
Note that this prevents using other mtime-based features like
|
|
786
785
|
`tar.update` or the `keepNewer` option with the resulting tar archive.
|
|
786
|
+
- `umask` Set to restrict the modes on the entries in the archive,
|
|
787
|
+
somewhat like how umask works on file creation. Defaults to
|
|
788
|
+
`process.umask()` on unix systems, or `0o22` on Windows.
|
|
787
789
|
|
|
788
790
|
#### warn(message, data)
|
|
789
791
|
|
package/lib/header.js
CHANGED
package/lib/mode-fix.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
module.exports = (mode, isDir) => {
|
|
3
|
+
mode &= 0o7777
|
|
4
|
+
// if dirs are readable, then they should be listable
|
|
5
|
+
if (isDir) {
|
|
6
|
+
if (mode & 0o400)
|
|
7
|
+
mode |= 0o100
|
|
8
|
+
if (mode & 0o40)
|
|
9
|
+
mode |= 0o10
|
|
10
|
+
if (mode & 0o4)
|
|
11
|
+
mode |= 0o1
|
|
12
|
+
}
|
|
13
|
+
return mode
|
|
14
|
+
}
|
package/lib/pack.js
CHANGED
|
@@ -71,6 +71,7 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
71
71
|
this.linkCache = opt.linkCache || new Map()
|
|
72
72
|
this.statCache = opt.statCache || new Map()
|
|
73
73
|
this.readdirCache = opt.readdirCache || new Map()
|
|
74
|
+
|
|
74
75
|
this[WRITEENTRYCLASS] = WriteEntry
|
|
75
76
|
if (typeof opt.onwarn === 'function')
|
|
76
77
|
this.on('warn', opt.onwarn)
|
package/lib/write-entry.js
CHANGED
|
@@ -23,9 +23,12 @@ const ONREADLINK = Symbol('onreadlink')
|
|
|
23
23
|
const OPENFILE = Symbol('openfile')
|
|
24
24
|
const ONOPENFILE = Symbol('onopenfile')
|
|
25
25
|
const CLOSE = Symbol('close')
|
|
26
|
+
const MODE = Symbol('mode')
|
|
26
27
|
const warner = require('./warn-mixin.js')
|
|
27
28
|
const winchars = require('./winchars.js')
|
|
28
29
|
|
|
30
|
+
const modeFix = require('./mode-fix.js')
|
|
31
|
+
|
|
29
32
|
const WriteEntry = warner(class WriteEntry extends MiniPass {
|
|
30
33
|
constructor (p, opt) {
|
|
31
34
|
opt = opt || {}
|
|
@@ -104,6 +107,10 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
|
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
|
|
110
|
+
[MODE] (mode) {
|
|
111
|
+
return modeFix(mode, this.type === 'Directory')
|
|
112
|
+
}
|
|
113
|
+
|
|
107
114
|
[HEADER] () {
|
|
108
115
|
if (this.type === 'Directory' && this.portable)
|
|
109
116
|
this.noMtime = true
|
|
@@ -113,7 +120,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
|
|
|
113
120
|
linkpath: this.linkpath,
|
|
114
121
|
// only the permissions and setuid/setgid/sticky bitflags
|
|
115
122
|
// not the higher-order bits that specify file type
|
|
116
|
-
mode: this.stat.mode
|
|
123
|
+
mode: this[MODE](this.stat.mode),
|
|
117
124
|
uid: this.portable ? null : this.stat.uid,
|
|
118
125
|
gid: this.portable ? null : this.stat.gid,
|
|
119
126
|
size: this.stat.size,
|
|
@@ -312,9 +319,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
|
|
|
312
319
|
this.noMtime = true
|
|
313
320
|
|
|
314
321
|
this.path = readEntry.path
|
|
315
|
-
this.mode = readEntry.mode
|
|
316
|
-
if (this.mode)
|
|
317
|
-
this.mode = this.mode & 0o7777
|
|
322
|
+
this.mode = this[MODE](readEntry.mode)
|
|
318
323
|
this.uid = this.portable ? null : readEntry.uid
|
|
319
324
|
this.gid = this.portable ? null : readEntry.gid
|
|
320
325
|
this.uname = this.portable ? null : readEntry.uname
|
|
@@ -376,6 +381,10 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
|
|
|
376
381
|
readEntry.pipe(this)
|
|
377
382
|
}
|
|
378
383
|
|
|
384
|
+
[MODE] (mode) {
|
|
385
|
+
return modeFix(mode, this.type === 'Directory')
|
|
386
|
+
}
|
|
387
|
+
|
|
379
388
|
write (data) {
|
|
380
389
|
const writeLen = data.length
|
|
381
390
|
if (writeLen > this.blockRemain)
|
package/package.json
CHANGED
package/lib/.unpack.js.swp
DELETED
|
Binary file
|