Socket
Socket
Sign inDemoInstall

tar

Package Overview
Dependencies
6
Maintainers
4
Versions
126
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.7 to 3.1.8

2

lib/parse.js

@@ -60,3 +60,3 @@ 'use strict'

function noop () { return true }
const noop = _ => true

@@ -63,0 +63,0 @@ module.exports = warner(class Parser extends EE {

@@ -31,2 +31,3 @@ 'use strict'

const SKIP = Symbol('skip')
const DOCHOWN = Symbol('doChown')

@@ -53,2 +54,5 @@ class Unpack extends Parser {

this.processUid = this.preserveOwner ? process.getuid() : null
this.processGid = this.preserveOwner ? process.getgid() : null
// turn ><?| in filenames into 0xf000-higher encoded forms

@@ -170,2 +174,8 @@ this.win32 = !!opt.win32 || process.platform === 'win32'

[DOCHOWN] (entry) {
return this.preserveOwner &&
( typeof entry.uid === 'number' && entry.uid !== this.processUid ||
typeof entry.gid === 'number' && entry.gid !== this.processGid )
}
[FILE] (entry) {

@@ -175,10 +185,20 @@ const mode = entry.mode & 0o7777 || this.fmode

stream.on('error', er => this[ONERROR](er, entry))
const queue = []
const processQueue = _ => {
const action = queue.shift()
if (action)
action(processQueue)
else
this[UNPEND]()
}
stream.on('close', _ => {
if (entry.mtime && !this.noMtime)
fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, _ => _)
if (entry.uid && this.preserveOwner)
fs.chown(
entry.absolute, entry.uid, entry.gid || process.getgid(), _ => _
)
this[UNPEND]()
queue.push(cb =>
fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, cb))
if (this[DOCHOWN](entry))
queue.push(cb =>
fs.chown(entry.absolute, entry.uid, entry.gid || this.processGid, cb))
processQueue()
})

@@ -193,10 +213,22 @@ entry.pipe(stream)

return this[ONERROR](er, entry)
const queue = []
const processQueue = _ => {
const action = queue.shift()
if (action)
action(processQueue)
else {
this[UNPEND]()
entry.resume()
}
}
if (entry.mtime && !this.noMtime)
fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, _ => _)
if (entry.uid && this.preserveOwner)
fs.chown(
entry.absolute, entry.uid, entry.gid || process.getgid(), _ => _
)
this[UNPEND]()
entry.resume()
queue.push(cb =>
fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, cb))
if (this[DOCHOWN](entry))
queue.push(cb =>
fs.chown(entry.absolute, entry.uid, entry.gid || process.getgid(), cb))
processQueue()
})

@@ -336,3 +368,3 @@ }

}
if (entry.uid && this.preserveOwner) {
if (this[DOCHOWN](entry)) {
try {

@@ -357,3 +389,3 @@ fs.fchownSync(fd, entry.uid, entry.gid || process.getgid())

}
if (entry.uid && this.preserveOwner) {
if (this[DOCHOWN](entry)) {
try {

@@ -360,0 +392,0 @@ fs.chownSync(entry.absolute, entry.uid, entry.gid || process.getgid())

@@ -5,3 +5,3 @@ {

"description": "tar for node",
"version": "3.1.7",
"version": "3.1.8",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc