tar 6.0.5 → 6.1.3

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/pax.js CHANGED
@@ -34,9 +34,8 @@ class Pax {
34
34
  const buf = Buffer.allocUnsafe(bufLen)
35
35
 
36
36
  // 0-fill the header section, it might not hit every field
37
- for (let i = 0; i < 512; i++) {
37
+ for (let i = 0; i < 512; i++)
38
38
  buf[i] = 0
39
- }
40
39
 
41
40
  new Header({
42
41
  // XXX split the path
@@ -55,15 +54,14 @@ class Pax {
55
54
  devmaj: 0,
56
55
  devmin: 0,
57
56
  atime: this.atime || null,
58
- ctime: this.ctime || null
57
+ ctime: this.ctime || null,
59
58
  }).encode(buf)
60
59
 
61
60
  buf.write(body, 512, bodyLen, 'utf8')
62
61
 
63
62
  // null pad after the body
64
- for (let i = bodyLen + 512; i < buf.length; i++) {
63
+ for (let i = bodyLen + 512; i < buf.length; i++)
65
64
  buf[i] = 0
66
- }
67
65
 
68
66
  return buf
69
67
  }
@@ -95,7 +93,7 @@ class Pax {
95
93
  : this[field]
96
94
  const s = ' ' +
97
95
  (field === 'dev' || field === 'ino' || field === 'nlink'
98
- ? 'SCHILY.' : '') +
96
+ ? 'SCHILY.' : '') +
99
97
  field + '=' + v + '\n'
100
98
  const byteLen = Buffer.byteLength(s)
101
99
  // the digits includes the length of the digits in ascii base-10
@@ -136,7 +134,7 @@ const parseKVLine = (set, line) => {
136
134
 
137
135
  const v = kv.join('=')
138
136
  set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k)
139
- ? new Date(v * 1000)
137
+ ? new Date(v * 1000)
140
138
  : /^[0-9]+$/.test(v) ? +v
141
139
  : v
142
140
  return set
package/lib/read-entry.js CHANGED
@@ -1,5 +1,4 @@
1
1
  'use strict'
2
- const types = require('./types.js')
3
2
  const MiniPass = require('minipass')
4
3
 
5
4
  const SLURP = Symbol('slurp')
@@ -63,8 +62,10 @@ module.exports = class ReadEntry extends MiniPass {
63
62
  this.uname = header.uname
64
63
  this.gname = header.gname
65
64
 
66
- if (ex) this[SLURP](ex)
67
- if (gex) this[SLURP](gex, true)
65
+ if (ex)
66
+ this[SLURP](ex)
67
+ if (gex)
68
+ this[SLURP](gex, true)
68
69
  }
69
70
 
70
71
  write (data) {
@@ -87,7 +88,7 @@ module.exports = class ReadEntry extends MiniPass {
87
88
  }
88
89
 
89
90
  [SLURP] (ex, global) {
90
- for (let k in ex) {
91
+ for (const k in ex) {
91
92
  // we slurp in everything except for the path attribute in
92
93
  // a global extended header, because that's weird.
93
94
  if (ex[k] !== null && ex[k] !== undefined &&
package/lib/replace.js CHANGED
@@ -3,7 +3,6 @@
3
3
  // tar -r
4
4
  const hlo = require('./high-level-opt.js')
5
5
  const Pack = require('./pack.js')
6
- const Parse = require('./parse.js')
7
6
  const fs = require('fs')
8
7
  const fsm = require('fs-minipass')
9
8
  const t = require('./list.js')
@@ -17,7 +16,7 @@ const path = require('path')
17
16
 
18
17
  const Header = require('./header.js')
19
18
 
20
- const r = module.exports = (opt_, files, cb) => {
19
+ module.exports = (opt_, files, cb) => {
21
20
  const opt = hlo(opt_)
22
21
 
23
22
  if (!opt.file)
@@ -68,10 +67,10 @@ const replaceSync = (opt, files) => {
68
67
  break POSITION
69
68
  }
70
69
 
71
- let h = new Header(headBuf)
70
+ const h = new Header(headBuf)
72
71
  if (!h.cksumValid)
73
72
  break
74
- let entryBlockSize = 512 * Math.ceil(h.size / 512)
73
+ const entryBlockSize = 512 * Math.ceil(h.size / 512)
75
74
  if (position + entryBlockSize + 512 > st.size)
76
75
  break
77
76
  // the 512 for the header we just parsed will be added as well
@@ -84,15 +83,18 @@ const replaceSync = (opt, files) => {
84
83
 
85
84
  streamSync(opt, p, position, fd, files)
86
85
  } finally {
87
- if (threw)
88
- try { fs.closeSync(fd) } catch (er) {}
86
+ if (threw) {
87
+ try {
88
+ fs.closeSync(fd)
89
+ } catch (er) {}
90
+ }
89
91
  }
90
92
  }
91
93
 
92
94
  const streamSync = (opt, p, position, fd, files) => {
93
95
  const stream = new fsm.WriteStreamSync(opt.file, {
94
96
  fd: fd,
95
- start: position
97
+ start: position,
96
98
  })
97
99
  p.pipe(stream)
98
100
  addFilesSync(p, files)
@@ -120,11 +122,12 @@ const replace = (opt, files, cb) => {
120
122
  if (er)
121
123
  return cb(er)
122
124
  bufPos += bytes
123
- if (bufPos < 512 && bytes)
125
+ if (bufPos < 512 && bytes) {
124
126
  return fs.read(
125
127
  fd, headBuf, bufPos, headBuf.length - bufPos,
126
128
  position + bufPos, onread
127
129
  )
130
+ }
128
131
 
129
132
  if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b)
130
133
  return cb(new Error('cannot append to compressed archives'))
@@ -173,7 +176,7 @@ const replace = (opt, files, cb) => {
173
176
  return reject(er)
174
177
  const stream = new fsm.WriteStream(opt.file, {
175
178
  fd: fd,
176
- start: position
179
+ start: position,
177
180
  })
178
181
  p.pipe(stream)
179
182
  stream.on('error', reject)
@@ -190,14 +193,14 @@ const replace = (opt, files, cb) => {
190
193
 
191
194
  const addFilesSync = (p, files) => {
192
195
  files.forEach(file => {
193
- if (file.charAt(0) === '@')
196
+ if (file.charAt(0) === '@') {
194
197
  t({
195
198
  file: path.resolve(p.cwd, file.substr(1)),
196
199
  sync: true,
197
200
  noResume: true,
198
- onentry: entry => p.add(entry)
201
+ onentry: entry => p.add(entry),
199
202
  })
200
- else
203
+ } else
201
204
  p.add(file)
202
205
  })
203
206
  p.end()
@@ -206,13 +209,13 @@ const addFilesSync = (p, files) => {
206
209
  const addFilesAsync = (p, files) => {
207
210
  while (files.length) {
208
211
  const file = files.shift()
209
- if (file.charAt(0) === '@')
212
+ if (file.charAt(0) === '@') {
210
213
  return t({
211
214
  file: path.resolve(p.cwd, file.substr(1)),
212
215
  noResume: true,
213
- onentry: entry => p.add(entry)
216
+ onentry: entry => p.add(entry),
214
217
  }).then(_ => addFilesAsync(p, files))
215
- else
218
+ } else
216
219
  p.add(file)
217
220
  }
218
221
  p.end()
@@ -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/types.js CHANGED
@@ -37,7 +37,7 @@ exports.name = new Map([
37
37
  // skip
38
38
  ['V', 'TapeVolumeHeader'],
39
39
  // like x
40
- ['X', 'OldExtendedHeader']
40
+ ['X', 'OldExtendedHeader'],
41
41
  ])
42
42
 
43
43
  // map the other direction
package/lib/unpack.js CHANGED
@@ -7,15 +7,14 @@
7
7
  // clobbering an fs object to create one of a different type.)
8
8
 
9
9
  const assert = require('assert')
10
- const EE = require('events').EventEmitter
11
10
  const Parser = require('./parse.js')
12
11
  const fs = require('fs')
13
12
  const fsm = require('fs-minipass')
14
13
  const path = require('path')
15
14
  const mkdir = require('./mkdir.js')
16
- const mkdirSync = mkdir.sync
17
15
  const wc = require('./winchars.js')
18
16
  const pathReservations = require('./path-reservations.js')
17
+ const stripAbsolutePath = require('./strip-absolute-path.js')
19
18
 
20
19
  const ONENTRY = Symbol('onEntry')
21
20
  const CHECKFS = Symbol('checkFs')
@@ -28,7 +27,6 @@ const LINK = Symbol('link')
28
27
  const SYMLINK = Symbol('symlink')
29
28
  const HARDLINK = Symbol('hardlink')
30
29
  const UNSUPPORTED = Symbol('unsupported')
31
- const UNKNOWN = Symbol('unknown')
32
30
  const CHECKPATH = Symbol('checkPath')
33
31
  const MKDIR = Symbol('mkdir')
34
32
  const ONERROR = Symbol('onError')
@@ -121,9 +119,10 @@ class Unpack extends Parser {
121
119
  // need both or neither
122
120
  if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number')
123
121
  throw new TypeError('cannot set owner without number uid and gid')
124
- if (opt.preserveOwner)
122
+ if (opt.preserveOwner) {
125
123
  throw new TypeError(
126
124
  'cannot preserve owner in archive and also set owner explicitly')
125
+ }
127
126
  this.uid = opt.uid
128
127
  this.gid = opt.gid
129
128
  this.setOwner = true
@@ -171,11 +170,14 @@ class Unpack extends Parser {
171
170
 
172
171
  this.cwd = path.resolve(opt.cwd || process.cwd())
173
172
  this.strip = +opt.strip || 0
174
- this.processUmask = process.umask()
173
+ // if we're not chmodding, then we don't need the process umask
174
+ this.processUmask = opt.noChmod ? 0 : process.umask()
175
175
  this.umask = typeof opt.umask === 'number' ? opt.umask : this.processUmask
176
+
176
177
  // default mode for dirs created as parents
177
178
  this.dmode = opt.dmode || (0o0777 & (~this.umask))
178
179
  this.fmode = opt.fmode || (0o0666 & (~this.umask))
180
+
179
181
  this.on('entry', entry => this[ONENTRY](entry))
180
182
  }
181
183
 
@@ -203,6 +205,8 @@ class Unpack extends Parser {
203
205
  if (parts.length < this.strip)
204
206
  return false
205
207
  entry.path = parts.slice(this.strip).join('/')
208
+ if (entry.path === '' && entry.type !== 'Directory' && entry.type !== 'GNUDumpDir')
209
+ return false
206
210
 
207
211
  if (entry.type === 'Link') {
208
212
  const linkparts = entry.linkpath.split(/\/|\\/)
@@ -223,11 +227,10 @@ class Unpack extends Parser {
223
227
 
224
228
  // absolutes on posix are also absolutes on win32
225
229
  // so we only need to test this one to get both
226
- if (path.win32.isAbsolute(p)) {
227
- const parsed = path.win32.parse(p)
228
- entry.path = p.substr(parsed.root.length)
229
- const r = parsed.root
230
- this.warn('TAR_ENTRY_INFO', `stripping ${r} from absolute path`, {
230
+ const [root, stripped] = stripAbsolutePath(p)
231
+ if (root) {
232
+ entry.path = stripped
233
+ this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, {
231
234
  entry,
232
235
  path: p,
233
236
  })
@@ -271,6 +274,7 @@ class Unpack extends Parser {
271
274
  case 'CharacterDevice':
272
275
  case 'BlockDevice':
273
276
  case 'FIFO':
277
+ default:
274
278
  return this[UNSUPPORTED](entry)
275
279
  }
276
280
  }
@@ -299,7 +303,8 @@ class Unpack extends Parser {
299
303
  unlink: this.unlink,
300
304
  cache: this.dirCache,
301
305
  cwd: this.cwd,
302
- mode: mode
306
+ mode: mode,
307
+ noChmod: this.noChmod,
303
308
  }, cb)
304
309
  }
305
310
 
@@ -308,11 +313,11 @@ class Unpack extends Parser {
308
313
  // in set owner mode, chown if setting doesn't match process
309
314
  return this.forceChown ||
310
315
  this.preserveOwner &&
311
- ( typeof entry.uid === 'number' && entry.uid !== this.processUid ||
312
- typeof entry.gid === 'number' && entry.gid !== this.processGid )
316
+ (typeof entry.uid === 'number' && entry.uid !== this.processUid ||
317
+ typeof entry.gid === 'number' && entry.gid !== this.processGid)
313
318
  ||
314
- ( typeof this.uid === 'number' && this.uid !== this.processUid ||
315
- typeof this.gid === 'number' && this.gid !== this.processGid )
319
+ (typeof this.uid === 'number' && this.uid !== this.processUid ||
320
+ typeof this.gid === 'number' && this.gid !== this.processGid)
316
321
  }
317
322
 
318
323
  [UID] (entry) {
@@ -328,7 +333,7 @@ class Unpack extends Parser {
328
333
  const stream = new fsm.WriteStream(entry.absolute, {
329
334
  flags: getFlag(entry.size),
330
335
  mode: mode,
331
- autoClose: false
336
+ autoClose: false,
332
337
  })
333
338
  stream.on('error', er => this[ONERROR](er, entry))
334
339
 
@@ -460,7 +465,21 @@ class Unpack extends Parser {
460
465
  paths.push(entry.linkpath)
461
466
  this.reservations.reserve(paths, done => this[CHECKFS2](entry, done))
462
467
  }
468
+
463
469
  [CHECKFS2] (entry, done) {
470
+ // if we are not creating a directory, and the path is in the dirCache,
471
+ // then that means we are about to delete the directory we created
472
+ // previously, and it is no longer going to be a directory, and neither
473
+ // is any of its children.
474
+ if (entry.type !== 'Directory') {
475
+ for (const path of this.dirCache.keys()) {
476
+ if (path === entry.absolute ||
477
+ path.indexOf(entry.absolute + '/') === 0 ||
478
+ path.indexOf(entry.absolute + '\\') === 0)
479
+ this.dirCache.delete(path)
480
+ }
481
+ }
482
+
464
483
  this[MKDIR](path.dirname(entry.absolute), this.dmode, er => {
465
484
  if (er) {
466
485
  done()
@@ -470,16 +489,17 @@ class Unpack extends Parser {
470
489
  if (st && (this.keep || this.newer && st.mtime > entry.mtime)) {
471
490
  this[SKIP](entry)
472
491
  done()
473
- } else if (er || this[ISREUSABLE](entry, st)) {
492
+ } else if (er || this[ISREUSABLE](entry, st))
474
493
  this[MAKEFS](null, entry, done)
475
- }
494
+
476
495
  else if (st.isDirectory()) {
477
496
  if (entry.type === 'Directory') {
478
- if (!entry.mode || (st.mode & 0o7777) === entry.mode)
497
+ if (!this.noChmod && (!entry.mode || (st.mode & 0o7777) === entry.mode))
479
498
  this[MAKEFS](null, entry, done)
480
- else
499
+ else {
481
500
  fs.chmod(entry.absolute, entry.mode,
482
501
  er => this[MAKEFS](er, entry, done))
502
+ }
483
503
  } else
484
504
  fs.rmdir(entry.absolute, er => this[MAKEFS](er, entry, done))
485
505
  } else
@@ -523,11 +543,16 @@ class Unpack extends Parser {
523
543
  }
524
544
 
525
545
  class UnpackSync extends Unpack {
526
- constructor (opt) {
527
- super(opt)
528
- }
529
-
530
546
  [CHECKFS] (entry) {
547
+ if (entry.type !== 'Directory') {
548
+ for (const path of this.dirCache.keys()) {
549
+ if (path === entry.absolute ||
550
+ path.indexOf(entry.absolute + '/') === 0 ||
551
+ path.indexOf(entry.absolute + '\\') === 0)
552
+ this.dirCache.delete(path)
553
+ }
554
+ }
555
+
531
556
  const er = this[MKDIR](path.dirname(entry.absolute), this.dmode, neverCalled)
532
557
  if (er)
533
558
  return this[ONERROR](er, entry)
@@ -541,7 +566,7 @@ class UnpackSync extends Unpack {
541
566
  try {
542
567
  if (st.isDirectory()) {
543
568
  if (entry.type === 'Directory') {
544
- if (entry.mode && (st.mode & 0o7777) !== entry.mode)
569
+ if (!this.noChmod && entry.mode && (st.mode & 0o7777) !== entry.mode)
545
570
  fs.chmodSync(entry.absolute, entry.mode)
546
571
  } else
547
572
  fs.rmdirSync(entry.absolute)
@@ -571,7 +596,6 @@ class UnpackSync extends Unpack {
571
596
  this[ONERROR](er || closeError, entry)
572
597
  }
573
598
 
574
- let stream
575
599
  let fd
576
600
  try {
577
601
  fd = fs.openSync(entry.absolute, getFlag(entry.size), mode)
@@ -659,7 +683,7 @@ class UnpackSync extends Unpack {
659
683
  unlink: this.unlink,
660
684
  cache: this.dirCache,
661
685
  cwd: this.cwd,
662
- mode: mode
686
+ mode: mode,
663
687
  })
664
688
  } catch (er) {
665
689
  return er
package/lib/update.js CHANGED
@@ -6,7 +6,7 @@ const hlo = require('./high-level-opt.js')
6
6
  const r = require('./replace.js')
7
7
  // just call tar.r with the filter and mtimeCache
8
8
 
9
- const u = module.exports = (opt_, files, cb) => {
9
+ module.exports = (opt_, files, cb) => {
10
10
  const opt = hlo(opt_)
11
11
 
12
12
  if (!opt.file)
package/lib/warn-mixin.js CHANGED
@@ -13,9 +13,9 @@ module.exports = Base => class extends Base {
13
13
  message = message.message
14
14
  }
15
15
  this.emit('warn', data.tarCode, message, data)
16
- } else if (message instanceof Error) {
16
+ } else if (message instanceof Error)
17
17
  this.emit('error', Object.assign(message, data))
18
- } else
18
+ else
19
19
  this.emit('error', Object.assign(new Error(`${code}: ${message}`), data))
20
20
  }
21
21
  }
package/lib/winchars.js CHANGED
@@ -8,7 +8,7 @@ const raw = [
8
8
  '<',
9
9
  '>',
10
10
  '?',
11
- ':'
11
+ ':',
12
12
  ]
13
13
 
14
14
  const win = raw.map(char =>
@@ -19,5 +19,5 @@ const toRaw = new Map(win.map((char, i) => [char, raw[i]]))
19
19
 
20
20
  module.exports = {
21
21
  encode: s => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s),
22
- decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s)
22
+ decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s),
23
23
  }
@@ -2,11 +2,9 @@
2
2
  const MiniPass = require('minipass')
3
3
  const Pax = require('./pax.js')
4
4
  const Header = require('./header.js')
5
- const ReadEntry = require('./read-entry.js')
6
5
  const fs = require('fs')
7
6
  const path = require('path')
8
7
 
9
- const types = require('./types.js')
10
8
  const maxReadSize = 16 * 1024 * 1024
11
9
  const PROCESS = Symbol('process')
12
10
  const FILE = Symbol('file')
@@ -25,6 +23,7 @@ const CLOSE = Symbol('close')
25
23
  const MODE = Symbol('mode')
26
24
  const warner = require('./warn-mixin.js')
27
25
  const winchars = require('./winchars.js')
26
+ const stripAbsolutePath = require('./strip-absolute-path.js')
28
27
 
29
28
  const modeFix = require('./mode-fix.js')
30
29
 
@@ -54,12 +53,12 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
54
53
  this.on('warn', opt.onwarn)
55
54
 
56
55
  let pathWarn = false
57
- if (!this.preservePaths && path.win32.isAbsolute(p)) {
58
- // absolutes on posix are also absolutes on win32
59
- // so we only need to test this one to get both
60
- const parsed = path.win32.parse(p)
61
- this.path = p.substr(parsed.root.length)
62
- pathWarn = parsed.root
56
+ if (!this.preservePaths) {
57
+ const [root, stripped] = stripAbsolutePath(this.path)
58
+ if (root) {
59
+ this.path = stripped
60
+ pathWarn = root
61
+ }
63
62
  }
64
63
 
65
64
  this.win32 = !!opt.win32 || process.platform === 'win32'
@@ -134,12 +133,12 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
134
133
  mtime: this.noMtime ? null : this.mtime || this.stat.mtime,
135
134
  type: this.type,
136
135
  uname: this.portable ? null :
137
- this.stat.uid === this.myuid ? this.myuser : '',
136
+ this.stat.uid === this.myuid ? this.myuser : '',
138
137
  atime: this.portable ? null : this.stat.atime,
139
- ctime: this.portable ? null : this.stat.ctime
138
+ ctime: this.portable ? null : this.stat.ctime,
140
139
  })
141
140
 
142
- if (this.header.encode() && !this.noPax)
141
+ if (this.header.encode() && !this.noPax) {
143
142
  this.write(new Pax({
144
143
  atime: this.portable ? null : this.header.atime,
145
144
  ctime: this.portable ? null : this.header.ctime,
@@ -152,8 +151,9 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
152
151
  uname: this.portable ? null : this.header.uname,
153
152
  dev: this.portable ? null : this.stat.dev,
154
153
  ino: this.portable ? null : this.stat.ino,
155
- nlink: this.portable ? null : this.stat.nlink
154
+ nlink: this.portable ? null : this.stat.nlink,
156
155
  }).encode())
156
+ }
157
157
  this.write(this.header.block)
158
158
  }
159
159
 
@@ -256,8 +256,8 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
256
256
  if (bytesRead === remain) {
257
257
  for (let i = bytesRead; i < length && bytesRead < blockRemain; i++) {
258
258
  buf[i + offset] = 0
259
- bytesRead ++
260
- remain ++
259
+ bytesRead++
260
+ remain++
261
261
  }
262
262
  }
263
263
 
@@ -286,10 +286,6 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
286
286
  })
287
287
 
288
288
  class WriteEntrySync extends WriteEntry {
289
- constructor (path, opt) {
290
- super(path, opt)
291
- }
292
-
293
289
  [LSTAT] () {
294
290
  this[ONLSTAT](fs.lstatSync(this.absolute))
295
291
  }
@@ -311,8 +307,11 @@ class WriteEntrySync extends WriteEntry {
311
307
  } finally {
312
308
  // ignoring the error from close(2) is a bad practice, but at
313
309
  // this point we already have an error, don't need another one
314
- if (threw)
315
- try { this[CLOSE](fd, () => {}) } catch (er) {}
310
+ if (threw) {
311
+ try {
312
+ this[CLOSE](fd, () => {})
313
+ } catch (er) {}
314
+ }
316
315
  }
317
316
  }
318
317
 
@@ -353,10 +352,12 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
353
352
  this.on('warn', opt.onwarn)
354
353
 
355
354
  let pathWarn = false
356
- if (path.isAbsolute(this.path) && !this.preservePaths) {
357
- const parsed = path.parse(this.path)
358
- pathWarn = parsed.root
359
- this.path = this.path.substr(parsed.root.length)
355
+ if (!this.preservePaths) {
356
+ const [root, stripped] = stripAbsolutePath(this.path)
357
+ if (root) {
358
+ this.path = stripped
359
+ pathWarn = root
360
+ }
360
361
  }
361
362
 
362
363
  this.remain = readEntry.size
@@ -375,7 +376,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
375
376
  type: this.type,
376
377
  uname: this.portable ? null : this.uname,
377
378
  atime: this.portable ? null : this.atime,
378
- ctime: this.portable ? null : this.ctime
379
+ ctime: this.portable ? null : this.ctime,
379
380
  })
380
381
 
381
382
  if (pathWarn) {
@@ -385,7 +386,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
385
386
  })
386
387
  }
387
388
 
388
- if (this.header.encode() && !this.noPax)
389
+ if (this.header.encode() && !this.noPax) {
389
390
  super.write(new Pax({
390
391
  atime: this.portable ? null : this.atime,
391
392
  ctime: this.portable ? null : this.ctime,
@@ -398,8 +399,9 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
398
399
  uname: this.portable ? null : this.uname,
399
400
  dev: this.portable ? null : this.readEntry.dev,
400
401
  ino: this.portable ? null : this.readEntry.ino,
401
- nlink: this.portable ? null : this.readEntry.nlink
402
+ nlink: this.portable ? null : this.readEntry.nlink,
402
403
  }).encode())
404
+ }
403
405
 
404
406
  super.write(this.header.block)
405
407
  readEntry.pipe(this)
package/package.json CHANGED
@@ -2,13 +2,17 @@
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": "6.0.5",
5
+ "version": "6.1.3",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/npm/node-tar.git"
9
9
  },
10
10
  "scripts": {
11
11
  "test": "tap",
12
+ "posttest": "npm run lint",
13
+ "eslint": "eslint",
14
+ "lint": "npm run eslint -- test lib",
15
+ "lintfix": "npm run lint -- --fix",
12
16
  "preversion": "npm test",
13
17
  "postversion": "npm publish",
14
18
  "prepublishOnly": "git push origin --follow-tags",
@@ -26,10 +30,15 @@
26
30
  "devDependencies": {
27
31
  "chmodr": "^1.2.0",
28
32
  "end-of-stream": "^1.4.3",
33
+ "eslint": "^7.17.0",
34
+ "eslint-plugin-import": "^2.22.1",
35
+ "eslint-plugin-node": "^11.1.0",
36
+ "eslint-plugin-promise": "^4.2.1",
37
+ "eslint-plugin-standard": "^5.0.0",
29
38
  "events-to-array": "^1.1.2",
30
39
  "mutate-fs": "^2.1.1",
31
40
  "rimraf": "^2.7.1",
32
- "tap": "^14.9.2",
41
+ "tap": "^15.0.9",
33
42
  "tar-fs": "^1.16.3",
34
43
  "tar-stream": "^1.6.2"
35
44
  },