diff --git a/map.js b/map.js index 1d7e33ae..e7ef1050 100644 --- a/map.js +++ b/map.js @@ -1,9 +1,12 @@ -const { basename } = require('path') +import { basename } from 'path' const map = test => - test === 'index.js' || test === 'map.js' ? test - : test === 'unpack.js' ? ['lib/unpack.js', 'lib/mkdir.js'] - : test === 'load-all.js' ? [] - : `lib/${test}` + test === 'map.js' + ? test + : test === 'unpack.js' + ? ['src/unpack.ts', 'src/mkdir.ts'] + : test === 'load-all.js' + ? [] + : `src/${test.replace(/js$/, 'ts')}` -module.exports = test => map(basename(test)) +export default test => map(basename(test)) diff --git a/package.json b/package.json index 7cfcb4f5..57eaf9a1 100644 --- a/package.json +++ b/package.json @@ -25,17 +25,18 @@ "chownr": "^3.0.0", "minipass": "^5.0.0", "minizlib": "^3.0.1", - "mkdirp": "^3.0.1" + "mkdirp": "^3.0.1", + "yallist": "^5.0.0" }, "devDependencies": { "chmodr": "^1.2.0", "end-of-stream": "^1.4.3", "events-to-array": "^2.0.3", "mutate-fs": "^2.1.1", - "nock": "^13.2.9", + "nock": "^13.5.4", "prettier": "^3.2.5", - "rimraf": "^3.0.2", - "tap": "^16.0.1", + "rimraf": "^5.0.5", + "tap": "^18.7.2", "tshy": "^1.13.1", "typedoc": "^0.25.13" }, diff --git a/scripts/generate-parse-fixtures.js b/scripts/generate-parse-fixtures.js index b46e8bd7..ff7d864f 100644 --- a/scripts/generate-parse-fixtures.js +++ b/scripts/generate-parse-fixtures.js @@ -1,9 +1,12 @@ -'use strict' -const Parse = require('../lib/parse.js') -const fs = require('fs') -const path = require('path') -const tardir = path.resolve(__dirname, '../test/fixtures/tars') -const parsedir = path.resolve(__dirname, '../test/fixtures/parse') +import { Parser } from '../dist/esm/parse.js' +import fs from 'fs' +import path, {dirname, resolve} from 'path' +import {fileURLToPath} from 'url' +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) + +const tardir = resolve(__dirname, '../test/fixtures/tars') +const parsedir = resolve(__dirname, '../test/fixtures/parse') const maxMetaOpt = [250, null] const filterOpt = [true, false] const strictOpt = [true, false] @@ -16,9 +19,9 @@ const makeTest = (tarfile, tardata, maxMeta, filter, strict) => { const tail = (o ? '-' + o : '') + '.json' const eventsfile = parsedir + '/' + path.basename(tarfile, '.tar') + tail - const p = new Parse({ + const p = new Parser({ maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, + filter: filter ? (_path, entry) => entry.size % 2 !== 0 : null, strict: strict, }) const events = [] @@ -70,7 +73,7 @@ const makeTest = (tarfile, tardata, maxMeta, filter, strict) => { p.on('entry', pushEntry('entry')) p.on('ignoredEntry', pushEntry('ignoredEntry')) - p.on('warn', (code, message, data) => events.push(['warn', code, message])) + p.on('warn', (code, message, _data) => events.push(['warn', code, message])) p.on('error', er => events.push(['error', { message: er.message, code: er.code, diff --git a/src/create.ts b/src/create.ts index b97eb2e8..85b27c38 100644 --- a/src/create.ts +++ b/src/create.ts @@ -130,16 +130,17 @@ const addFilesSync = (p: PackSync, files: string[]) => { const addFilesAsync = async ( p: Pack, files: string[], - i = 0, ): Promise => { - for (; i < files.length; i++) { + for (let i = 0; i < files.length; i++) { const file = String(files[i]) if (file.charAt(0) === '@') { - return list({ + await list({ file: path.resolve(String(p.cwd), file.slice(1)), noResume: true, - onentry: entry => p.add(entry), - }).then(_ => addFilesAsync(p, files)) + onentry: entry => { + p.add(entry) + }, + }) } else { p.add(file) } diff --git a/src/cwd-error.ts b/src/cwd-error.ts index 7a708ed4..bdc48046 100644 --- a/src/cwd-error.ts +++ b/src/cwd-error.ts @@ -4,7 +4,7 @@ export class CwdError extends Error { syscall: 'chdir' = 'chdir' constructor(path: string, code: string) { - super(code + ": Cannot cd into '" + path + "'") + super(`${code}: Cannot cd into '${path}'`) this.path = path this.code = code } diff --git a/src/extract.ts b/src/extract.ts index f79f9408..b3cb3b0b 100644 --- a/src/extract.ts +++ b/src/extract.ts @@ -132,7 +132,7 @@ const extractFileSync = (opt: TarOptionsSyncFile) => { const extractFile = ( opt: TarOptionsFile, - cb: () => void = () => {}, + cb?: () => void, ) => { const u = new Unpack(opt) const readSize = opt.maxReadSize || 16 * 1024 * 1024 diff --git a/src/get-write-flag.ts b/src/get-write-flag.ts index db358591..bd8842dc 100644 --- a/src/get-write-flag.ts +++ b/src/get-write-flag.ts @@ -5,21 +5,19 @@ // library is used for is extracting tarballs of many // relatively small files in npm packages and the like, // it can be a big boost on Windows platforms. -// Only supported in Node v12.9.0 and above. + +import fs from 'fs' + const platform = process.env.__FAKE_PLATFORM__ || process.platform const isWindows = platform === 'win32' -const g = globalThis as typeof globalThis & { - __FAKE_TESTING_FS__: typeof import('fs') -} -const fs = g.__FAKE_TESTING_FS__ || require('fs') -/* istanbul ignore next */ -const { - O_CREAT, - O_TRUNC, - O_WRONLY, - UV_FS_O_FILEMAP = 0, -} = fs.constants +/* c8 ignore start */ +const { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants +const UV_FS_O_FILEMAP = + Number(process.env.__FAKE_FS_O_FILENAME__) || + fs.constants.UV_FS_O_FILEMAP || + 0 +/* c8 ignore stop */ const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP const fMapLimit = 512 * 1024 diff --git a/src/header.ts b/src/header.ts index b9efbda6..e648876e 100644 --- a/src/header.ts +++ b/src/header.ts @@ -15,7 +15,7 @@ export type HeaderData = { gid?: number size?: number cksum?: number - type?: EntryTypeCode | EntryTypeName + type?: EntryTypeName | 'Unsupported' linkpath?: string uname?: string gname?: string @@ -46,7 +46,7 @@ export class Header implements HeaderData { gid?: number size?: number cksum?: number - #type: EntryTypeCode = '0' + #type: EntryTypeCode | 'Unsupported' = 'Unsupported' linkpath?: string uname?: string gname?: string @@ -101,10 +101,8 @@ export class Header implements HeaderData { // old tar versions marked dirs as a file with a trailing / const t = decString(buf, off + 156, 1) - if (types.isCode(t)) this.#type = t - else this.#type = '0' - if (this.#type === '') { - this.#type = '0' + if (types.isCode(t)) { + this.#type = t || '0' } if (this.#type === '0' && this.path.slice(-1) === '/') { this.#type = '5' @@ -126,8 +124,10 @@ export class Header implements HeaderData { ) { this.uname = decString(buf, off + 265, 32) this.gname = decString(buf, off + 297, 32) + /* c8 ignore start */ this.devmaj = decNumber(buf, off + 329, 8) ?? 0 this.devmin = decNumber(buf, off + 337, 8) ?? 0 + /* c8 ignore stop */ if (buf[off + 475] !== 0) { // definitely a prefix, definitely >130 chars. const prefix = decString(buf, off + 345, 155) @@ -152,7 +152,7 @@ export class Header implements HeaderData { } this.cksumValid = sum === this.cksum - if (this.cksum === null && sum === 8 * 0x20) { + if (this.cksum === undefined && sum === 8 * 0x20) { this.nullBlock = true } } @@ -180,6 +180,10 @@ export class Header implements HeaderData { buf = this.block = Buffer.alloc(512) } + if (this.#type === 'Unsupported') { + this.#type = '0' + } + if (!(buf.length >= off + 512)) { throw new Error('need 512 bytes for header') } @@ -244,16 +248,20 @@ export class Header implements HeaderData { } get type(): EntryTypeName { - return types.name.get(this.#type) as EntryTypeName + return ( + this.#type === 'Unsupported' + ? this.#type + : types.name.get(this.#type) + ) as EntryTypeName } - get typeKey(): EntryTypeCode { + get typeKey(): EntryTypeCode | 'Unsupported' { return this.#type } - set type(type: EntryTypeCode | EntryTypeName) { + set type(type: EntryTypeCode | EntryTypeName | 'Unsupported') { const c = String(types.code.get(type as EntryTypeName)) - if (types.isCode(c)) { + if (types.isCode(c) || c === 'Unsupported') { this.#type = c } else if (types.isCode(type)) { this.#type = type diff --git a/src/list.ts b/src/list.ts index a31a4397..7ba43143 100644 --- a/src/list.ts +++ b/src/list.ts @@ -8,6 +8,7 @@ import { isSyncFile, TarOptions, TarOptionsFile, + TarOptionsSyncFile, TarOptionsWithAliases, TarOptionsWithAliasesFile, TarOptionsWithAliasesSync, @@ -126,7 +127,7 @@ const filesFilter = (opt: TarOptions, files: string[]) => { : file => mapHas(stripTrailingSlashes(file)) } -const listFileSync = (opt: TarOptionsWithAliasesSyncFile) => { +const listFileSync = (opt: TarOptionsSyncFile) => { const p = list_(opt) const file = opt.file let threw = true @@ -152,12 +153,13 @@ const listFileSync = (opt: TarOptionsWithAliasesSyncFile) => { if (threw && fd) { try { fs.closeSync(fd) + /* c8 ignore next */ } catch (er) {} } } } -const listFile = (opt: TarOptionsFile, cb?: () => void) => { +const listFile = (opt: TarOptionsFile, cb?: () => void): Promise => { const parse = new Parser(opt) const readSize = opt.maxReadSize || 16 * 1024 * 1024 diff --git a/src/mkdir.ts b/src/mkdir.ts index 6c84654b..cf98d1ac 100644 --- a/src/mkdir.ts +++ b/src/mkdir.ts @@ -65,6 +65,7 @@ export const mkdir = ( // if there's any overlap between mask and mode, // then we'll need an explicit chmod + /* c8 ignore next */ const umask = opt.umask ?? 0o22 const mode = opt.mode | 0o0700 const needChmod = (mode & umask) !== 0 @@ -215,6 +216,7 @@ export const mkdirSync = (dir: string, opt: MkdirOptions) => { dir = normalizeWindowsPath(dir) // if there's any overlap between mask and mode, // then we'll need an explicit chmod + /* c8 ignore next */ const umask = opt.umask ?? 0o22 const mode = opt.mode | 0o700 const needChmod = (mode & umask) !== 0 diff --git a/src/options.ts b/src/options.ts index 4449b718..a612f142 100644 --- a/src/options.ts +++ b/src/options.ts @@ -435,18 +435,18 @@ export interface TarOptionsWithAliases extends TarOptions { export type TarOptionsWithAliasesSync = TarOptionsWithAliases & { sync: true } -export type TarOptionsWithAliasesFile = TarOptionsWithAliases & { - file: string -} +export type TarOptionsWithAliasesFile = + | (TarOptionsWithAliases & { + file: string + }) + | (TarOptionsWithAliases & { f: string }) export type TarOptionsWithAliasesSyncFile = TarOptionsWithAliasesSync & TarOptionsWithAliasesFile export const isSyncFile = (o: TarOptions): o is TarOptionsSyncFile => !!o.sync && !!o.file -export const isSync = (o: TarOptions): o is TarOptionsSync => - !!o.sync -export const isFile = (o: TarOptions): o is TarOptionsFile => - !!o.file +export const isSync = (o: TarOptions): o is TarOptionsSync => !!o.sync +export const isFile = (o: TarOptions): o is TarOptionsFile => !!o.file const dealiasKey = ( k: keyof TarOptionsWithAliases, diff --git a/src/pack.ts b/src/pack.ts index 4dc7e3b5..07d6500f 100644 --- a/src/pack.ts +++ b/src/pack.ts @@ -8,17 +8,6 @@ // streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) import fs, { type Stats } from 'fs' -import { Minipass } from 'minipass' -import { BrotliCompress, Gzip } from 'minizlib' -import path from 'path' -import { normalizeWindowsPath } from './normalize-windows-path.js' -import { dealias, LinkCacheKey, TarOptions } from './options.js' -import { ReadEntry } from './read-entry.js' -import { - warnMethod, - type WarnData, - type Warner, -} from './warn-method.js' import { WriteEntry, WriteEntrySync, @@ -34,13 +23,23 @@ export class PackJob { pending: boolean = false ignore: boolean = false piped: boolean = false - constructor(path: string, absolute: string) { this.path = path || './' this.absolute = absolute } } +import { Minipass } from 'minipass' +import * as zlib from 'minizlib' +//@ts-ignore +import { Yallist } from 'yallist' +import { ReadEntry } from './read-entry.js' +import { + warnMethod, + type WarnData, + type Warner, +} from './warn-method.js' + const EOF = Buffer.alloc(1024) const ONSTAT = Symbol('onStat') const ENDED = Symbol('ended') @@ -63,20 +62,24 @@ const WRITEENTRYCLASS = Symbol('writeEntryClass') const WRITE = Symbol('write') const ONDRAIN = Symbol('ondrain') +import path from 'path' +import { normalizeWindowsPath } from './normalize-windows-path.js' +import { TarOptions } from './options.js' + export class Pack extends Minipass implements Warner { opt: TarOptions - file: string cwd: string maxReadSize?: number preservePaths: boolean strict: boolean noPax: boolean prefix: string - linkCache: Map - statCache: Map - readdirCache: Map + linkCache: Exclude + statCache: Exclude + file: string portable: boolean - zip?: Gzip | BrotliCompress + zip?: zlib.BrotliCompress | zlib.Gzip + readdirCache: Exclude noDirRecurse: boolean follow: boolean noMtime: boolean @@ -84,17 +87,14 @@ export class Pack extends Minipass implements Warner { filter: Exclude jobs: number; - [WRITEENTRYCLASS]: - | typeof WriteEntry - | typeof WriteEntrySync - [QUEUE]: PackJob[] = []; + [WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync; + [QUEUE]: Yallist; [JOBS]: number = 0; [PROCESSING]: boolean = false; [ENDED]: boolean = false - constructor(opt_: TarOptions = {}) { + constructor(opt: TarOptions = {}) { super() - const opt = dealias(opt_) this.opt = opt this.file = opt.file || '' this.cwd = opt.cwd || process.cwd() @@ -125,15 +125,17 @@ export class Pack extends Minipass implements Warner { if (this.portable) { opt.gzip.portable = true } - this.zip = new Gzip(opt.gzip) + this.zip = new zlib.Gzip(opt.gzip) } if (opt.brotli) { if (typeof opt.brotli !== 'object') { opt.brotli = {} } - this.zip = new BrotliCompress(opt.brotli) + this.zip = new zlib.BrotliCompress(opt.brotli) } - const zip = this.zip as Gzip | BrotliCompress + /* c8 ignore next */ + if (!this.zip) throw new Error('impossible') + const zip = this.zip zip.on('data', chunk => super.write(chunk)) zip.on('end', () => super.end()) zip.on('drain', () => this[ONDRAIN]()) @@ -145,21 +147,18 @@ export class Pack extends Minipass implements Warner { this.noDirRecurse = !!opt.noDirRecurse this.follow = !!opt.follow this.noMtime = !!opt.noMtime - this.mtime = opt.mtime + if (opt.mtime) this.mtime = opt.mtime this.filter = - typeof opt.filter === 'function' ? opt.filter : () => true + typeof opt.filter === 'function' ? opt.filter : _ => true + this[QUEUE] = new Yallist() this[JOBS] = 0 this.jobs = Number(opt.jobs) || 4 this[PROCESSING] = false this[ENDED] = false } - warn(code: string, message: string | Error, data: WarnData = {}) { - return warnMethod(this, code, message, data) - } - [WRITE](chunk: Buffer) { return super.write(chunk) } @@ -169,20 +168,10 @@ export class Pack extends Minipass implements Warner { return this } - end(cb?: () => void): this - end(path: string, cb?: () => void): this - end( - path: string, - encoding?: Minipass.Encoding | undefined, - cb?: () => void, - ): this - end( - path?: string | (() => void), - _encoding?: Minipass.Encoding | (() => void), - _cb?: () => void, - ) { - if (typeof path === 'string') { - this.write(path) + //@ts-ignore + end(path?: string | ReadEntry) { + if (path) { + this.add(path) } this[ENDED] = true this[PROCESS]() @@ -213,7 +202,7 @@ export class Pack extends Minipass implements Warner { } else { const job = new PackJob(p.path, absolute) job.entry = new WriteEntryTar(p, this[ENTRYOPT](job)) - job.entry.on('end', _ => this[JOBDONE](job)) + job.entry.on('end', () => this[JOBDONE](job)) this[JOBS] += 1 this[QUEUE].push(job) } @@ -280,13 +269,15 @@ export class Pack extends Minipass implements Warner { this[PROCESSING] = true for ( - let j: PackJob | undefined, w = 0; - (j = this[QUEUE][w]) && this[JOBS] < this.jobs; - w ++ + let w = this[QUEUE].head; + !!w && this[JOBS] < this.jobs; + w = w.next ) { - this[PROCESSJOB](j) - if (j.ignore) { - this[QUEUE].splice(w, 1) + this[PROCESSJOB](w.value) + if (w.value.ignore) { + const p = w.next + this[QUEUE].removeNode(w) + w.next = p } } @@ -303,7 +294,7 @@ export class Pack extends Minipass implements Warner { } get [CURRENT]() { - return this[QUEUE] && this[QUEUE][0] + return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value } [JOBDONE](_job: PackJob) { @@ -346,9 +337,8 @@ export class Pack extends Minipass implements Warner { job.stat.isDirectory() && !job.readdir ) { - const rc = this.readdirCache.get(job.absolute) - if ( rc) { + if (rc) { this[ONREADDIR](job, rc) } else { this[READDIR](job) @@ -391,8 +381,7 @@ export class Pack extends Minipass implements Warner { [ENTRY](job: PackJob) { this[JOBS] += 1 try { - const Cls = this[WRITEENTRYCLASS] - return new Cls(job.path, this[ENTRYOPT](job)) + return new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)) .on('end', () => this[JOBDONE](job)) .on('error', er => this.emit('error', er)) } catch (er) { @@ -420,11 +409,8 @@ export class Pack extends Minipass implements Warner { const source = job.entry const zip = this.zip - /* c8 ignore start */ - if (!source) { - throw new Error('must have source before piping') - } + if (!source) throw new Error('cannot pipe without source') /* c8 ignore stop */ if (zip) { @@ -448,6 +434,13 @@ export class Pack extends Minipass implements Warner { } return super.pause() } + warn( + code: string, + message: string | Error, + data: WarnData = {}, + ): void { + warnMethod(this, code, message, data) + } } export class PackSync extends Pack { @@ -472,11 +465,6 @@ export class PackSync extends Pack { // gotta get it all in this tick [PIPE](job: PackJob) { const source = job.entry - /* c8 ignore start */ - if (!source) { - throw new Error('job without source') - } - /* c8 ignore stop */ const zip = this.zip if (job.readdir) { @@ -487,6 +475,10 @@ export class PackSync extends Pack { }) } + /* c8 ignore start */ + if (!source) throw new Error('Cannot pipe without source') + /* c8 ignore stop */ + if (zip) { source.on('data', chunk => { zip.write(chunk) diff --git a/src/parse.ts b/src/parse.ts index 7912fef0..d0b0781e 100644 --- a/src/parse.ts +++ b/src/parse.ts @@ -20,6 +20,7 @@ import { EventEmitter as EE } from 'events' import { BrotliDecompress, Unzip } from 'minizlib' +import { Yallist } from 'yallist' import { Header } from './header.js' import { TarOptions } from './options.js' import { Pax } from './pax.js' @@ -78,7 +79,8 @@ export class Parser extends EE implements Warner { writable: true = true readable: false = false; - [QUEUE]: (ReadEntry | [string | symbol, any, any])[] = []; + [QUEUE]: Yallist = + new Yallist(); [BUFFER]?: Buffer; [READENTRY]?: ReadEntry; [WRITEENTRY]?: ReadEntry; @@ -161,7 +163,7 @@ export class Parser extends EE implements Warner { } [CONSUMEHEADER](chunk: Buffer, position: number) { - if (this[SAW_VALID_ENTRY] === null) { + if (this[SAW_VALID_ENTRY] === undefined) { this[SAW_VALID_ENTRY] = false } let header @@ -322,8 +324,8 @@ export class Parser extends EE implements Warner { if (!entry) { throw new Error('attempt to consume body without entry??') } - /* c8 ignore stop */ const br = entry.blockRemain ?? 0 + /* c8 ignore stop */ const c = br >= chunk.length && position === 0 ? chunk @@ -387,9 +389,10 @@ export class Parser extends EE implements Warner { break } - /* istanbul ignore next */ + /* c8 ignore start */ default: throw new Error('unknown meta: ' + entry.type) + /* c8 ignore stop */ } } @@ -422,7 +425,7 @@ export class Parser extends EE implements Warner { // look for gzip header for ( let i = 0; - this[UNZIP] === null && i < gzipHeader.length; + this[UNZIP] === undefined && i < gzipHeader.length; i++ ) { if (chunk[i] !== gzipHeader[i]) { @@ -456,7 +459,7 @@ export class Parser extends EE implements Warner { } if ( - this[UNZIP] === null || + this[UNZIP] === undefined || (this[UNZIP] === false && this.brotli) ) { const ended = this[ENDED] @@ -595,9 +598,10 @@ export class Parser extends EE implements Warner { position += this[CONSUMEMETA](chunk, position) break - /* istanbul ignore next */ + /* c8 ignore start */ default: throw new Error('invalid state: ' + this[STATE]) + /* c8 ignore stop */ } } @@ -616,13 +620,16 @@ export class Parser extends EE implements Warner { end(chunk?: Buffer) { if (!this[ABORTED]) { if (this[UNZIP]) { + /* c8 ignore start */ if (chunk) this[UNZIP].write(chunk) + /* c8 ignore stop */ this[UNZIP].end() } else { this[ENDED] = true if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0) if (chunk) this.write(chunk) + this[MAYBEEND]() } } } diff --git a/src/path-reservations.ts b/src/path-reservations.ts index 711e9ee2..79407710 100644 --- a/src/path-reservations.ts +++ b/src/path-reservations.ts @@ -95,10 +95,11 @@ export class PathReservations { dirs: (Handler | Set)[][] } { const res = this.#reservations.get(fn) - /* istanbul ignore if - unpossible */ + /* c8 ignore start */ if (!res) { throw new Error('function does not have any path reservations') } + /* c8 ignore stop */ return { paths: res.paths.map((path: string) => this.#queues.get(path), @@ -168,7 +169,8 @@ export class PathReservations { for (const dir of dirs) { const q = this.#queues.get(dir) const q0 = q?.[0] - if (!(q0 instanceof Set) || !q) continue + /* c8 ignore next - type safety only */ + if (!q || !(q0 instanceof Set)) continue if (q0.size === 1 && q.length === 1) { this.#queues.delete(dir) continue diff --git a/src/pax.ts b/src/pax.ts index 7c542c95..680c9234 100644 --- a/src/pax.ts +++ b/src/pax.ts @@ -28,18 +28,19 @@ export class Pax implements HeaderData { this.atime = obj.atime this.charset = obj.charset this.comment = obj.comment + this.ctime = obj.ctime + this.dev = obj.dev this.gid = obj.gid + this.global = global this.gname = obj.gname + this.ino = obj.ino this.linkpath = obj.linkpath this.mtime = obj.mtime + this.nlink = obj.nlink this.path = obj.path this.size = obj.size this.uid = obj.uid this.uname = obj.uname - this.dev = obj.dev - this.ino = obj.ino - this.nlink = obj.nlink - this.global = global } encode() { @@ -63,7 +64,9 @@ export class Pax implements HeaderData { // XXX split the path // then the path should be PaxHeader + basename, but less than 99, // prepend with the dirname - path: ('PaxHeader/' + basename(this.path || '')).slice(0, 99), + /* c8 ignore start */ + path: ('PaxHeader/' + basename(this.path ?? '')).slice(0, 99), + /* c8 ignore stop */ mode: this.mode || 0o644, uid: this.uid, gid: this.gid, @@ -163,14 +166,12 @@ const parseKVLine = (set: Record, line: string) => { const kv = line.split('=') const r = kv.shift() - /* c8 ignore next */ - if (!r) throw new Error('fell of key/value list somehow') - - const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1') - if (!k) { + if (!r) { return set } + const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1') + const v = kv.join('=') set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? new Date(Number(v) * 1000) diff --git a/src/read-entry.ts b/src/read-entry.ts index 98260ee7..a4ca7eb7 100644 --- a/src/read-entry.ts +++ b/src/read-entry.ts @@ -42,7 +42,9 @@ export class ReadEntry extends Minipass { this.extended = ex this.globalExtended = gex this.header = header + /* c8 ignore start */ this.remain = header.size ?? 0 + /* c8 ignore stop */ this.startBlockSize = 512 * Math.ceil(this.remain / 512) this.blockRemain = this.startBlockSize this.type = header.type @@ -93,9 +95,11 @@ export class ReadEntry extends Minipass { this.mtime = header.mtime this.atime = header.atime this.ctime = header.ctime + /* c8 ignore start */ this.linkpath = header.linkpath ? normalizeWindowsPath(header.linkpath) : undefined + /* c8 ignore stop */ this.uname = header.uname this.gname = header.gname diff --git a/src/replace.ts b/src/replace.ts index 1d45445d..579b9b78 100644 --- a/src/replace.ts +++ b/src/replace.ts @@ -219,6 +219,7 @@ const replace_ = ( return cb(null, position) } + /* c8 ignore next */ const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512) if (position + entryBlockSize + 512 > size) { return cb(null, position) @@ -299,16 +300,15 @@ const addFilesSync = (p: Pack, files: string[]) => { const addFilesAsync = async ( p: Pack, files: string[], - i = 0, ): Promise => { - for (; i < files.length; i++) { + for (let i = 0; i < files.length; i++) { const file = String(files[i]) if (file.charAt(0) === '@') { - return list({ + await list({ file: path.resolve(String(p.cwd), file.slice(1)), noResume: true, onentry: entry => p.add(entry), - }).then(_ => addFilesAsync(p, files)) + }) } else { p.add(file) } diff --git a/src/symlink-error.ts b/src/symlink-error.ts index c237cb94..7aa5ea78 100644 --- a/src/symlink-error.ts +++ b/src/symlink-error.ts @@ -4,7 +4,7 @@ export class SymlinkError extends Error { syscall: 'symlink' = 'symlink' code: 'TAR_SYMLINK_ERROR' = 'TAR_SYMLINK_ERROR' constructor (symlink: string, path: string) { - super('Cannot extract through symbolic link') + super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link') this.symlink = symlink this.path = path } diff --git a/src/types.ts b/src/types.ts index 080995a6..96b8f74b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -49,6 +49,7 @@ export type EntryTypeName = | 'SparseFile' | 'TapeVolumeHeader' | 'OldExtendedHeader' + | 'Unsupported' // map types from key to human-friendly name export const name = new Map([ diff --git a/src/unpack.ts b/src/unpack.ts index 064bbcf9..26e857cc 100644 --- a/src/unpack.ts +++ b/src/unpack.ts @@ -68,7 +68,7 @@ const DEFAULT_MAX_DEPTH = 1024 // semantics. // // See: https://github.com/npm/node-tar/issues/183 -/* istanbul ignore next */ +/* c8 ignore start */ const unlinkFile = ( path: string, cb: (er?: Error | null) => void, @@ -85,8 +85,9 @@ const unlinkFile = ( fs.unlink(name, cb) }) } +/* c8 ignore stop */ -/* istanbul ignore next */ +/* c8 ignore start */ const unlinkFileSync = (path: string) => { if (!isWindows) { return fs.unlinkSync(path) @@ -96,6 +97,7 @@ const unlinkFileSync = (path: string) => { fs.renameSync(path, name) fs.unlinkSync(name) } +/* c8 ignore stop */ // this.gid, entry.gid, this.processUid const uint32 = ( @@ -331,6 +333,7 @@ export class Unpack extends Parser { if (!this.preservePaths) { if ( parts.includes('..') || + /* c8 ignore next */ (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? '')) ) { this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { @@ -366,7 +369,7 @@ export class Unpack extends Parser { // if we somehow ended up with a path that escapes the cwd, and we are // not in preservePaths mode, then something is fishy! This should have // been prevented above, so ignore this for coverage. - /* istanbul ignore if - defense in depth */ + /* c8 ignore start - defense in depth */ if ( !this.preservePaths && typeof entry.absolute === 'string' && @@ -381,6 +384,7 @@ export class Unpack extends Parser { }) return false } + /* c8 ignore stop */ // an archive can set properties on the extraction directory, but it // may not replace the cwd with a different kind of thing entirely. @@ -522,10 +526,11 @@ export class Unpack extends Parser { let actions = 1 const done = (er?: null | Error) => { if (er) { - /* istanbul ignore else - we should always have a fd by now */ + /* c8 ignore start - we should always have a fd by now */ if (stream.fd) { fs.close(stream.fd, () => {}) } + /* c8 ignore stop */ this[ONERROR](er, entry) fullyDone() @@ -758,6 +763,7 @@ export class Unpack extends Parser { if ( st && (this.keep || + /* c8 ignore next */ (this.newer && st.mtime > (entry.mtime ?? st.mtime))) ) { this[SKIP](entry) @@ -912,6 +918,7 @@ export class UnpackSync extends Unpack { if ( st && (this.keep || + /* c8 ignore next */ (this.newer && st.mtime > (entry.mtime ?? st.mtime))) ) { return this[SKIP](entry) @@ -1019,7 +1026,11 @@ export class UnpackSync extends Unpack { fs.fchownSync(fd, Number(uid), Number(gid)) } catch (fchowner) { try { - fs.chownSync(String(entry.absolute), Number(uid), Number(gid)) + fs.chownSync( + String(entry.absolute), + Number(uid), + Number(gid), + ) } catch (chowner) { er = er || fchowner } @@ -1048,6 +1059,7 @@ export class UnpackSync extends Unpack { entry.atime || new Date(), entry.mtime, ) + /* c8 ignore next */ } catch (er) {} } if (this[DOCHOWN](entry)) { diff --git a/src/update.ts b/src/update.ts index a049efd5..d30b2daa 100644 --- a/src/update.ts +++ b/src/update.ts @@ -51,12 +51,16 @@ const mtimeFilter = (opt: TarOptionsWithAliases) => { ? (path, stat) => filter(path, stat) && !( + /* c8 ignore start */ (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > (stat.mtime ?? 0) + /* c8 ignore stop */ ) : (path, stat) => !( + /* c8 ignore start */ (opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > (stat.mtime ?? 0) + /* c8 ignore stop */ ) } diff --git a/src/write-entry.ts b/src/write-entry.ts index f9910c6d..5d728585 100644 --- a/src/write-entry.ts +++ b/src/write-entry.ts @@ -80,7 +80,7 @@ export class WriteEntry extends Minipass implements Warner { type?: EntryTypeName | 'Unsupported' linkpath?: string stat?: Stats - /* c8 ignore start */ + /* c8 ignore start */ #hadError: boolean = false @@ -107,12 +107,12 @@ export class WriteEntry extends Minipass implements Warner { this.on('warn', opt.onwarn) } - let pathWarn = false + let pathWarn: string | boolean = false if (!this.preservePaths) { const [root, stripped] = stripAbsolutePath(this.path) if (root && typeof stripped === 'string') { this.path = stripped - pathWarn = !!root + pathWarn = root } } @@ -229,6 +229,7 @@ export class WriteEntry extends Minipass implements Warner { gid: this.portable ? undefined : this.stat.gid, size: this.stat.size, mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime, + /* c8 ignore next */ type: this.type === 'Unsupported' ? undefined : this.type, uname: this.portable ? undefined @@ -385,7 +386,11 @@ export class WriteEntry extends Minipass implements Warner { }) } - [CLOSE](cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {}) { + /* c8 ignore start */ + [CLOSE]( + cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {}, + ) { + /* c8 ignore stop */ if (this.fd !== undefined) fs.close(this.fd, cb) } @@ -541,7 +546,11 @@ export class WriteEntrySync extends WriteEntry implements Warner { cb() } - [CLOSE](cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {}) { + /* c8 ignore start */ + [CLOSE]( + cb: (er?: null | Error | NodeJS.ErrnoException) => any = () => {}, + ) { + /* c8 ignore stop */ if (this.fd !== undefined) fs.closeSync(this.fd) cb() } @@ -595,7 +604,13 @@ export class WriteEntryTar this.noMtime = !!opt.noMtime this.readEntry = readEntry - this.type = readEntry.type + const { type } = readEntry + /* c8 ignore start */ + if (type === 'Unsupported') { + throw new Error('writing entry that should be ignored') + } + /* c8 ignore stop */ + this.type = type if (this.type === 'Directory' && this.portable) { this.noMtime = true } diff --git a/tap-snapshots/test/normalize-unicode.js.test.cjs b/tap-snapshots/test/normalize-unicode.js.test.cjs index 3163313d..6c7be82a 100644 --- a/tap-snapshots/test/normalize-unicode.js.test.cjs +++ b/tap-snapshots/test/normalize-unicode.js.test.cjs @@ -5,26 +5,26 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/normalize-unicode.js TAP normalize with strip slashes "1/4foo.txt" > normalized 1`] = ` -1/4foo.txt +exports[`test/normalize-unicode.js > TAP > normalize with strip slashes > "\\\\\eee\\\\\\" > normalized 1`] = ` +\\\\\eee\\\\\\ ` -exports[`test/normalize-unicode.js TAP normalize with strip slashes "\\\\a\\\\b\\\\c\\\\d\\\\" > normalized 1`] = ` +exports[`test/normalize-unicode.js > TAP > normalize with strip slashes > "\\\\a\\\\b\\\\c\\\\d\\\\" > normalized 1`] = ` /a/b/c/d ` -exports[`test/normalize-unicode.js TAP normalize with strip slashes "¼foo.txt" > normalized 1`] = ` -¼foo.txt -` - -exports[`test/normalize-unicode.js TAP normalize with strip slashes "﹨aaaa﹨dddd﹨" > normalized 1`] = ` +exports[`test/normalize-unicode.js > TAP > normalize with strip slashes > "﹨aaaa﹨dddd﹨" > normalized 1`] = ` ﹨aaaa﹨dddd﹨ ` -exports[`test/normalize-unicode.js TAP normalize with strip slashes "\bbb\eee\" > normalized 1`] = ` +exports[`test/normalize-unicode.js > TAP > normalize with strip slashes > "\bbb\eee\" > normalized 1`] = ` \bbb\eee\ ` -exports[`test/normalize-unicode.js TAP normalize with strip slashes "\\\\\eee\\\\\\" > normalized 1`] = ` -\\\\\eee\\\\\\ +exports[`test/normalize-unicode.js > TAP > normalize with strip slashes > "1/4foo.txt" > normalized 1`] = ` +1/4foo.txt +` + +exports[`test/normalize-unicode.js > TAP > normalize with strip slashes > "¼foo.txt" > normalized 1`] = ` +¼foo.txt ` diff --git a/test/create.js b/test/create.js index fdfd78b8..9292c66d 100644 --- a/test/create.js +++ b/test/create.js @@ -1,40 +1,40 @@ -'use strict' +import t from 'tap' +import { c, list, Pack, PackSync } from '../dist/esm/index.js' +import fs from 'fs' +import path from 'path' +import { rimraf } from 'rimraf' +import { mkdirp } from 'mkdirp' +import mutateFS from 'mutate-fs' +import { spawn } from 'child_process' +import { fileURLToPath } from 'url' const isWindows = process.platform === 'win32' -const t = require('tap') -const c = require('../lib/create.js') -const list = require('../lib/list.js') -const fs = require('fs') -const path = require('path') +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) const dir = path.resolve(__dirname, 'fixtures/create') const tars = path.resolve(__dirname, 'fixtures/tars') -const rimraf = require('rimraf') -const mkdirp = require('mkdirp') -const spawn = require('child_process').spawn -const Pack = require('../lib/pack.js') -const mutateFS = require('mutate-fs') -const { promisify } = require('util') const readtar = (file, cb) => { const child = spawn('tar', ['tf', file]) const out = [] child.stdout.on('data', c => out.push(c)) child.on('close', (code, signal) => - cb(code, signal, Buffer.concat(out).toString())) + cb(code, signal, Buffer.concat(out).toString()), + ) } -t.teardown(() => new Promise(resolve => rimraf(dir, resolve))) +t.teardown(() => rimraf(dir)) t.before(async () => { - await promisify(rimraf)(dir) + await rimraf(dir) await mkdirp(dir) }) t.test('no cb if sync or without file', t => { - t.throws(_ => c({ sync: true }, ['asdf'], _ => _)) - t.throws(_ => c(_ => _)) - t.throws(_ => c({}, _ => _)) - t.throws(_ => c({}, ['asdf'], _ => _)) + t.throws(() => c({ sync: true }, ['asdf'], () => {})) + t.throws(() => c(() => {})) + t.throws(() => c({}, () => {})) + t.throws(() => c({}, ['asdf'], () => {})) t.end() }) @@ -43,11 +43,14 @@ t.test('create file', t => { t.test('sync', t => { const file = path.resolve(dir, 'sync.tar') - c({ - file: file, - cwd: __dirname, - sync: true, - }, files) + c( + { + file: file, + cwd: __dirname, + sync: true, + }, + files, + ) readtar(file, (code, signal, list) => { t.equal(code, 0) t.equal(signal, null) @@ -58,28 +61,35 @@ t.test('create file', t => { t.test('async', t => { const file = path.resolve(dir, 'async.tar') - c({ - file: file, - cwd: __dirname, - }, files, er => { - if (er) { - throw er - } - readtar(file, (code, signal, list) => { - t.equal(code, 0) - t.equal(signal, null) - t.equal(list.trim(), 'create.js') - t.end() - }) - }) + c( + { + file: file, + cwd: __dirname, + }, + files, + er => { + if (er) { + throw er + } + readtar(file, (code, signal, list) => { + t.equal(code, 0) + t.equal(signal, null) + t.equal(list.trim(), 'create.js') + t.end() + }) + }, + ) }) t.test('async promise only', t => { const file = path.resolve(dir, 'promise.tar') - c({ - file: file, - cwd: __dirname, - }, files).then(_ => { + c( + { + file: file, + cwd: __dirname, + }, + files, + ).then(() => { readtar(file, (code, signal, list) => { t.equal(code, 0) t.equal(signal, null) @@ -93,12 +103,15 @@ t.test('create file', t => { const mode = isWindows ? 0o666 : 0o740 t.test('sync', t => { const file = path.resolve(dir, 'sync-mode.tar') - c({ - mode: mode, - file: file, - cwd: __dirname, - sync: true, - }, files) + c( + { + mode: mode, + file: file, + cwd: __dirname, + sync: true, + }, + files, + ) readtar(file, (code, signal, list) => { t.equal(code, 0) t.equal(signal, null) @@ -110,22 +123,26 @@ t.test('create file', t => { t.test('async', t => { const file = path.resolve(dir, 'async-mode.tar') - c({ - mode: mode, - file: file, - cwd: __dirname, - }, files, er => { - if (er) { - throw er - } - readtar(file, (code, signal, list) => { - t.equal(code, 0) - t.equal(signal, null) - t.equal(list.trim(), 'create.js') - t.equal(fs.lstatSync(file).mode & 0o7777, mode) - t.end() - }) - }) + c( + { + mode: mode, + file: file, + cwd: __dirname, + }, + files, + er => { + if (er) { + throw er + } + readtar(file, (code, signal, list) => { + t.equal(code, 0) + t.equal(signal, null) + t.equal(list.trim(), 'create.js') + t.equal(fs.lstatSync(file).mode & 0o7777, mode) + t.end() + }) + }, + ) }) t.end() @@ -134,7 +151,7 @@ t.test('create file', t => { }) t.test('create', t => { - t.type(c({ sync: true }, ['README.md']), Pack.Sync) + t.type(c({ sync: true }, ['README.md']), PackSync) t.type(c(['README.md']), Pack) t.end() }) @@ -143,12 +160,17 @@ t.test('open fails', t => { const poop = new Error('poop') const file = path.resolve(dir, 'throw-open.tar') t.teardown(mutateFS.statFail(poop)) - t.throws(_ => c({ - file: file, - sync: true, - cwd: __dirname, - }, [path.basename(__filename)])) - t.throws(_ => fs.lstatSync(file)) + t.throws(() => + c( + { + file: file, + sync: true, + cwd: __dirname, + }, + [path.basename(__filename)], + ), + ) + t.throws(() => fs.lstatSync(file)) t.end() }) @@ -158,25 +180,31 @@ t.test('gzipped tarball that makes some drain/resume stuff', t => { // don't include node_modules/.cache, since that gets written to // by nyc during tests, and can result in spurious errors. - const entries = fs.readdirSync(`${cwd}/node_modules`) - .filter(e => !/^\./.test(e)) + const entries = fs + .readdirSync(`${cwd}/node_modules`) + .filter(e => !/^[@.]/.test(e)) .map(e => `node_modules/${e}`) - c({ z: true, C: cwd }, entries) - .pipe(fs.createWriteStream(out)) - .on('finish', _ => { - const child = spawn('tar', ['tf', out], { - stdio: ['ignore', 'ignore', 'pipe'], - }) - child.stderr.on('data', c => { - t.fail(c + '') - }) - child.on('close', (code, signal) => { - t.equal(code, 0) - t.equal(signal, null) - t.end() - }) + const stream = c({ z: true, C: cwd }, entries) + + const outStream = fs.createWriteStream(out) + outStream.on('drain', () => { + stream.resume() + }) + + stream.pipe(outStream).on('finish', () => { + const child = spawn('tar', ['tf', out], { + stdio: ['ignore', 'ignore', 'pipe'], + }) + child.stderr.on('data', c => { + t.fail(c + '') + }) + child.on('close', (code, signal) => { + t.equal(code, 0) + t.equal(signal, null) + t.end() }) + }) }) t.test('create tarball out of another tarball', t => { @@ -192,7 +220,8 @@ t.test('create tarball out of another tarball', t => { 'hardlink-2', 'symlink', ] - list({ f: out, + list({ + f: out, sync: true, onentry: entry => { if (entry.path === 'hardlink-2') { @@ -205,25 +234,33 @@ t.test('create tarball out of another tarball', t => { t.equal(entry.type, 'File') } t.equal(entry.path, expect.shift()) - } }) + }, + }) t.same(expect, []) t.end() } t.test('sync', t => { - c({ - f: out, - cwd: tars, - sync: true, - }, ['@dir.tar', '@utf8.tar', '@links.tar']) + c( + { + f: out, + cwd: tars, + sync: true, + }, + ['@dir.tar', '@utf8.tar', '@links.tar'], + ) check(t) }) - t.test('async', t => { - c({ - f: out, - cwd: tars, - }, ['@dir.tar', '@utf8.tar', '@links.tar'], _ => check(t)) + t.test('async', async t => { + await c( + { + f: out, + cwd: tars, + }, + ['@dir.tar', '@utf8.tar', '@links.tar'], + ) + check(t) }) t.end() diff --git a/test/cwd-error.js b/test/cwd-error.js new file mode 100644 index 00000000..1961b404 --- /dev/null +++ b/test/cwd-error.js @@ -0,0 +1,10 @@ +import t from 'tap' +import { CwdError } from '../dist/esm/cwd-error.js' + +t.match(new CwdError('path', 'code'), { + name: 'CwdError', + path: 'path', + code: 'code', + syscall: 'chdir', + message: `code: Cannot cd into 'path'`, +}) diff --git a/test/extract.js b/test/extract.js index c11d0afc..8fe8eff1 100644 --- a/test/extract.js +++ b/test/extract.js @@ -1,18 +1,22 @@ -'use strict' - -const t = require('tap') -const nock = require('nock') -const x = require('../lib/extract.js') -const path = require('path') -const fs = require('fs') +import t from 'tap' +import nock from 'nock' +import { extract as x } from '../dist/esm/extract.js' +import path from 'path' +import fs from 'fs' +import { fileURLToPath } from 'url' +import { promisify } from 'util' +import { mkdirp } from 'mkdirp' +import { rimraf } from 'rimraf' +import { pipeline as PL } from 'stream' +import { Unpack, UnpackSync } from '../dist/esm/unpack.js' +const pipeline = promisify(PL) +import http from 'http' + +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) const extractdir = path.resolve(__dirname, 'fixtures/extract') const tars = path.resolve(__dirname, 'fixtures/tars') -const mkdirp = require('mkdirp') -const { promisify } = require('util') -const rimraf = promisify(require('rimraf')) -const mutateFS = require('mutate-fs') -const pipeline = promisify(require('stream').pipeline) -const http = require('http') +import mutateFS from 'mutate-fs' const tnock = (t, host, opts) => { nock.disableNetConnect() @@ -24,7 +28,7 @@ const tnock = (t, host, opts) => { return server } -t.teardown(_ => rimraf(extractdir)) +t.teardown(() => rimraf(extractdir)) t.test('basic extracting', t => { const file = path.resolve(tars, 'utf8.tar') @@ -38,11 +42,15 @@ t.test('basic extracting', t => { const check = async t => { fs.lstatSync(dir + '/Ω.txt') fs.lstatSync(dir + '/🌟.txt') - t.throws(_ => fs.lstatSync(dir + '/long-path/r/e/a/l/l/y/-/d/e/e/p/-' + - '/f/o/l/d/e/r/-/p/a/t/h/Ω.txt')) + t.throws(() => + fs.lstatSync( + dir + + '/long-path/r/e/a/l/l/y/-/d/e/e/p/-' + + '/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', + ), + ) await rimraf(dir) - t.end() } const files = ['🌟.txt', 'Ω.txt'] @@ -51,12 +59,13 @@ t.test('basic extracting', t => { return check(t) }) - t.test('async promisey', t => { - return x({ file: file, cwd: dir }, files).then(_ => check(t)) + t.test('async promisey', async t => { + await x({ file: file, cwd: dir }, files) + return check(t) }) - t.test('async cb', t => { - return x({ file: file, cwd: dir }, files, er => { + t.test('async cb', async t => { + await x({ file: file, cwd: dir }, files, er => { if (er) { throw er } @@ -67,11 +76,11 @@ t.test('basic extracting', t => { t.end() }) -t.test('ensure an open stream is not prematuraly closed', t => { +t.test('ensure an open stream is not prematurely closed', t => { t.plan(1) const file = path.resolve(tars, 'long-paths.tar') - const dir = path.resolve(extractdir, 'basic-with-stream') + const dir = t.testdir({}) t.beforeEach(async () => { await rimraf(dir) @@ -84,14 +93,12 @@ t.test('ensure an open stream is not prematuraly closed', t => { t.end() } - t.test('async promisey', t => { + t.test('async promisey', async t => { const stream = fs.createReadStream(file, { highWaterMark: 1, }) - pipeline( - stream, - x({ cwd: dir }) - ).then(_ => check(t)) + await pipeline(stream, x({ cwd: dir })) + return check(t) }) t.end() @@ -120,12 +127,13 @@ t.test('ensure an open stream is not prematuraly closed http', t => { .delay(250) .reply(200, () => fs.createReadStream(file)) - http.get('http://codeload.github.com/npm/node-tar/tar.gz/main', (stream) => { - return pipeline( - stream, - x({ cwd: dir }) - ).then(_ => check(t)) - }) + http.get( + 'http://codeload.github.com/npm/node-tar/tar.gz/main', + async stream => { + await pipeline(stream, x({ cwd: dir })) + return check(t) + }, + ) }) t.end() @@ -142,34 +150,47 @@ t.test('file list and filter', t => { const check = async t => { fs.lstatSync(dir + '/Ω.txt') - t.throws(_ => fs.lstatSync(dir + '/🌟.txt')) - t.throws(_ => fs.lstatSync(dir + '/long-path/r/e/a/l/l/y/-/d/e/e/p/-' + - '/f/o/l/d/e/r/-/p/a/t/h/Ω.txt')) + t.throws(() => fs.lstatSync(dir + '/🌟.txt')) + t.throws(() => + fs.lstatSync( + dir + + '/long-path/r/e/a/l/l/y/-/d/e/e/p/-' + + '/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', + ), + ) await rimraf(dir) - t.end() } const filter = path => path === 'Ω.txt' t.test('sync', t => { - x({ filter: filter, file: file, sync: true, C: dir }, ['🌟.txt', 'Ω.txt']) + x({ filter: filter, file: file, sync: true, C: dir }, [ + '🌟.txt', + 'Ω.txt', + ]) return check(t) }) - t.test('async promisey', t => { - return x({ filter: filter, file: file, cwd: dir }, ['🌟.txt', 'Ω.txt']).then(_ => { - return check(t) - }) + t.test('async promisey', async t => { + await x({ filter: filter, file: file, cwd: dir }, [ + '🌟.txt', + 'Ω.txt', + ]) + check(t) }) t.test('async cb', t => { - return x({ filter: filter, file: file, cwd: dir }, ['🌟.txt', 'Ω.txt'], er => { - if (er) { - throw er - } - return check(t) - }) + return x( + { filter: filter, file: file, cwd: dir }, + ['🌟.txt', 'Ω.txt'], + er => { + if (er) { + throw er + } + return check(t) + }, + ) }) t.end() @@ -185,12 +206,17 @@ t.test('no file list', t => { }) const check = async t => { - t.equal(fs.lstatSync(path.resolve(dir, '1024-bytes.txt')).size, 1024) - t.equal(fs.lstatSync(path.resolve(dir, '512-bytes.txt')).size, 512) + t.equal( + fs.lstatSync(path.resolve(dir, '1024-bytes.txt')).size, + 1024, + ) + t.equal( + fs.lstatSync(path.resolve(dir, '512-bytes.txt')).size, + 512, + ) t.equal(fs.lstatSync(path.resolve(dir, 'one-byte.txt')).size, 1) t.equal(fs.lstatSync(path.resolve(dir, 'zero-byte.txt')).size, 0) await rimraf(dir) - t.end() } t.test('sync', t => { @@ -198,10 +224,9 @@ t.test('no file list', t => { return check(t) }) - t.test('async promisey', t => { - return x({ file: file, cwd: dir }).then(_ => { - return check(t) - }) + t.test('async promisey', async t => { + await x({ file: file, cwd: dir }) + return check(t) }) t.test('async cb', t => { @@ -227,12 +252,17 @@ t.test('read in itty bits', t => { }) const check = async t => { - t.equal(fs.lstatSync(path.resolve(dir, '1024-bytes.txt')).size, 1024) - t.equal(fs.lstatSync(path.resolve(dir, '512-bytes.txt')).size, 512) + t.equal( + fs.lstatSync(path.resolve(dir, '1024-bytes.txt')).size, + 1024, + ) + t.equal( + fs.lstatSync(path.resolve(dir, '512-bytes.txt')).size, + 512, + ) t.equal(fs.lstatSync(path.resolve(dir, 'one-byte.txt')).size, 1) t.equal(fs.lstatSync(path.resolve(dir, 'zero-byte.txt')).size, 0) await rimraf(dir) - t.end() } t.test('sync', t => { @@ -240,49 +270,53 @@ t.test('read in itty bits', t => { return check(t) }) - t.test('async promisey', t => { - return x({ file: file, cwd: dir, maxReadSize: maxReadSize }).then(_ => { - return check(t) - }) + t.test('async promisey', async t => { + await x({ file: file, cwd: dir, maxReadSize: maxReadSize }) + return check(t) }) t.test('async cb', t => { - return x({ file: file, cwd: dir, maxReadSize: maxReadSize }, er => { - if (er) { - throw er - } - return check(t) - }) + return x( + { file: file, cwd: dir, maxReadSize: maxReadSize }, + er => { + if (er) { + throw er + } + return check(t) + }, + ) }) t.end() }) t.test('bad calls', t => { - t.throws(_ => x(_ => _)) - t.throws(_ => x({ sync: true }, _ => _)) - t.throws(_ => x({ sync: true }, [], _ => _)) + t.throws(() => x(() => {})) + t.throws(() => x({ sync: true }, () => {})) + t.throws(() => x({ sync: true }, [], () => {})) t.end() }) t.test('no file', t => { - const Unpack = require('../lib/unpack.js') t.type(x(), Unpack) t.type(x(['asdf']), Unpack) - t.type(x({ sync: true }), Unpack.Sync) + t.type(x({ sync: true }), UnpackSync) t.end() }) t.test('nonexistent', t => { - t.throws(_ => x({ sync: true, file: 'does not exist' })) - x({ file: 'does not exist' }).catch(_ => t.end()) + t.throws(() => x({ sync: true, file: 'does not exist' })) + x({ file: 'does not exist' }).catch(() => t.end()) }) t.test('read fail', t => { const poop = new Error('poop') t.teardown(mutateFS.fail('read', poop)) - t.throws(_ => x({ maxReadSize: 10, sync: true, file: __filename }), poop) + t.throws( + () => x({ maxReadSize: 10, sync: true, file: __filename }), + poop, + ) t.end() }) @@ -305,8 +339,18 @@ t.test('sync gzip error edge case test', async t => { }, }) - t.same(fs.readdirSync(dir + '/x').sort(), - ['1', '10', '2', '3', '4', '5', '6', '7', '8', '9']) + t.same(fs.readdirSync(dir + '/x').sort(), [ + '1', + '10', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + ]) t.end() }) @@ -328,24 +372,46 @@ t.test('brotli', async t => { const f = fs.openSync(filename, 'a') fs.closeSync(f) - const expect = new Error('TAR_BAD_ARCHIVE: Unrecognized archive format') + const expect = new Error( + 'TAR_BAD_ARCHIVE: Unrecognized archive format', + ) - t.throws(_ => x({ sync: true, file: filename }), expect) + t.throws(() => x({ sync: true, file: filename }), expect) }) t.test('succeeds based on file extension', t => { x({ sync: true, file: file, C: dir }) - t.same(fs.readdirSync(dir + '/x').sort(), - ['1', '10', '2', '3', '4', '5', '6', '7', '8', '9']) + t.same(fs.readdirSync(dir + '/x').sort(), [ + '1', + '10', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + ]) t.end() }) t.test('succeeds when passed explicit option', t => { x({ sync: true, file: file, C: dir, brotli: true }) - t.same(fs.readdirSync(dir + '/x').sort(), - ['1', '10', '2', '3', '4', '5', '6', '7', '8', '9']) + t.same(fs.readdirSync(dir + '/x').sort(), [ + '1', + '10', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + ]) t.end() }) }) diff --git a/test/fixtures/make-tar.js b/test/fixtures/make-tar.js new file mode 100644 index 00000000..77ee2b26 --- /dev/null +++ b/test/fixtures/make-tar.js @@ -0,0 +1,26 @@ +import { Header } from '../../dist/esm/header.js' +export const makeTar = chunks => { + let dataLen = 0 + return Buffer.concat( + chunks.map(chunk => { + if (Buffer.isBuffer(chunk)) { + dataLen += chunk.length + return chunk + } + const size = Math.max( + typeof chunk === 'string' + ? 512 * Math.ceil(chunk.length / 512) + : 512, + ) + dataLen += size + const buf = Buffer.alloc(size) + if (typeof chunk === 'string') { + buf.write(chunk) + } else { + new Header(chunk).encode(buf, 0) + } + return buf + }), + dataLen, + ) +} diff --git a/test/fixtures/parse/bad-cksum--filter-strict.json b/test/fixtures/parse/bad-cksum--filter-strict.json index edfce539..48e0680b 100644 --- a/test/fixtures/parse/bad-cksum--filter-strict.json +++ b/test/fixtures/parse/bad-cksum--filter-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/bad-cksum--filter.json b/test/fixtures/parse/bad-cksum--filter.json index 55274a4e..d2664877 100644 --- a/test/fixtures/parse/bad-cksum--filter.json +++ b/test/fixtures/parse/bad-cksum--filter.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/bad-cksum--meta-250-filter-strict.json b/test/fixtures/parse/bad-cksum--meta-250-filter-strict.json index edfce539..48e0680b 100644 --- a/test/fixtures/parse/bad-cksum--meta-250-filter-strict.json +++ b/test/fixtures/parse/bad-cksum--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/bad-cksum--meta-250-filter.json b/test/fixtures/parse/bad-cksum--meta-250-filter.json index 55274a4e..d2664877 100644 --- a/test/fixtures/parse/bad-cksum--meta-250-filter.json +++ b/test/fixtures/parse/bad-cksum--meta-250-filter.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/bad-cksum--meta-250-strict.json b/test/fixtures/parse/bad-cksum--meta-250-strict.json index edfce539..48e0680b 100644 --- a/test/fixtures/parse/bad-cksum--meta-250-strict.json +++ b/test/fixtures/parse/bad-cksum--meta-250-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/bad-cksum--meta-250.json b/test/fixtures/parse/bad-cksum--meta-250.json index 55274a4e..d2664877 100644 --- a/test/fixtures/parse/bad-cksum--meta-250.json +++ b/test/fixtures/parse/bad-cksum--meta-250.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/bad-cksum--strict.json b/test/fixtures/parse/bad-cksum--strict.json index edfce539..48e0680b 100644 --- a/test/fixtures/parse/bad-cksum--strict.json +++ b/test/fixtures/parse/bad-cksum--strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/bad-cksum.json b/test/fixtures/parse/bad-cksum.json index 55274a4e..d2664877 100644 --- a/test/fixtures/parse/bad-cksum.json +++ b/test/fixtures/parse/bad-cksum.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/body-byte-counts--filter-strict.json b/test/fixtures/parse/body-byte-counts--filter-strict.json index 7290291b..9462cd61 100644 --- a/test/fixtures/parse/body-byte-counts--filter-strict.json +++ b/test/fixtures/parse/body-byte-counts--filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1024, "mtime": "2017-04-10T16:57:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "staff", "size": 512, "mtime": "2017-04-10T17:08:55.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -93,9 +77,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -110,17 +91,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -132,9 +109,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:08:01.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -149,9 +123,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/body-byte-counts--filter.json b/test/fixtures/parse/body-byte-counts--filter.json index 7290291b..9462cd61 100644 --- a/test/fixtures/parse/body-byte-counts--filter.json +++ b/test/fixtures/parse/body-byte-counts--filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1024, "mtime": "2017-04-10T16:57:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "staff", "size": 512, "mtime": "2017-04-10T17:08:55.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -93,9 +77,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -110,17 +91,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -132,9 +109,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:08:01.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -149,9 +123,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/body-byte-counts--meta-250-filter-strict.json b/test/fixtures/parse/body-byte-counts--meta-250-filter-strict.json index 7290291b..9462cd61 100644 --- a/test/fixtures/parse/body-byte-counts--meta-250-filter-strict.json +++ b/test/fixtures/parse/body-byte-counts--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1024, "mtime": "2017-04-10T16:57:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "staff", "size": 512, "mtime": "2017-04-10T17:08:55.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -93,9 +77,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -110,17 +91,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -132,9 +109,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:08:01.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -149,9 +123,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/body-byte-counts--meta-250-filter.json b/test/fixtures/parse/body-byte-counts--meta-250-filter.json index 7290291b..9462cd61 100644 --- a/test/fixtures/parse/body-byte-counts--meta-250-filter.json +++ b/test/fixtures/parse/body-byte-counts--meta-250-filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1024, "mtime": "2017-04-10T16:57:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "staff", "size": 512, "mtime": "2017-04-10T17:08:55.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -93,9 +77,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -110,17 +91,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -132,9 +109,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:08:01.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -149,9 +123,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/body-byte-counts--meta-250-strict.json b/test/fixtures/parse/body-byte-counts--meta-250-strict.json index 8069e9cd..8ae48534 100644 --- a/test/fixtures/parse/body-byte-counts--meta-250-strict.json +++ b/test/fixtures/parse/body-byte-counts--meta-250-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1024, "mtime": "2017-04-10T16:57:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "staff", "size": 512, "mtime": "2017-04-10T17:08:55.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -93,9 +77,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -110,17 +91,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -132,9 +109,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:08:01.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -149,9 +123,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/body-byte-counts--meta-250.json b/test/fixtures/parse/body-byte-counts--meta-250.json index 8069e9cd..8ae48534 100644 --- a/test/fixtures/parse/body-byte-counts--meta-250.json +++ b/test/fixtures/parse/body-byte-counts--meta-250.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1024, "mtime": "2017-04-10T16:57:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "staff", "size": 512, "mtime": "2017-04-10T17:08:55.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -93,9 +77,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -110,17 +91,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -132,9 +109,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:08:01.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -149,9 +123,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/body-byte-counts--strict.json b/test/fixtures/parse/body-byte-counts--strict.json index 8069e9cd..8ae48534 100644 --- a/test/fixtures/parse/body-byte-counts--strict.json +++ b/test/fixtures/parse/body-byte-counts--strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1024, "mtime": "2017-04-10T16:57:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "staff", "size": 512, "mtime": "2017-04-10T17:08:55.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -93,9 +77,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -110,17 +91,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -132,9 +109,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:08:01.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -149,9 +123,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/body-byte-counts.json b/test/fixtures/parse/body-byte-counts.json index 8069e9cd..8ae48534 100644 --- a/test/fixtures/parse/body-byte-counts.json +++ b/test/fixtures/parse/body-byte-counts.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1024, "mtime": "2017-04-10T16:57:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "staff", "size": 512, "mtime": "2017-04-10T17:08:55.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -93,9 +77,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -110,17 +91,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -132,9 +109,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:08:01.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -149,9 +123,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/dir--filter-strict.json b/test/fixtures/parse/dir--filter-strict.json index 69926438..52757dae 100644 --- a/test/fixtures/parse/dir--filter-strict.json +++ b/test/fixtures/parse/dir--filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:00:17.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/dir--filter.json b/test/fixtures/parse/dir--filter.json index 69926438..52757dae 100644 --- a/test/fixtures/parse/dir--filter.json +++ b/test/fixtures/parse/dir--filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:00:17.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/dir--meta-250-filter-strict.json b/test/fixtures/parse/dir--meta-250-filter-strict.json index 69926438..52757dae 100644 --- a/test/fixtures/parse/dir--meta-250-filter-strict.json +++ b/test/fixtures/parse/dir--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:00:17.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/dir--meta-250-filter.json b/test/fixtures/parse/dir--meta-250-filter.json index 69926438..52757dae 100644 --- a/test/fixtures/parse/dir--meta-250-filter.json +++ b/test/fixtures/parse/dir--meta-250-filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:00:17.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/dir--meta-250-strict.json b/test/fixtures/parse/dir--meta-250-strict.json index 0a933bf5..0688cc0b 100644 --- a/test/fixtures/parse/dir--meta-250-strict.json +++ b/test/fixtures/parse/dir--meta-250-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:00:17.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/dir--meta-250.json b/test/fixtures/parse/dir--meta-250.json index 0a933bf5..0688cc0b 100644 --- a/test/fixtures/parse/dir--meta-250.json +++ b/test/fixtures/parse/dir--meta-250.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:00:17.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/dir--strict.json b/test/fixtures/parse/dir--strict.json index 0a933bf5..0688cc0b 100644 --- a/test/fixtures/parse/dir--strict.json +++ b/test/fixtures/parse/dir--strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:00:17.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/dir.json b/test/fixtures/parse/dir.json index 0a933bf5..0688cc0b 100644 --- a/test/fixtures/parse/dir.json +++ b/test/fixtures/parse/dir.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T17:00:17.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/emptypax--filter-strict.json b/test/fixtures/parse/emptypax--filter-strict.json index 2810367d..eb30c2be 100644 --- a/test/fixtures/parse/emptypax--filter-strict.json +++ b/test/fixtures/parse/emptypax--filter-strict.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:33:21.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -37,8 +26,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:33:21.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,17 +40,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -75,9 +58,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/emptypax--filter.json b/test/fixtures/parse/emptypax--filter.json index 2810367d..eb30c2be 100644 --- a/test/fixtures/parse/emptypax--filter.json +++ b/test/fixtures/parse/emptypax--filter.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:33:21.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -37,8 +26,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:33:21.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,17 +40,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -75,9 +58,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/emptypax--meta-250-filter-strict.json b/test/fixtures/parse/emptypax--meta-250-filter-strict.json index 2810367d..eb30c2be 100644 --- a/test/fixtures/parse/emptypax--meta-250-filter-strict.json +++ b/test/fixtures/parse/emptypax--meta-250-filter-strict.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:33:21.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -37,8 +26,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:33:21.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,17 +40,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -75,9 +58,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/emptypax--meta-250-filter.json b/test/fixtures/parse/emptypax--meta-250-filter.json index 2810367d..eb30c2be 100644 --- a/test/fixtures/parse/emptypax--meta-250-filter.json +++ b/test/fixtures/parse/emptypax--meta-250-filter.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:33:21.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -37,8 +26,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:33:21.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,17 +40,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -75,9 +58,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/emptypax--meta-250-strict.json b/test/fixtures/parse/emptypax--meta-250-strict.json index 686a428a..55125fe7 100644 --- a/test/fixtures/parse/emptypax--meta-250-strict.json +++ b/test/fixtures/parse/emptypax--meta-250-strict.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:33:21.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -37,8 +26,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:33:21.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,17 +40,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -75,9 +58,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/emptypax--meta-250.json b/test/fixtures/parse/emptypax--meta-250.json index 686a428a..55125fe7 100644 --- a/test/fixtures/parse/emptypax--meta-250.json +++ b/test/fixtures/parse/emptypax--meta-250.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:33:21.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -37,8 +26,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:33:21.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,17 +40,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -75,9 +58,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/emptypax--strict.json b/test/fixtures/parse/emptypax--strict.json index 686a428a..55125fe7 100644 --- a/test/fixtures/parse/emptypax--strict.json +++ b/test/fixtures/parse/emptypax--strict.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:33:21.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -37,8 +26,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:33:21.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,17 +40,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -75,9 +58,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/emptypax.json b/test/fixtures/parse/emptypax.json index 686a428a..55125fe7 100644 --- a/test/fixtures/parse/emptypax.json +++ b/test/fixtures/parse/emptypax.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:33:21.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -37,8 +26,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:33:21.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,17 +40,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -75,9 +58,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/file--filter-strict.json b/test/fixtures/parse/file--filter-strict.json index 07e38b45..800a4e51 100644 --- a/test/fixtures/parse/file--filter-strict.json +++ b/test/fixtures/parse/file--filter-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/file--filter.json b/test/fixtures/parse/file--filter.json index 07e38b45..800a4e51 100644 --- a/test/fixtures/parse/file--filter.json +++ b/test/fixtures/parse/file--filter.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/file--meta-250-filter-strict.json b/test/fixtures/parse/file--meta-250-filter-strict.json index 07e38b45..800a4e51 100644 --- a/test/fixtures/parse/file--meta-250-filter-strict.json +++ b/test/fixtures/parse/file--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/file--meta-250-filter.json b/test/fixtures/parse/file--meta-250-filter.json index 07e38b45..800a4e51 100644 --- a/test/fixtures/parse/file--meta-250-filter.json +++ b/test/fixtures/parse/file--meta-250-filter.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/file--meta-250-strict.json b/test/fixtures/parse/file--meta-250-strict.json index 07e38b45..800a4e51 100644 --- a/test/fixtures/parse/file--meta-250-strict.json +++ b/test/fixtures/parse/file--meta-250-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/file--meta-250.json b/test/fixtures/parse/file--meta-250.json index 07e38b45..800a4e51 100644 --- a/test/fixtures/parse/file--meta-250.json +++ b/test/fixtures/parse/file--meta-250.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/file--strict.json b/test/fixtures/parse/file--strict.json index 07e38b45..800a4e51 100644 --- a/test/fixtures/parse/file--strict.json +++ b/test/fixtures/parse/file--strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/file.json b/test/fixtures/parse/file.json index 07e38b45..800a4e51 100644 --- a/test/fixtures/parse/file.json +++ b/test/fixtures/parse/file.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/global-header--filter-strict.json b/test/fixtures/parse/global-header--filter-strict.json index 114679a2..3032d06b 100644 --- a/test/fixtures/parse/global-header--filter-strict.json +++ b/test/fixtures/parse/global-header--filter-strict.json @@ -6,23 +6,8 @@ [ "entry", { - "extended": null, "globalExtended": { - "atime": null, - "charset": null, - "comment": null, - "ctime": null, - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, "path": "ab", - "size": null, - "uid": null, - "uname": null, - "dev": null, - "ino": null, - "nlink": null, "global": true }, "type": "File", @@ -36,9 +21,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +35,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/global-header--filter.json b/test/fixtures/parse/global-header--filter.json index 114679a2..3032d06b 100644 --- a/test/fixtures/parse/global-header--filter.json +++ b/test/fixtures/parse/global-header--filter.json @@ -6,23 +6,8 @@ [ "entry", { - "extended": null, "globalExtended": { - "atime": null, - "charset": null, - "comment": null, - "ctime": null, - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, "path": "ab", - "size": null, - "uid": null, - "uname": null, - "dev": null, - "ino": null, - "nlink": null, "global": true }, "type": "File", @@ -36,9 +21,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +35,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/global-header--meta-250-filter-strict.json b/test/fixtures/parse/global-header--meta-250-filter-strict.json index 114679a2..3032d06b 100644 --- a/test/fixtures/parse/global-header--meta-250-filter-strict.json +++ b/test/fixtures/parse/global-header--meta-250-filter-strict.json @@ -6,23 +6,8 @@ [ "entry", { - "extended": null, "globalExtended": { - "atime": null, - "charset": null, - "comment": null, - "ctime": null, - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, "path": "ab", - "size": null, - "uid": null, - "uname": null, - "dev": null, - "ino": null, - "nlink": null, "global": true }, "type": "File", @@ -36,9 +21,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +35,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/global-header--meta-250-filter.json b/test/fixtures/parse/global-header--meta-250-filter.json index 114679a2..3032d06b 100644 --- a/test/fixtures/parse/global-header--meta-250-filter.json +++ b/test/fixtures/parse/global-header--meta-250-filter.json @@ -6,23 +6,8 @@ [ "entry", { - "extended": null, "globalExtended": { - "atime": null, - "charset": null, - "comment": null, - "ctime": null, - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, "path": "ab", - "size": null, - "uid": null, - "uname": null, - "dev": null, - "ino": null, - "nlink": null, "global": true }, "type": "File", @@ -36,9 +21,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +35,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/global-header--meta-250-strict.json b/test/fixtures/parse/global-header--meta-250-strict.json index 114679a2..3032d06b 100644 --- a/test/fixtures/parse/global-header--meta-250-strict.json +++ b/test/fixtures/parse/global-header--meta-250-strict.json @@ -6,23 +6,8 @@ [ "entry", { - "extended": null, "globalExtended": { - "atime": null, - "charset": null, - "comment": null, - "ctime": null, - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, "path": "ab", - "size": null, - "uid": null, - "uname": null, - "dev": null, - "ino": null, - "nlink": null, "global": true }, "type": "File", @@ -36,9 +21,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +35,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/global-header--meta-250.json b/test/fixtures/parse/global-header--meta-250.json index 114679a2..3032d06b 100644 --- a/test/fixtures/parse/global-header--meta-250.json +++ b/test/fixtures/parse/global-header--meta-250.json @@ -6,23 +6,8 @@ [ "entry", { - "extended": null, "globalExtended": { - "atime": null, - "charset": null, - "comment": null, - "ctime": null, - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, "path": "ab", - "size": null, - "uid": null, - "uname": null, - "dev": null, - "ino": null, - "nlink": null, "global": true }, "type": "File", @@ -36,9 +21,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +35,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/global-header--strict.json b/test/fixtures/parse/global-header--strict.json index 114679a2..3032d06b 100644 --- a/test/fixtures/parse/global-header--strict.json +++ b/test/fixtures/parse/global-header--strict.json @@ -6,23 +6,8 @@ [ "entry", { - "extended": null, "globalExtended": { - "atime": null, - "charset": null, - "comment": null, - "ctime": null, - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, "path": "ab", - "size": null, - "uid": null, - "uname": null, - "dev": null, - "ino": null, - "nlink": null, "global": true }, "type": "File", @@ -36,9 +21,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +35,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/global-header.json b/test/fixtures/parse/global-header.json index 114679a2..3032d06b 100644 --- a/test/fixtures/parse/global-header.json +++ b/test/fixtures/parse/global-header.json @@ -6,23 +6,8 @@ [ "entry", { - "extended": null, "globalExtended": { - "atime": null, - "charset": null, - "comment": null, - "ctime": null, - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, "path": "ab", - "size": null, - "uid": null, - "uname": null, - "dev": null, - "ino": null, - "nlink": null, "global": true }, "type": "File", @@ -36,9 +21,6 @@ "gname": "staff", "size": 1, "mtime": "2017-04-10T16:58:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +35,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links--filter-strict.json b/test/fixtures/parse/links--filter-strict.json index ed902aa1..acf569af 100644 --- a/test/fixtures/parse/links--filter-strict.json +++ b/test/fixtures/parse/links--filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 26, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -54,8 +45,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-1", "header": { "cksumValid": true, @@ -71,17 +60,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -93,8 +78,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -110,9 +93,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links--filter.json b/test/fixtures/parse/links--filter.json index ed902aa1..acf569af 100644 --- a/test/fixtures/parse/links--filter.json +++ b/test/fixtures/parse/links--filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 26, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -54,8 +45,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-1", "header": { "cksumValid": true, @@ -71,17 +60,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -93,8 +78,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -110,9 +93,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links--meta-250-filter-strict.json b/test/fixtures/parse/links--meta-250-filter-strict.json index ed902aa1..acf569af 100644 --- a/test/fixtures/parse/links--meta-250-filter-strict.json +++ b/test/fixtures/parse/links--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 26, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -54,8 +45,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-1", "header": { "cksumValid": true, @@ -71,17 +60,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -93,8 +78,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -110,9 +93,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links--meta-250-filter.json b/test/fixtures/parse/links--meta-250-filter.json index ed902aa1..acf569af 100644 --- a/test/fixtures/parse/links--meta-250-filter.json +++ b/test/fixtures/parse/links--meta-250-filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 26, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -54,8 +45,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-1", "header": { "cksumValid": true, @@ -71,17 +60,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -93,8 +78,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -110,9 +93,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links--meta-250-strict.json b/test/fixtures/parse/links--meta-250-strict.json index fdf07254..216a3ba7 100644 --- a/test/fixtures/parse/links--meta-250-strict.json +++ b/test/fixtures/parse/links--meta-250-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 26, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -54,8 +45,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-1", "header": { "cksumValid": true, @@ -71,17 +60,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -93,8 +78,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -110,9 +93,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links--meta-250.json b/test/fixtures/parse/links--meta-250.json index fdf07254..216a3ba7 100644 --- a/test/fixtures/parse/links--meta-250.json +++ b/test/fixtures/parse/links--meta-250.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 26, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -54,8 +45,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-1", "header": { "cksumValid": true, @@ -71,17 +60,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -93,8 +78,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -110,9 +93,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links--strict.json b/test/fixtures/parse/links--strict.json index fdf07254..216a3ba7 100644 --- a/test/fixtures/parse/links--strict.json +++ b/test/fixtures/parse/links--strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 26, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -54,8 +45,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-1", "header": { "cksumValid": true, @@ -71,17 +60,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -93,8 +78,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -110,9 +93,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-invalid--filter-strict.json b/test/fixtures/parse/links-invalid--filter-strict.json index fd2d5dc8..6fdfb2d5 100644 --- a/test/fixtures/parse/links-invalid--filter-strict.json +++ b/test/fixtures/parse/links-invalid--filter-strict.json @@ -23,8 +23,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -36,8 +34,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -53,9 +49,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-invalid--filter.json b/test/fixtures/parse/links-invalid--filter.json index 42a58d14..1e14b8a0 100644 --- a/test/fixtures/parse/links-invalid--filter.json +++ b/test/fixtures/parse/links-invalid--filter.json @@ -17,8 +17,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -30,8 +28,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -47,9 +43,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-invalid--meta-250-filter-strict.json b/test/fixtures/parse/links-invalid--meta-250-filter-strict.json index fd2d5dc8..6fdfb2d5 100644 --- a/test/fixtures/parse/links-invalid--meta-250-filter-strict.json +++ b/test/fixtures/parse/links-invalid--meta-250-filter-strict.json @@ -23,8 +23,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -36,8 +34,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -53,9 +49,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-invalid--meta-250-filter.json b/test/fixtures/parse/links-invalid--meta-250-filter.json index 42a58d14..1e14b8a0 100644 --- a/test/fixtures/parse/links-invalid--meta-250-filter.json +++ b/test/fixtures/parse/links-invalid--meta-250-filter.json @@ -17,8 +17,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -30,8 +28,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -47,9 +43,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-invalid--meta-250-strict.json b/test/fixtures/parse/links-invalid--meta-250-strict.json index 0c6c72d0..6e9c1531 100644 --- a/test/fixtures/parse/links-invalid--meta-250-strict.json +++ b/test/fixtures/parse/links-invalid--meta-250-strict.json @@ -23,8 +23,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -36,8 +34,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -53,9 +49,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-invalid--meta-250.json b/test/fixtures/parse/links-invalid--meta-250.json index c62395e3..569dcb62 100644 --- a/test/fixtures/parse/links-invalid--meta-250.json +++ b/test/fixtures/parse/links-invalid--meta-250.json @@ -17,8 +17,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -30,8 +28,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -47,9 +43,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-invalid--strict.json b/test/fixtures/parse/links-invalid--strict.json index 0c6c72d0..6e9c1531 100644 --- a/test/fixtures/parse/links-invalid--strict.json +++ b/test/fixtures/parse/links-invalid--strict.json @@ -23,8 +23,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -36,8 +34,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -53,9 +49,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-invalid.json b/test/fixtures/parse/links-invalid.json index c62395e3..569dcb62 100644 --- a/test/fixtures/parse/links-invalid.json +++ b/test/fixtures/parse/links-invalid.json @@ -17,8 +17,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -30,8 +28,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -47,9 +43,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-strip--filter-strict.json b/test/fixtures/parse/links-strip--filter-strict.json index 9a640e0b..47069c6b 100644 --- a/test/fixtures/parse/links-strip--filter-strict.json +++ b/test/fixtures/parse/links-strip--filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "", "size": 26, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -93,8 +77,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -110,17 +92,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -132,8 +110,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -149,17 +125,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -171,8 +143,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -188,9 +158,7 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-strip--filter.json b/test/fixtures/parse/links-strip--filter.json index 9a640e0b..47069c6b 100644 --- a/test/fixtures/parse/links-strip--filter.json +++ b/test/fixtures/parse/links-strip--filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "", "size": 26, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -93,8 +77,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -110,17 +92,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -132,8 +110,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -149,17 +125,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -171,8 +143,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -188,9 +158,7 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-strip--meta-250-filter-strict.json b/test/fixtures/parse/links-strip--meta-250-filter-strict.json index 9a640e0b..47069c6b 100644 --- a/test/fixtures/parse/links-strip--meta-250-filter-strict.json +++ b/test/fixtures/parse/links-strip--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "", "size": 26, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -93,8 +77,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -110,17 +92,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -132,8 +110,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -149,17 +125,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -171,8 +143,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -188,9 +158,7 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-strip--meta-250-filter.json b/test/fixtures/parse/links-strip--meta-250-filter.json index 9a640e0b..47069c6b 100644 --- a/test/fixtures/parse/links-strip--meta-250-filter.json +++ b/test/fixtures/parse/links-strip--meta-250-filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "", "size": 26, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -93,8 +77,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -110,17 +92,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": true, @@ -132,8 +110,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -149,17 +125,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -171,8 +143,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -188,9 +158,7 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-strip--meta-250-strict.json b/test/fixtures/parse/links-strip--meta-250-strict.json index 17e5397d..f908c9e3 100644 --- a/test/fixtures/parse/links-strip--meta-250-strict.json +++ b/test/fixtures/parse/links-strip--meta-250-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "", "size": 26, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -93,8 +77,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -110,17 +92,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -132,8 +110,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -149,17 +125,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -171,8 +143,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -188,9 +158,7 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-strip--meta-250.json b/test/fixtures/parse/links-strip--meta-250.json index 17e5397d..f908c9e3 100644 --- a/test/fixtures/parse/links-strip--meta-250.json +++ b/test/fixtures/parse/links-strip--meta-250.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "", "size": 26, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -93,8 +77,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -110,17 +92,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -132,8 +110,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -149,17 +125,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -171,8 +143,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -188,9 +158,7 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-strip--strict.json b/test/fixtures/parse/links-strip--strict.json index 17e5397d..f908c9e3 100644 --- a/test/fixtures/parse/links-strip--strict.json +++ b/test/fixtures/parse/links-strip--strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "", "size": 26, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -93,8 +77,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -110,17 +92,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -132,8 +110,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -149,17 +125,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -171,8 +143,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -188,9 +158,7 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links-strip.json b/test/fixtures/parse/links-strip.json index 17e5397d..f908c9e3 100644 --- a/test/fixtures/parse/links-strip.json +++ b/test/fixtures/parse/links-strip.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "", "size": 26, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,17 +59,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -93,8 +77,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -110,17 +92,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -132,8 +110,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "strip-dir/hardlink-1", "header": { "cksumValid": true, @@ -149,17 +125,13 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -171,8 +143,6 @@ "gname": "", "size": 0, "mtime": "2018-11-06T01:45:25.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -188,9 +158,7 @@ "uname": "", "gname": "", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/links.json b/test/fixtures/parse/links.json index fdf07254..216a3ba7 100644 --- a/test/fixtures/parse/links.json +++ b/test/fixtures/parse/links.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 26, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Link", "meta": false, "ignore": false, @@ -54,8 +45,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:05.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-1", "header": { "cksumValid": true, @@ -71,17 +60,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -93,8 +78,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T19:27:33.000Z", - "atime": null, - "ctime": null, "linkpath": "hardlink-2", "header": { "cksumValid": true, @@ -110,9 +93,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-paths--filter-strict.json b/test/fixtures/parse/long-paths--filter-strict.json index 8dfe9de3..53e376da 100644 --- a/test/fixtures/parse/long-paths--filter-strict.json +++ b/test/fixtures/parse/long-paths--filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:53:02.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -47,23 +40,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:54:12.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836297, "nlink": 1, + "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -76,8 +58,6 @@ "size": 100, "mtime": "2017-04-10T16:54:12.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:54:12.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -107,23 +85,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:56:18.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836326, "nlink": 1, + "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -136,8 +103,6 @@ "size": 100, "mtime": "2017-04-10T16:56:18.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:56:18.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -152,17 +117,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -174,9 +135,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -191,17 +149,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -213,9 +167,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -230,17 +181,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -252,9 +199,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -269,17 +213,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -291,9 +231,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -308,17 +245,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -330,9 +263,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -347,17 +277,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -369,9 +295,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -386,17 +309,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -408,9 +327,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -425,17 +341,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -447,9 +359,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -464,17 +373,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -486,9 +391,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -503,17 +405,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -525,9 +423,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -542,17 +437,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -564,9 +455,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -581,17 +469,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -603,9 +487,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -620,17 +501,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -642,9 +519,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -659,17 +533,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -681,9 +551,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -698,17 +565,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -720,9 +583,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -737,17 +597,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -759,9 +615,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -776,17 +629,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -798,9 +647,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -815,17 +661,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -837,9 +679,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -854,17 +693,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -876,9 +711,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -893,17 +725,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -915,9 +743,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -932,17 +757,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -954,9 +775,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -971,17 +789,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -993,9 +807,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1010,17 +821,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1032,9 +839,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1049,17 +853,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1071,9 +871,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:58:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1088,17 +885,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1110,9 +903,6 @@ "gname": "staff", "size": 6, "mtime": "2017-04-10T16:56:46.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1127,17 +917,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1149,9 +935,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1166,9 +949,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1181,23 +962,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:52:20.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836253, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1210,8 +980,6 @@ "size": 100, "mtime": "2017-04-10T16:52:20.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:52:20.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1226,9 +994,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1241,23 +1007,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:52:20.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836254, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1270,8 +1025,6 @@ "size": 100, "mtime": "2017-04-10T16:52:20.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:52:20.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1286,9 +1039,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1301,23 +1052,12 @@ { "extended": { "atime": "2017-04-10T17:07:25.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1330,8 +1070,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:07:25.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1346,9 +1084,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-paths--filter.json b/test/fixtures/parse/long-paths--filter.json index 8dfe9de3..53e376da 100644 --- a/test/fixtures/parse/long-paths--filter.json +++ b/test/fixtures/parse/long-paths--filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:53:02.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -47,23 +40,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:54:12.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836297, "nlink": 1, + "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -76,8 +58,6 @@ "size": 100, "mtime": "2017-04-10T16:54:12.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:54:12.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -107,23 +85,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:56:18.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836326, "nlink": 1, + "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -136,8 +103,6 @@ "size": 100, "mtime": "2017-04-10T16:56:18.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:56:18.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -152,17 +117,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -174,9 +135,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -191,17 +149,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -213,9 +167,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -230,17 +181,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -252,9 +199,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -269,17 +213,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -291,9 +231,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -308,17 +245,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -330,9 +263,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -347,17 +277,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -369,9 +295,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -386,17 +309,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -408,9 +327,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -425,17 +341,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -447,9 +359,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -464,17 +373,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -486,9 +391,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -503,17 +405,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -525,9 +423,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -542,17 +437,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -564,9 +455,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -581,17 +469,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -603,9 +487,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -620,17 +501,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -642,9 +519,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -659,17 +533,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -681,9 +551,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -698,17 +565,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -720,9 +583,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -737,17 +597,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -759,9 +615,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -776,17 +629,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -798,9 +647,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -815,17 +661,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -837,9 +679,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -854,17 +693,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -876,9 +711,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -893,17 +725,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -915,9 +743,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -932,17 +757,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -954,9 +775,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -971,17 +789,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -993,9 +807,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1010,17 +821,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1032,9 +839,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1049,17 +853,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1071,9 +871,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:58:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1088,17 +885,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1110,9 +903,6 @@ "gname": "staff", "size": 6, "mtime": "2017-04-10T16:56:46.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1127,17 +917,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1149,9 +935,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1166,9 +949,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1181,23 +962,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:52:20.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836253, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1210,8 +980,6 @@ "size": 100, "mtime": "2017-04-10T16:52:20.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:52:20.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1226,9 +994,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1241,23 +1007,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:52:20.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836254, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1270,8 +1025,6 @@ "size": 100, "mtime": "2017-04-10T16:52:20.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:52:20.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1286,9 +1039,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1301,23 +1052,12 @@ { "extended": { "atime": "2017-04-10T17:07:25.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1330,8 +1070,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:07:25.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1346,9 +1084,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-paths--meta-250-filter-strict.json b/test/fixtures/parse/long-paths--meta-250-filter-strict.json index 2a2e4960..0ceedf38 100644 --- a/test/fixtures/parse/long-paths--meta-250-filter-strict.json +++ b/test/fixtures/parse/long-paths--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:53:02.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -47,23 +40,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:54:12.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836297, "nlink": 1, + "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -76,8 +58,6 @@ "size": 100, "mtime": "2017-04-10T16:54:12.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:54:12.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,17 +72,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -114,9 +90,6 @@ "gname": "staff", "size": 283, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -131,17 +104,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -153,9 +122,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -170,17 +136,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -192,9 +154,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -209,17 +168,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -231,9 +186,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -248,17 +200,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -270,9 +218,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -287,17 +232,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -309,9 +250,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -326,17 +264,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -348,9 +282,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -365,17 +296,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -387,9 +314,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -404,17 +328,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -426,9 +346,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -443,17 +360,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -465,9 +378,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -482,17 +392,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -504,9 +410,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -521,17 +424,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -543,9 +442,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -560,17 +456,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -582,9 +474,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -599,17 +488,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -621,9 +506,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -638,17 +520,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -660,9 +538,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -677,17 +552,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -699,9 +570,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -716,17 +584,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -738,9 +602,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -755,17 +616,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -777,9 +634,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -794,17 +648,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -816,9 +666,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -833,17 +680,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -855,9 +698,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -872,17 +712,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -894,9 +730,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -911,17 +744,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -933,9 +762,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -950,17 +776,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -972,9 +794,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -989,17 +808,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1011,9 +826,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1028,17 +840,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1050,9 +858,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1067,17 +872,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1089,9 +890,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:58:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1106,17 +904,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1128,9 +922,6 @@ "gname": "staff", "size": 6, "mtime": "2017-04-10T16:56:46.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1145,17 +936,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1167,9 +954,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1184,17 +968,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -1206,9 +986,6 @@ "gname": "staff", "size": 289, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1223,17 +1000,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1245,9 +1018,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1262,17 +1032,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -1284,9 +1050,6 @@ "gname": "staff", "size": 339, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1301,17 +1064,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1323,9 +1082,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1340,9 +1096,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1355,23 +1109,12 @@ { "extended": { "atime": "2017-04-10T17:07:25.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1384,8 +1127,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:07:25.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1400,9 +1141,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-paths--meta-250-filter.json b/test/fixtures/parse/long-paths--meta-250-filter.json index 2a2e4960..0ceedf38 100644 --- a/test/fixtures/parse/long-paths--meta-250-filter.json +++ b/test/fixtures/parse/long-paths--meta-250-filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:53:02.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -47,23 +40,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:54:12.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836297, "nlink": 1, + "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -76,8 +58,6 @@ "size": 100, "mtime": "2017-04-10T16:54:12.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:54:12.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,17 +72,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -114,9 +90,6 @@ "gname": "staff", "size": 283, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -131,17 +104,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -153,9 +122,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -170,17 +136,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -192,9 +154,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -209,17 +168,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -231,9 +186,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -248,17 +200,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -270,9 +218,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -287,17 +232,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -309,9 +250,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -326,17 +264,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -348,9 +282,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -365,17 +296,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -387,9 +314,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -404,17 +328,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -426,9 +346,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -443,17 +360,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -465,9 +378,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -482,17 +392,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -504,9 +410,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -521,17 +424,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -543,9 +442,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -560,17 +456,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -582,9 +474,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -599,17 +488,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -621,9 +506,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -638,17 +520,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -660,9 +538,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -677,17 +552,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -699,9 +570,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -716,17 +584,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -738,9 +602,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -755,17 +616,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -777,9 +634,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -794,17 +648,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -816,9 +666,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -833,17 +680,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -855,9 +698,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -872,17 +712,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -894,9 +730,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -911,17 +744,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -933,9 +762,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -950,17 +776,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -972,9 +794,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -989,17 +808,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1011,9 +826,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1028,17 +840,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1050,9 +858,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1067,17 +872,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -1089,9 +890,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:58:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1106,17 +904,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1128,9 +922,6 @@ "gname": "staff", "size": 6, "mtime": "2017-04-10T16:56:46.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1145,17 +936,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1167,9 +954,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1184,17 +968,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -1206,9 +986,6 @@ "gname": "staff", "size": 289, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1223,17 +1000,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1245,9 +1018,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1262,17 +1032,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -1284,9 +1050,6 @@ "gname": "staff", "size": 339, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1301,17 +1064,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1323,9 +1082,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1340,9 +1096,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1355,23 +1109,12 @@ { "extended": { "atime": "2017-04-10T17:07:25.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -1384,8 +1127,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:07:25.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1400,9 +1141,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-paths--meta-250-strict.json b/test/fixtures/parse/long-paths--meta-250-strict.json index 532f2365..7fdf8ac4 100644 --- a/test/fixtures/parse/long-paths--meta-250-strict.json +++ b/test/fixtures/parse/long-paths--meta-250-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:53:02.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -47,23 +40,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:54:12.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836297, "nlink": 1, + "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -76,8 +58,6 @@ "size": 100, "mtime": "2017-04-10T16:54:12.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:54:12.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,17 +72,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -114,9 +90,6 @@ "gname": "staff", "size": 283, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -131,17 +104,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -153,9 +122,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -170,17 +136,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -192,9 +154,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -209,17 +168,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -231,9 +186,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -248,17 +200,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -270,9 +218,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -287,17 +232,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -309,9 +250,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -326,17 +264,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -348,9 +282,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -365,17 +296,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -387,9 +314,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -404,17 +328,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -426,9 +346,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -443,17 +360,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -465,9 +378,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -482,17 +392,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -504,9 +410,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -521,17 +424,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -543,9 +442,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -560,17 +456,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -582,9 +474,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -599,17 +488,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -621,9 +506,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -638,17 +520,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -660,9 +538,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -677,17 +552,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -699,9 +570,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -716,17 +584,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -738,9 +602,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -755,17 +616,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -777,9 +634,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -794,17 +648,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -816,9 +666,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -833,17 +680,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -855,9 +698,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -872,17 +712,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -894,9 +730,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -911,17 +744,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -933,9 +762,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -950,17 +776,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -972,9 +794,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -989,17 +808,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1011,9 +826,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1028,17 +840,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1050,9 +858,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1067,17 +872,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1089,9 +890,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:58:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1106,17 +904,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1128,9 +922,6 @@ "gname": "staff", "size": 6, "mtime": "2017-04-10T16:56:46.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1145,17 +936,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1167,9 +954,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1184,17 +968,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -1206,9 +986,6 @@ "gname": "staff", "size": 289, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1223,17 +1000,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1245,9 +1018,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1262,17 +1032,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -1284,9 +1050,6 @@ "gname": "staff", "size": 339, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1301,17 +1064,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1323,9 +1082,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1340,9 +1096,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1355,23 +1109,12 @@ { "extended": { "atime": "2017-04-10T17:07:25.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1384,8 +1127,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:07:25.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1400,9 +1141,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-paths--meta-250.json b/test/fixtures/parse/long-paths--meta-250.json index 532f2365..7fdf8ac4 100644 --- a/test/fixtures/parse/long-paths--meta-250.json +++ b/test/fixtures/parse/long-paths--meta-250.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:53:02.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -47,23 +40,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:54:12.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836297, "nlink": 1, + "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -76,8 +58,6 @@ "size": 100, "mtime": "2017-04-10T16:54:12.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:54:12.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,17 +72,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -114,9 +90,6 @@ "gname": "staff", "size": 283, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -131,17 +104,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -153,9 +122,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -170,17 +136,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -192,9 +154,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -209,17 +168,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -231,9 +186,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -248,17 +200,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -270,9 +218,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -287,17 +232,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -309,9 +250,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -326,17 +264,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -348,9 +282,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -365,17 +296,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -387,9 +314,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -404,17 +328,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -426,9 +346,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -443,17 +360,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -465,9 +378,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -482,17 +392,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -504,9 +410,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -521,17 +424,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -543,9 +442,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -560,17 +456,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -582,9 +474,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -599,17 +488,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -621,9 +506,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -638,17 +520,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -660,9 +538,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -677,17 +552,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -699,9 +570,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -716,17 +584,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -738,9 +602,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -755,17 +616,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -777,9 +634,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -794,17 +648,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -816,9 +666,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -833,17 +680,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -855,9 +698,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -872,17 +712,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -894,9 +730,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -911,17 +744,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -933,9 +762,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -950,17 +776,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -972,9 +794,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -989,17 +808,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1011,9 +826,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1028,17 +840,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1050,9 +858,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1067,17 +872,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1089,9 +890,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:58:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1106,17 +904,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1128,9 +922,6 @@ "gname": "staff", "size": 6, "mtime": "2017-04-10T16:56:46.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1145,17 +936,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1167,9 +954,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1184,17 +968,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -1206,9 +986,6 @@ "gname": "staff", "size": 289, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1223,17 +1000,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1245,9 +1018,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1262,17 +1032,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -1284,9 +1050,6 @@ "gname": "staff", "size": 339, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1301,17 +1064,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1323,9 +1082,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1340,9 +1096,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1355,23 +1109,12 @@ { "extended": { "atime": "2017-04-10T17:07:25.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1384,8 +1127,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:07:25.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1400,9 +1141,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-paths--strict.json b/test/fixtures/parse/long-paths--strict.json index 835fd96c..fb49f544 100644 --- a/test/fixtures/parse/long-paths--strict.json +++ b/test/fixtures/parse/long-paths--strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:53:02.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -47,23 +40,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:54:12.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836297, "nlink": 1, + "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -76,8 +58,6 @@ "size": 100, "mtime": "2017-04-10T16:54:12.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:54:12.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -107,23 +85,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:56:18.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836326, "nlink": 1, + "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -136,8 +103,6 @@ "size": 100, "mtime": "2017-04-10T16:56:18.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:56:18.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -152,17 +117,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -174,9 +135,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -191,17 +149,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -213,9 +167,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -230,17 +181,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -252,9 +199,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -269,17 +213,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -291,9 +231,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -308,17 +245,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -330,9 +263,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -347,17 +277,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -369,9 +295,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -386,17 +309,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -408,9 +327,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -425,17 +341,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -447,9 +359,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -464,17 +373,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -486,9 +391,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -503,17 +405,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -525,9 +423,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -542,17 +437,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -564,9 +455,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -581,17 +469,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -603,9 +487,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -620,17 +501,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -642,9 +519,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -659,17 +533,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -681,9 +551,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -698,17 +565,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -720,9 +583,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -737,17 +597,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -759,9 +615,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -776,17 +629,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -798,9 +647,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -815,17 +661,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -837,9 +679,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -854,17 +693,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -876,9 +711,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -893,17 +725,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -915,9 +743,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -932,17 +757,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -954,9 +775,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -971,17 +789,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -993,9 +807,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1010,17 +821,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1032,9 +839,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1049,17 +853,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1071,9 +871,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:58:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1088,17 +885,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1110,9 +903,6 @@ "gname": "staff", "size": 6, "mtime": "2017-04-10T16:56:46.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1127,17 +917,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1149,9 +935,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1166,9 +949,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1181,23 +962,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:52:20.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836253, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1210,8 +980,6 @@ "size": 100, "mtime": "2017-04-10T16:52:20.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:52:20.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1226,9 +994,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1241,23 +1007,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:52:20.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836254, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1270,8 +1025,6 @@ "size": 100, "mtime": "2017-04-10T16:52:20.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:52:20.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1286,9 +1039,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1301,23 +1052,12 @@ { "extended": { "atime": "2017-04-10T17:07:25.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1330,8 +1070,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:07:25.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1346,9 +1084,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-paths.json b/test/fixtures/parse/long-paths.json index 835fd96c..fb49f544 100644 --- a/test/fixtures/parse/long-paths.json +++ b/test/fixtures/parse/long-paths.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -15,9 +13,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:53:02.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,9 +27,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -47,23 +40,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:54:12.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836297, "nlink": 1, + "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -76,8 +58,6 @@ "size": 100, "mtime": "2017-04-10T16:54:12.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:54:12.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -92,9 +72,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -107,23 +85,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:56:18.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836326, "nlink": 1, + "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -136,8 +103,6 @@ "size": 100, "mtime": "2017-04-10T16:56:18.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:56:18.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -152,17 +117,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -174,9 +135,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -191,17 +149,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -213,9 +167,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -230,17 +181,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -252,9 +199,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -269,17 +213,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -291,9 +231,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -308,17 +245,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -330,9 +263,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -347,17 +277,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -369,9 +295,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -386,17 +309,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -408,9 +327,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -425,17 +341,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -447,9 +359,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -464,17 +373,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -486,9 +391,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -503,17 +405,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -525,9 +423,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -542,17 +437,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -564,9 +455,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -581,17 +469,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -603,9 +487,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -620,17 +501,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -642,9 +519,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -659,17 +533,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -681,9 +551,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -698,17 +565,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -720,9 +583,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -737,17 +597,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -759,9 +615,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -776,17 +629,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -798,9 +647,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -815,17 +661,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -837,9 +679,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -854,17 +693,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -876,9 +711,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -893,17 +725,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -915,9 +743,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -932,17 +757,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -954,9 +775,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -971,17 +789,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -993,9 +807,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1010,17 +821,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1032,9 +839,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1049,17 +853,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -1071,9 +871,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T16:58:47.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1088,17 +885,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1110,9 +903,6 @@ "gname": "staff", "size": 6, "mtime": "2017-04-10T16:56:46.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1127,17 +917,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1149,9 +935,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:52:20.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1166,9 +949,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1181,23 +962,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:52:20.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836253, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1210,8 +980,6 @@ "size": 100, "mtime": "2017-04-10T16:52:20.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:52:20.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1226,9 +994,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1241,23 +1007,12 @@ { "extended": { "atime": "2017-04-10T17:01:57.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:52:20.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836254, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1270,8 +1025,6 @@ "size": 100, "mtime": "2017-04-10T16:52:20.000Z", "atime": "2017-04-10T17:01:57.000Z", - "ctime": "2017-04-10T16:52:20.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1286,9 +1039,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -1301,23 +1052,12 @@ { "extended": { "atime": "2017-04-10T17:07:25.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -1330,8 +1070,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:07:25.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -1346,9 +1084,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-pax--filter-strict.json b/test/fixtures/parse/long-pax--filter-strict.json index 7e9df8bb..57f80513 100644 --- a/test/fixtures/parse/long-pax--filter-strict.json +++ b/test/fixtures/parse/long-pax--filter-strict.json @@ -7,24 +7,16 @@ "ignoredEntry", { "extended": { - "atime": null, - "charset": null, + "mtime": "2017-04-10T16:54:12.000Z", "comment": "all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy", - "ctime": null, "gid": 20, + "uid": 501, "gname": "staff", - "linkpath": null, - "mtime": "2017-04-10T16:54:12.000Z", + "uname": "isaacs", "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "size": 100, - "uid": 501, - "uname": "isaacs", - "dev": null, - "ino": null, - "nlink": null, "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -36,9 +28,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +42,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-pax--filter.json b/test/fixtures/parse/long-pax--filter.json index 7e9df8bb..57f80513 100644 --- a/test/fixtures/parse/long-pax--filter.json +++ b/test/fixtures/parse/long-pax--filter.json @@ -7,24 +7,16 @@ "ignoredEntry", { "extended": { - "atime": null, - "charset": null, + "mtime": "2017-04-10T16:54:12.000Z", "comment": "all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy", - "ctime": null, "gid": 20, + "uid": 501, "gname": "staff", - "linkpath": null, - "mtime": "2017-04-10T16:54:12.000Z", + "uname": "isaacs", "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "size": 100, - "uid": 501, - "uname": "isaacs", - "dev": null, - "ino": null, - "nlink": null, "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -36,9 +28,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +42,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-pax--meta-250-filter-strict.json b/test/fixtures/parse/long-pax--meta-250-filter-strict.json index 584863e0..4129b6fc 100644 --- a/test/fixtures/parse/long-pax--meta-250-filter-strict.json +++ b/test/fixtures/parse/long-pax--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1282, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,9 +59,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-pax--meta-250-filter.json b/test/fixtures/parse/long-pax--meta-250-filter.json index 584863e0..4129b6fc 100644 --- a/test/fixtures/parse/long-pax--meta-250-filter.json +++ b/test/fixtures/parse/long-pax--meta-250-filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1282, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -54,9 +45,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,9 +59,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-pax--meta-250-strict.json b/test/fixtures/parse/long-pax--meta-250-strict.json index 5a19f0ec..f989196b 100644 --- a/test/fixtures/parse/long-pax--meta-250-strict.json +++ b/test/fixtures/parse/long-pax--meta-250-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1282, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,9 +59,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-pax--meta-250.json b/test/fixtures/parse/long-pax--meta-250.json index 5a19f0ec..f989196b 100644 --- a/test/fixtures/parse/long-pax--meta-250.json +++ b/test/fixtures/parse/long-pax--meta-250.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "ExtendedHeader", "meta": true, "ignore": true, @@ -15,9 +13,6 @@ "gname": "staff", "size": 1282, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -32,17 +27,13 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], [ "entry", { - "extended": null, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -54,9 +45,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -71,9 +59,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-pax--strict.json b/test/fixtures/parse/long-pax--strict.json index c72def09..2385c664 100644 --- a/test/fixtures/parse/long-pax--strict.json +++ b/test/fixtures/parse/long-pax--strict.json @@ -7,24 +7,16 @@ "entry", { "extended": { - "atime": null, - "charset": null, + "mtime": "2017-04-10T16:54:12.000Z", "comment": "all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy", - "ctime": null, "gid": 20, + "uid": 501, "gname": "staff", - "linkpath": null, - "mtime": "2017-04-10T16:54:12.000Z", + "uname": "isaacs", "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "size": 100, - "uid": 501, - "uname": "isaacs", - "dev": null, - "ino": null, - "nlink": null, "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -36,9 +28,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +42,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/long-pax.json b/test/fixtures/parse/long-pax.json index c72def09..2385c664 100644 --- a/test/fixtures/parse/long-pax.json +++ b/test/fixtures/parse/long-pax.json @@ -7,24 +7,16 @@ "entry", { "extended": { - "atime": null, - "charset": null, + "mtime": "2017-04-10T16:54:12.000Z", "comment": "all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy all work and no play makes johnny a tar boy", - "ctime": null, "gid": 20, + "uid": 501, "gname": "staff", - "linkpath": null, - "mtime": "2017-04-10T16:54:12.000Z", + "uname": "isaacs", "path": "120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "size": 100, - "uid": 501, - "uname": "isaacs", - "dev": null, - "ino": null, - "nlink": null, "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -36,9 +28,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:54:12.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +42,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/next-file-has-long--filter-strict.json b/test/fixtures/parse/next-file-has-long--filter-strict.json index a010d9e3..efe114cd 100644 --- a/test/fixtures/parse/next-file-has-long--filter-strict.json +++ b/test/fixtures/parse/next-file-has-long--filter-strict.json @@ -9,7 +9,6 @@ "extended": { "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -21,9 +20,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -38,9 +34,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -54,7 +48,6 @@ "extended": { "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -66,8 +59,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T23:22:33.000Z", - "atime": null, - "ctime": null, "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "header": { "cksumValid": true, @@ -83,9 +74,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/next-file-has-long--filter.json b/test/fixtures/parse/next-file-has-long--filter.json index a010d9e3..efe114cd 100644 --- a/test/fixtures/parse/next-file-has-long--filter.json +++ b/test/fixtures/parse/next-file-has-long--filter.json @@ -9,7 +9,6 @@ "extended": { "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -21,9 +20,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -38,9 +34,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -54,7 +48,6 @@ "extended": { "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -66,8 +59,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T23:22:33.000Z", - "atime": null, - "ctime": null, "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "header": { "cksumValid": true, @@ -83,9 +74,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/next-file-has-long--meta-250-filter-strict.json b/test/fixtures/parse/next-file-has-long--meta-250-filter-strict.json index a010d9e3..efe114cd 100644 --- a/test/fixtures/parse/next-file-has-long--meta-250-filter-strict.json +++ b/test/fixtures/parse/next-file-has-long--meta-250-filter-strict.json @@ -9,7 +9,6 @@ "extended": { "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -21,9 +20,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -38,9 +34,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -54,7 +48,6 @@ "extended": { "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -66,8 +59,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T23:22:33.000Z", - "atime": null, - "ctime": null, "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "header": { "cksumValid": true, @@ -83,9 +74,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/next-file-has-long--meta-250-filter.json b/test/fixtures/parse/next-file-has-long--meta-250-filter.json index a010d9e3..efe114cd 100644 --- a/test/fixtures/parse/next-file-has-long--meta-250-filter.json +++ b/test/fixtures/parse/next-file-has-long--meta-250-filter.json @@ -9,7 +9,6 @@ "extended": { "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -21,9 +20,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -38,9 +34,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -54,7 +48,6 @@ "extended": { "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": true, @@ -66,8 +59,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T23:22:33.000Z", - "atime": null, - "ctime": null, "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "header": { "cksumValid": true, @@ -83,9 +74,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/next-file-has-long--meta-250-strict.json b/test/fixtures/parse/next-file-has-long--meta-250-strict.json index 9d6eef02..852c825b 100644 --- a/test/fixtures/parse/next-file-has-long--meta-250-strict.json +++ b/test/fixtures/parse/next-file-has-long--meta-250-strict.json @@ -9,7 +9,6 @@ "extended": { "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -21,9 +20,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -38,9 +34,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -54,7 +48,6 @@ "extended": { "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -66,8 +59,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T23:22:33.000Z", - "atime": null, - "ctime": null, "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "header": { "cksumValid": true, @@ -83,9 +74,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/next-file-has-long--meta-250.json b/test/fixtures/parse/next-file-has-long--meta-250.json index 9d6eef02..852c825b 100644 --- a/test/fixtures/parse/next-file-has-long--meta-250.json +++ b/test/fixtures/parse/next-file-has-long--meta-250.json @@ -9,7 +9,6 @@ "extended": { "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -21,9 +20,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -38,9 +34,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -54,7 +48,6 @@ "extended": { "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -66,8 +59,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T23:22:33.000Z", - "atime": null, - "ctime": null, "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "header": { "cksumValid": true, @@ -83,9 +74,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/next-file-has-long--strict.json b/test/fixtures/parse/next-file-has-long--strict.json index 9d6eef02..852c825b 100644 --- a/test/fixtures/parse/next-file-has-long--strict.json +++ b/test/fixtures/parse/next-file-has-long--strict.json @@ -9,7 +9,6 @@ "extended": { "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -21,9 +20,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -38,9 +34,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -54,7 +48,6 @@ "extended": { "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -66,8 +59,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T23:22:33.000Z", - "atime": null, - "ctime": null, "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "header": { "cksumValid": true, @@ -83,9 +74,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/next-file-has-long.json b/test/fixtures/parse/next-file-has-long.json index 9d6eef02..852c825b 100644 --- a/test/fixtures/parse/next-file-has-long.json +++ b/test/fixtures/parse/next-file-has-long.json @@ -9,7 +9,6 @@ "extended": { "path": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -21,9 +20,6 @@ "gname": "staff", "size": 100, "mtime": "2017-04-10T16:56:18.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -38,9 +34,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -54,7 +48,6 @@ "extended": { "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, - "globalExtended": null, "type": "SymbolicLink", "meta": false, "ignore": false, @@ -66,8 +59,6 @@ "gname": "staff", "size": 0, "mtime": "2017-04-10T23:22:33.000Z", - "atime": null, - "ctime": null, "linkpath": "170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "header": { "cksumValid": true, @@ -83,9 +74,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/null-byte--filter-strict.json b/test/fixtures/parse/null-byte--filter-strict.json index 3c27f2bb..e96a4f8a 100644 --- a/test/fixtures/parse/null-byte--filter-strict.json +++ b/test/fixtures/parse/null-byte--filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -11,13 +9,8 @@ "mode": 509, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 0, "mtime": "2017-07-31T22:21:58.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2017-07-31T22:21:58.000Z", "cksum": 11228, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "this_is_a_really_long_directory_name_with_a_lot_of_characters/this_is_a_really_long_tgz_file_with_a_lot_of_characters.tgz" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -56,13 +44,8 @@ "mode": 436, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 200, "mtime": "2017-07-31T22:21:53.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2017-07-31T22:21:53.000Z", "cksum": 15210, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/null-byte--filter.json b/test/fixtures/parse/null-byte--filter.json index 3c27f2bb..e96a4f8a 100644 --- a/test/fixtures/parse/null-byte--filter.json +++ b/test/fixtures/parse/null-byte--filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -11,13 +9,8 @@ "mode": 509, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 0, "mtime": "2017-07-31T22:21:58.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2017-07-31T22:21:58.000Z", "cksum": 11228, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "this_is_a_really_long_directory_name_with_a_lot_of_characters/this_is_a_really_long_tgz_file_with_a_lot_of_characters.tgz" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -56,13 +44,8 @@ "mode": 436, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 200, "mtime": "2017-07-31T22:21:53.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2017-07-31T22:21:53.000Z", "cksum": 15210, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/null-byte--meta-250-filter-strict.json b/test/fixtures/parse/null-byte--meta-250-filter-strict.json index 3c27f2bb..e96a4f8a 100644 --- a/test/fixtures/parse/null-byte--meta-250-filter-strict.json +++ b/test/fixtures/parse/null-byte--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -11,13 +9,8 @@ "mode": 509, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 0, "mtime": "2017-07-31T22:21:58.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2017-07-31T22:21:58.000Z", "cksum": 11228, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "this_is_a_really_long_directory_name_with_a_lot_of_characters/this_is_a_really_long_tgz_file_with_a_lot_of_characters.tgz" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -56,13 +44,8 @@ "mode": 436, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 200, "mtime": "2017-07-31T22:21:53.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2017-07-31T22:21:53.000Z", "cksum": 15210, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/null-byte--meta-250-filter.json b/test/fixtures/parse/null-byte--meta-250-filter.json index 3c27f2bb..e96a4f8a 100644 --- a/test/fixtures/parse/null-byte--meta-250-filter.json +++ b/test/fixtures/parse/null-byte--meta-250-filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -11,13 +9,8 @@ "mode": 509, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 0, "mtime": "2017-07-31T22:21:58.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2017-07-31T22:21:58.000Z", "cksum": 11228, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "this_is_a_really_long_directory_name_with_a_lot_of_characters/this_is_a_really_long_tgz_file_with_a_lot_of_characters.tgz" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -56,13 +44,8 @@ "mode": 436, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 200, "mtime": "2017-07-31T22:21:53.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2017-07-31T22:21:53.000Z", "cksum": 15210, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/null-byte--meta-250-strict.json b/test/fixtures/parse/null-byte--meta-250-strict.json index a9bad194..bb1f092c 100644 --- a/test/fixtures/parse/null-byte--meta-250-strict.json +++ b/test/fixtures/parse/null-byte--meta-250-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -11,13 +9,8 @@ "mode": 509, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 0, "mtime": "2017-07-31T22:21:58.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2017-07-31T22:21:58.000Z", "cksum": 11228, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "this_is_a_really_long_directory_name_with_a_lot_of_characters/this_is_a_really_long_tgz_file_with_a_lot_of_characters.tgz" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -56,13 +44,8 @@ "mode": 436, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 200, "mtime": "2017-07-31T22:21:53.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2017-07-31T22:21:53.000Z", "cksum": 15210, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/null-byte--meta-250.json b/test/fixtures/parse/null-byte--meta-250.json index a9bad194..bb1f092c 100644 --- a/test/fixtures/parse/null-byte--meta-250.json +++ b/test/fixtures/parse/null-byte--meta-250.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -11,13 +9,8 @@ "mode": 509, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 0, "mtime": "2017-07-31T22:21:58.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2017-07-31T22:21:58.000Z", "cksum": 11228, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "this_is_a_really_long_directory_name_with_a_lot_of_characters/this_is_a_really_long_tgz_file_with_a_lot_of_characters.tgz" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -56,13 +44,8 @@ "mode": 436, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 200, "mtime": "2017-07-31T22:21:53.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2017-07-31T22:21:53.000Z", "cksum": 15210, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/null-byte--strict.json b/test/fixtures/parse/null-byte--strict.json index a9bad194..bb1f092c 100644 --- a/test/fixtures/parse/null-byte--strict.json +++ b/test/fixtures/parse/null-byte--strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -11,13 +9,8 @@ "mode": 509, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 0, "mtime": "2017-07-31T22:21:58.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2017-07-31T22:21:58.000Z", "cksum": 11228, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "this_is_a_really_long_directory_name_with_a_lot_of_characters/this_is_a_really_long_tgz_file_with_a_lot_of_characters.tgz" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -56,13 +44,8 @@ "mode": 436, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 200, "mtime": "2017-07-31T22:21:53.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2017-07-31T22:21:53.000Z", "cksum": 15210, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/null-byte.json b/test/fixtures/parse/null-byte.json index a9bad194..bb1f092c 100644 --- a/test/fixtures/parse/null-byte.json +++ b/test/fixtures/parse/null-byte.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -11,13 +9,8 @@ "mode": 509, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 0, "mtime": "2017-07-31T22:21:58.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2017-07-31T22:21:58.000Z", "cksum": 11228, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "this_is_a_really_long_directory_name_with_a_lot_of_characters/this_is_a_really_long_tgz_file_with_a_lot_of_characters.tgz" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -56,13 +44,8 @@ "mode": 436, "uid": 1000, "gid": 1000, - "uname": null, - "gname": null, "size": 200, "mtime": "2017-07-31T22:21:53.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2017-07-31T22:21:53.000Z", "cksum": 15210, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/trailing-slash-corner-case--filter-strict.json b/test/fixtures/parse/trailing-slash-corner-case--filter-strict.json index 3739da97..151be717 100644 --- a/test/fixtures/parse/trailing-slash-corner-case--filter-strict.json +++ b/test/fixtures/parse/trailing-slash-corner-case--filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -11,13 +9,8 @@ "mode": 493, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 0, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13612, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/a-truly-unlucky-file-beyond-130-byte-path-length.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -56,13 +44,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13611, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -93,7 +72,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/some-unlucky-file.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -101,13 +79,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-18T23:49:44.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -119,12 +92,8 @@ "mtime": "2018-06-18T23:49:44.000Z", "cksum": 13602, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/trailing-slash-corner-case--filter.json b/test/fixtures/parse/trailing-slash-corner-case--filter.json index 3739da97..151be717 100644 --- a/test/fixtures/parse/trailing-slash-corner-case--filter.json +++ b/test/fixtures/parse/trailing-slash-corner-case--filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -11,13 +9,8 @@ "mode": 493, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 0, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13612, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/a-truly-unlucky-file-beyond-130-byte-path-length.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -56,13 +44,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13611, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -93,7 +72,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/some-unlucky-file.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -101,13 +79,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-18T23:49:44.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -119,12 +92,8 @@ "mtime": "2018-06-18T23:49:44.000Z", "cksum": 13602, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/trailing-slash-corner-case--meta-250-filter-strict.json b/test/fixtures/parse/trailing-slash-corner-case--meta-250-filter-strict.json index 3739da97..151be717 100644 --- a/test/fixtures/parse/trailing-slash-corner-case--meta-250-filter-strict.json +++ b/test/fixtures/parse/trailing-slash-corner-case--meta-250-filter-strict.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -11,13 +9,8 @@ "mode": 493, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 0, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13612, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/a-truly-unlucky-file-beyond-130-byte-path-length.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -56,13 +44,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13611, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -93,7 +72,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/some-unlucky-file.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -101,13 +79,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-18T23:49:44.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -119,12 +92,8 @@ "mtime": "2018-06-18T23:49:44.000Z", "cksum": 13602, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/trailing-slash-corner-case--meta-250-filter.json b/test/fixtures/parse/trailing-slash-corner-case--meta-250-filter.json index 3739da97..151be717 100644 --- a/test/fixtures/parse/trailing-slash-corner-case--meta-250-filter.json +++ b/test/fixtures/parse/trailing-slash-corner-case--meta-250-filter.json @@ -2,8 +2,6 @@ [ "ignoredEntry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": true, @@ -11,13 +9,8 @@ "mode": 493, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 0, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13612, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/a-truly-unlucky-file-beyond-130-byte-path-length.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -56,13 +44,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13611, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -93,7 +72,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/some-unlucky-file.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -101,13 +79,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-18T23:49:44.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -119,12 +92,8 @@ "mtime": "2018-06-18T23:49:44.000Z", "cksum": 13602, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/trailing-slash-corner-case--meta-250-strict.json b/test/fixtures/parse/trailing-slash-corner-case--meta-250-strict.json index 14200298..c5110f0c 100644 --- a/test/fixtures/parse/trailing-slash-corner-case--meta-250-strict.json +++ b/test/fixtures/parse/trailing-slash-corner-case--meta-250-strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -11,13 +9,8 @@ "mode": 493, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 0, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13612, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/a-truly-unlucky-file-beyond-130-byte-path-length.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -56,13 +44,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13611, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -93,7 +72,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/some-unlucky-file.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -101,13 +79,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-18T23:49:44.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -119,12 +92,8 @@ "mtime": "2018-06-18T23:49:44.000Z", "cksum": 13602, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/trailing-slash-corner-case--meta-250.json b/test/fixtures/parse/trailing-slash-corner-case--meta-250.json index 14200298..c5110f0c 100644 --- a/test/fixtures/parse/trailing-slash-corner-case--meta-250.json +++ b/test/fixtures/parse/trailing-slash-corner-case--meta-250.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -11,13 +9,8 @@ "mode": 493, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 0, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13612, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/a-truly-unlucky-file-beyond-130-byte-path-length.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -56,13 +44,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13611, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -93,7 +72,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/some-unlucky-file.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -101,13 +79,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-18T23:49:44.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -119,12 +92,8 @@ "mtime": "2018-06-18T23:49:44.000Z", "cksum": 13602, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/trailing-slash-corner-case--strict.json b/test/fixtures/parse/trailing-slash-corner-case--strict.json index 14200298..c5110f0c 100644 --- a/test/fixtures/parse/trailing-slash-corner-case--strict.json +++ b/test/fixtures/parse/trailing-slash-corner-case--strict.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -11,13 +9,8 @@ "mode": 493, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 0, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13612, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/a-truly-unlucky-file-beyond-130-byte-path-length.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -56,13 +44,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13611, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -93,7 +72,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/some-unlucky-file.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -101,13 +79,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-18T23:49:44.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -119,12 +92,8 @@ "mtime": "2018-06-18T23:49:44.000Z", "cksum": 13602, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/trailing-slash-corner-case.json b/test/fixtures/parse/trailing-slash-corner-case.json index 14200298..c5110f0c 100644 --- a/test/fixtures/parse/trailing-slash-corner-case.json +++ b/test/fixtures/parse/trailing-slash-corner-case.json @@ -2,8 +2,6 @@ [ "entry", { - "extended": null, - "globalExtended": null, "type": "Directory", "meta": false, "ignore": false, @@ -11,13 +9,8 @@ "mode": 493, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 0, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -29,12 +22,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13612, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -48,7 +37,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/a-truly-unlucky-file-beyond-130-byte-path-length.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -56,13 +44,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-19T00:03:11.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -74,12 +57,8 @@ "mtime": "2018-06-19T00:03:11.000Z", "cksum": 13611, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -93,7 +72,6 @@ "extended": { "path": "99-byte-dirname-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc/some-unlucky-file.txt" }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -101,13 +79,8 @@ "mode": 420, "uid": 501, "gid": 20, - "uname": null, - "gname": null, "size": 560, "mtime": "2018-06-18T23:49:44.000Z", - "atime": null, - "ctime": null, - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -119,12 +92,8 @@ "mtime": "2018-06-18T23:49:44.000Z", "cksum": 13602, "linkpath": "", - "uname": null, - "gname": null, "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/utf8--filter-strict.json b/test/fixtures/parse/utf8--filter-strict.json index b8c5bac5..7dc9969f 100644 --- a/test/fixtures/parse/utf8--filter-strict.json +++ b/test/fixtures/parse/utf8--filter-strict.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:51:42.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836217, "nlink": 1, + "path": "Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -37,8 +26,6 @@ "size": 2, "mtime": "2017-04-10T16:51:42.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:51:42.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +40,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -68,23 +53,12 @@ { "extended": { "atime": "2017-04-10T17:06:33.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -97,8 +71,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:06:33.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -113,9 +85,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -128,23 +98,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -157,8 +116,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -173,9 +130,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/utf8--filter.json b/test/fixtures/parse/utf8--filter.json index b8c5bac5..7dc9969f 100644 --- a/test/fixtures/parse/utf8--filter.json +++ b/test/fixtures/parse/utf8--filter.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:51:42.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836217, "nlink": 1, + "path": "Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -37,8 +26,6 @@ "size": 2, "mtime": "2017-04-10T16:51:42.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:51:42.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +40,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -68,23 +53,12 @@ { "extended": { "atime": "2017-04-10T17:06:33.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -97,8 +71,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:06:33.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -113,9 +85,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -128,23 +98,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -157,8 +116,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -173,9 +130,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/utf8--meta-250-filter-strict.json b/test/fixtures/parse/utf8--meta-250-filter-strict.json index b8c5bac5..7dc9969f 100644 --- a/test/fixtures/parse/utf8--meta-250-filter-strict.json +++ b/test/fixtures/parse/utf8--meta-250-filter-strict.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:51:42.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836217, "nlink": 1, + "path": "Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -37,8 +26,6 @@ "size": 2, "mtime": "2017-04-10T16:51:42.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:51:42.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +40,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -68,23 +53,12 @@ { "extended": { "atime": "2017-04-10T17:06:33.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -97,8 +71,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:06:33.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -113,9 +85,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -128,23 +98,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -157,8 +116,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -173,9 +130,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/utf8--meta-250-filter.json b/test/fixtures/parse/utf8--meta-250-filter.json index b8c5bac5..7dc9969f 100644 --- a/test/fixtures/parse/utf8--meta-250-filter.json +++ b/test/fixtures/parse/utf8--meta-250-filter.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:51:42.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836217, "nlink": 1, + "path": "Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -37,8 +26,6 @@ "size": 2, "mtime": "2017-04-10T16:51:42.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:51:42.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +40,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -68,23 +53,12 @@ { "extended": { "atime": "2017-04-10T17:06:33.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -97,8 +71,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:06:33.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -113,9 +85,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -128,23 +98,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": true, @@ -157,8 +116,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -173,9 +130,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/utf8--meta-250-strict.json b/test/fixtures/parse/utf8--meta-250-strict.json index 611f052a..4ee5a61a 100644 --- a/test/fixtures/parse/utf8--meta-250-strict.json +++ b/test/fixtures/parse/utf8--meta-250-strict.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:51:42.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836217, "nlink": 1, + "path": "Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -37,8 +26,6 @@ "size": 2, "mtime": "2017-04-10T16:51:42.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:51:42.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +40,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -68,23 +53,12 @@ { "extended": { "atime": "2017-04-10T17:06:33.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -97,8 +71,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:06:33.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -113,9 +85,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -128,23 +98,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -157,8 +116,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -173,9 +130,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/utf8--meta-250.json b/test/fixtures/parse/utf8--meta-250.json index 611f052a..4ee5a61a 100644 --- a/test/fixtures/parse/utf8--meta-250.json +++ b/test/fixtures/parse/utf8--meta-250.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:51:42.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836217, "nlink": 1, + "path": "Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -37,8 +26,6 @@ "size": 2, "mtime": "2017-04-10T16:51:42.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:51:42.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +40,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -68,23 +53,12 @@ { "extended": { "atime": "2017-04-10T17:06:33.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -97,8 +71,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:06:33.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -113,9 +85,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -128,23 +98,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -157,8 +116,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -173,9 +130,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/utf8--strict.json b/test/fixtures/parse/utf8--strict.json index 611f052a..4ee5a61a 100644 --- a/test/fixtures/parse/utf8--strict.json +++ b/test/fixtures/parse/utf8--strict.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:51:42.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836217, "nlink": 1, + "path": "Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -37,8 +26,6 @@ "size": 2, "mtime": "2017-04-10T16:51:42.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:51:42.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +40,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -68,23 +53,12 @@ { "extended": { "atime": "2017-04-10T17:06:33.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -97,8 +71,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:06:33.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -113,9 +85,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -128,23 +98,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -157,8 +116,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -173,9 +130,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/fixtures/parse/utf8.json b/test/fixtures/parse/utf8.json index 611f052a..4ee5a61a 100644 --- a/test/fixtures/parse/utf8.json +++ b/test/fixtures/parse/utf8.json @@ -8,23 +8,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:51:42.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836217, "nlink": 1, + "path": "Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -37,8 +26,6 @@ "size": 2, "mtime": "2017-04-10T16:51:42.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:51:42.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -53,9 +40,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -68,23 +53,12 @@ { "extended": { "atime": "2017-04-10T17:06:33.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T17:05:56.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "🌟.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836716, "nlink": 1, + "path": "🌟.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -97,8 +71,6 @@ "size": 106, "mtime": "2017-04-10T17:05:55.000Z", "atime": "2017-04-10T17:06:33.000Z", - "ctime": "2017-04-10T17:05:56.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -113,9 +85,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], @@ -128,23 +98,12 @@ { "extended": { "atime": "2017-04-10T17:02:38.000Z", - "charset": null, - "comment": null, - "ctime": "2017-04-10T16:58:47.000Z", - "gid": null, - "gname": null, - "linkpath": null, - "mtime": null, - "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", - "size": null, - "uid": null, - "uname": null, "dev": 16777220, "ino": 9836396, "nlink": 1, + "path": "long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt", "global": false }, - "globalExtended": null, "type": "File", "meta": false, "ignore": false, @@ -157,8 +116,6 @@ "size": 2, "mtime": "2017-04-10T16:58:47.000Z", "atime": "2017-04-10T17:02:38.000Z", - "ctime": "2017-04-10T16:58:47.000Z", - "linkpath": "", "header": { "cksumValid": true, "needPax": false, @@ -173,9 +130,7 @@ "uname": "isaacs", "gname": "staff", "devmaj": 0, - "devmin": 0, - "atime": null, - "ctime": null + "devmin": 0 } } ], diff --git a/test/get-write-flag.js b/test/get-write-flag.js index 81c2f547..63c4a2bf 100644 --- a/test/get-write-flag.js +++ b/test/get-write-flag.js @@ -1,67 +1,73 @@ -const t = require('tap') +import fs from 'fs' +import t from 'tap' +import { fileURLToPath } from 'url' +import { getWriteFlag } from '../dist/esm/get-write-flag.js' + +const __filename = fileURLToPath(import.meta.url) // run three scenarios // unix (no fmap) // win32 (without fmap support) // win32 (with fmap support) -const fs = require('fs') const hasFmap = !!fs.constants.UV_FS_O_FILEMAP -const platform = process.platform +const { platform } = process const UV_FS_O_FILEMAP = 0x20000000 switch (process.argv[2]) { case 'win32-fmap': { - if (!hasFmap) { - global.__FAKE_TESTING_FS__ = { - constants: { - ...fs.constants, - ...{ UV_FS_O_FILEMAP }, - }, - } - } const { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants - if (platform !== 'win32') { - process.env.__FAKE_PLATFORM__ = 'win32' - } - const getFlag = require('../lib/get-write-flag.js') - t.equal(getFlag(1), UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY) - t.equal(getFlag(512 * 1024 + 1), 'w') + t.equal( + getWriteFlag(1), + UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY, + ) + t.equal(getWriteFlag(512 * 1024 + 1), 'w') break } case 'win32-nofmap': { - if (hasFmap) { - global.__FAKE_TESTING_FS__ = { - constants: { - ...fs.constants, - ...{ UV_FS_O_FILEMAP: 0 }, - }, - } - } - if (platform !== 'win32') { - process.env.__FAKE_PLATFORM__ = 'win32' - } - const getFlag = require('../lib/get-write-flag.js') - t.equal(getFlag(1), 'w') - t.equal(getFlag(512 * 1024 + 1), 'w') + t.equal(getWriteFlag(1), 'w') + t.equal(getWriteFlag(512 * 1024 + 1), 'w') break } case 'unix': { - if (platform === 'win32') { - process.env.__FAKE_PLATFORM__ = 'darwin' - } - const getFlag = require('../lib/get-write-flag.js') - t.equal(getFlag(1), 'w') - t.equal(getFlag(512 * 1024 + 1), 'w') + t.equal(getWriteFlag(1), 'w') + t.equal(getWriteFlag(512 * 1024 + 1), 'w') break } default: { const node = process.execPath - t.spawn(node, [__filename, 'win32-fmap']) - t.spawn(node, [__filename, 'win32-nofmap']) - t.spawn(node, [__filename, 'unix']) + t.spawn(node, [__filename, 'win32-fmap'], { + env: { + ...process.env, + ...(platform === 'win32' + ? {} + : { + __FAKE_FS_O_FILENAME__: String(UV_FS_O_FILEMAP), + __FAKE_PLATFORM__: 'win32', + }), + }, + }) + t.spawn(node, [__filename, 'win32-nofmap'], { + env: { + ...process.env, + ...(platform === 'win32' + ? {} + : { + __FAKE_FS_O_FILENAME__: '0', + __FAKE_PLATFORM__: 'win32', + }), + }, + }) + t.spawn(node, [__filename, 'unix'], { + env: { + ...process.env, + ...(platform === 'win32' + ? { __FAKE_PLATFORM__: 'linux' } + : {}), + }, + }) } } diff --git a/test/header.js b/test/header.js index 1a17eb83..8d3eb06e 100644 --- a/test/header.js +++ b/test/header.js @@ -1,32 +1,32 @@ -'use strict' -const t = require('tap') -const Header = require('../lib/header.js') +import t from 'tap' +import { Header } from '../dist/esm/header.js' t.test('ustar format', t => { const buf = Buffer.from( '666f6f2e74787400000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000030303037353520003035373736312000303030303234200037373737' + - '3737373737373700313236373735363735343000303133303531200030000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461720030306973616163730000000000000000000000000000000000' + - '0000000000000000007374616666000000000000000000000000000000000000' + - '0000000000000000003030303030302000303030303030200000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000', - 'hex') + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000030303037353520003035373736312000303030303234200037373737' + + '3737373737373700313236373735363735343000303133303531200030000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461720030306973616163730000000000000000000000000000000000' + + '0000000000000000007374616666000000000000000000000000000000000000' + + '0000000000000000003030303030302000303030303030200000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000', + 'hex', + ) const h = new Header({ path: 'foo.txt', }) const slab = Buffer.alloc(1024) - h.set({ + Object.assign(h, { mode: 0o755, uid: 24561, gid: 20, @@ -38,9 +38,11 @@ t.test('ustar format', t => { }) h.encode(slab) - t.equal(slab.slice(0, 512).toString('hex'), buf.toString('hex')) - t.equal(slab.toString('hex'), buf.toString('hex') + - (new Array(1025).join('0'))) + t.equal(slab.subarray(0, 512).toString('hex'), buf.toString('hex')) + t.equal( + slab.toString('hex'), + buf.toString('hex') + new Array(1025).join('0'), + ) const h2 = new Header(buf) @@ -64,30 +66,31 @@ t.test('ustar format', t => { t.test('xstar format', t => { const buf = Buffer.from( '666f6f2e74787400000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000030303037353520003035373736312000303030303234200030303030' + - '3030303134342000313236373735363735343000303135313331200030000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461720030306973616163730000000000000000000000000000000000' + - '0000000000000000007374616666000000000000000000000000000000000000' + - '0000000000000000003030303030302000303030303030200000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000031323637' + - '3735363735343000313236373735363735343000000000000000000000000000' + - // just some junk - '420420420420420420420420420420420420420420420420420420420420', - 'hex') + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000030303037353520003035373736312000303030303234200030303030' + + '3030303134342000313236373735363735343000303135313331200030000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461720030306973616163730000000000000000000000000000000000' + + '0000000000000000007374616666000000000000000000000000000000000000' + + '0000000000000000003030303030302000303030303030200000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000031323637' + + '3735363735343000313236373735363735343000000000000000000000000000' + + // just some junk + '420420420420420420420420420420420420420420420420420420420420', + 'hex', + ) const h = new Header({ path: 'foo.txt', }) - h.set({ + Object.assign(h, { mode: 0o755, uid: 24561, gid: 20, @@ -102,7 +105,7 @@ t.test('xstar format', t => { h.encode() const slab = h.block - t.equal(slab.toString('hex'), buf.slice(0, 512).toString('hex')) + t.equal(slab.toString('hex'), buf.subarray(0, 512).toString('hex')) const h2 = new Header(buf) @@ -131,25 +134,27 @@ t.test('prefix handling', t => { t.test('no times', t => { const buf = Buffer.from( '666f6f2e74787400000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000030303037353520003035373736312000303030303234200030303030' + - '3030303134342000313236373735363735343000303337323734200030000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461720030306973616163730000000000000000000000000000000000' + - '0000000000000000007374616666000000000000000000000000000000000000' + - '00000000000000000030303030303020003030303030302000722f652f612f6c' + - '2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f79' + - '2f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f72' + - '2f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f61' + - '2f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f642f652f652f702f2d' + - '2f702f612f742f68000000000000000000000000000000000000000000000000', - 'hex') + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000030303037353520003035373736312000303030303234200030303030' + + '3030303134342000313236373735363735343000303337323734200030000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461720030306973616163730000000000000000000000000000000000' + + '0000000000000000007374616666000000000000000000000000000000000000' + + '00000000000000000030303030303020003030303030302000722f652f612f6c' + + '2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f79' + + '2f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f72' + + '2f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f61' + + '2f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f642f652f652f702f2d' + + '2f702f612f742f68000000000000000000000000000000000000000000000000', + 'hex', + ) const h = new Header({ - path: 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + + path: + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/d/e/e/p/-/p/a/t/h/foo.txt', mode: 0o755, @@ -166,14 +171,17 @@ t.test('prefix handling', t => { const b2 = Buffer.alloc(512) h.encode(b2, 0) - t.equal(b2.toString().replace(/\0+/g, ' '), - buf.toString().replace(/\0+/g, ' ')) + t.equal( + b2.toString().replace(/\0+/g, ' '), + buf.toString().replace(/\0+/g, ' '), + ) t.equal(b2.toString('hex'), buf.toString('hex')) const h2 = new Header(buf) t.match(h2, { - path: 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + + path: + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/d/e/e/p/-/p/a/t/h/foo.txt', mode: 0o755, @@ -192,10 +200,13 @@ t.test('prefix handling', t => { }) t.equal(b2.toString().replace(/\0.*$/, ''), 'foo.txt') - t.equal(b2.slice(345).toString().replace(/\0.*$/, ''), 'r/e/a/l/l/y/-' + - '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + - '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + - '/d/e/e/p/-/p/a/t/h') + t.equal( + b2.subarray(345).toString().replace(/\0.*$/, ''), + 'r/e/a/l/l/y/-' + + '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + + '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + + '/d/e/e/p/-/p/a/t/h', + ) t.end() }) @@ -203,27 +214,29 @@ t.test('prefix handling', t => { t.test('a/c times, use shorter prefix field', t => { const buf = Buffer.from( '652f702f2d2f702f612f742f682f666f6f2e7478740000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000030303037353520003035373736312000303030303234200030303030' + - '3030303134342000313236373735363735343000303431353030200030000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461720030306973616163730000000000000000000000000000000000' + - '0000000000000000007374616666000000000000000000000000000000000000' + - '00000000000000000030303030303020003030303030302000722f652f612f6c' + - '2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f79' + - '2f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f72' + - '2f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f61' + - '2f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f642f65000031323637' + - '3735363735343000313236373735363735343000000000000000000000000000', - 'hex') + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000030303037353520003035373736312000303030303234200030303030' + + '3030303134342000313236373735363735343000303431353030200030000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461720030306973616163730000000000000000000000000000000000' + + '0000000000000000007374616666000000000000000000000000000000000000' + + '00000000000000000030303030303020003030303030302000722f652f612f6c' + + '2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f79' + + '2f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f72' + + '2f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f61' + + '2f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f642f65000031323637' + + '3735363735343000313236373735363735343000000000000000000000000000', + 'hex', + ) const h = new Header() - h.path = 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + - 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + - '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/d/e/e/p/-/p/a/t/h/foo.txt' + h.path = + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + + '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/d/e/e/p/-/p/a/t/h/foo.txt' h.mode = 0o755 h.uid = 24561 h.gid = 20 @@ -241,33 +254,44 @@ t.test('prefix handling', t => { const b3 = Buffer.alloc(1024) h.encode(b3, 100) - t.equal(b2.toString('hex'), b3.slice(100, 612).toString('hex')) + t.equal(b2.toString('hex'), b3.subarray(100, 612).toString('hex')) const h2 = new Header(b3, 100) - t.match(h2, { - path: 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + - 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + - '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/d/e/e/p/-/p/a/t/h/foo.txt', - mode: 0o755, - uid: 24561, - gid: 20, - size: 100, - mtime: new Date('2016-04-01T22:00Z'), - ctime: new Date('2016-04-01T22:00Z'), - atime: new Date('2016-04-01T22:00Z'), - type: 'File', - uname: 'isaacs', - gname: 'staff', - cksumValid: true, - cksum: 17216, - needPax: false, - }, 'header from buffer') - - t.equal(b2.toString().replace(/\0.*$/, ''), 'e/p/-/p/a/t/h/foo.txt') - t.equal(b2.slice(345).toString().replace(/\0.*$/, ''), 'r/e/a/l/l/y/-' + - '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + - '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/d/e') + t.match( + h2, + { + path: + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + + '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/d/e/e/p/-/p/a/t/h/foo.txt', + mode: 0o755, + uid: 24561, + gid: 20, + size: 100, + mtime: new Date('2016-04-01T22:00Z'), + ctime: new Date('2016-04-01T22:00Z'), + atime: new Date('2016-04-01T22:00Z'), + type: 'File', + uname: 'isaacs', + gname: 'staff', + cksumValid: true, + cksum: 17216, + needPax: false, + }, + 'header from buffer', + ) + + t.equal( + b2.toString().replace(/\0.*$/, ''), + 'e/p/-/p/a/t/h/foo.txt', + ) + t.equal( + b2.subarray(345).toString().replace(/\0.*$/, ''), + 'r/e/a/l/l/y/-' + + '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-' + + '/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/d/e', + ) t.end() }) @@ -275,27 +299,30 @@ t.test('prefix handling', t => { t.test('hella long basename', t => { const buf = Buffer.from( '6c6f6e672d66696c652d6c6f6e672d66696c652d6c6f6e672d66696c652d6c6f' + - '6e672d66696c652d6c6f6e672d66696c652d6c6f6e672d66696c652d6c6f6e67' + - '2d66696c652d6c6f6e672d66696c652d6c6f6e672d66696c652d6c6f6e672d66' + - '696c650030303037353520003035373736312000303030303234200030303030' + - '3030303134342000313236373735363735343000303630313431200030000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461720030306973616163730000000000000000000000000000000000' + - '0000000000000000007374616666000000000000000000000000000000000000' + - '00000000000000000030303030303020003030303030302000722f652f612f6c' + - '2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f79' + - '2f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f72' + - '2f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f61' + - '2f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f642f652f652f702f2d' + - '2f702f612f742f68000000000000000000000000000000000000000000000000', - 'hex') + '6e672d66696c652d6c6f6e672d66696c652d6c6f6e672d66696c652d6c6f6e67' + + '2d66696c652d6c6f6e672d66696c652d6c6f6e672d66696c652d6c6f6e672d66' + + '696c650030303037353520003035373736312000303030303234200030303030' + + '3030303134342000313236373735363735343000303630313431200030000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461720030306973616163730000000000000000000000000000000000' + + '0000000000000000007374616666000000000000000000000000000000000000' + + '00000000000000000030303030303020003030303030302000722f652f612f6c' + + '2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f79' + + '2f2d2f722f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f72' + + '2f652f612f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f722f652f61' + + '2f6c2f6c2f792f2d2f722f652f612f6c2f6c2f792f2d2f642f652f652f702f2d' + + '2f702f612f742f68000000000000000000000000000000000000000000000000', + 'hex', + ) const h = new Header({ - path: 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + + path: + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/d/e/e/p/-/p/a/t/h/' + - (new Array(20).join('long-file-')) + 'long-file.txt', + new Array(20).join('long-file-') + + 'long-file.txt', mode: 0o755, uid: 24561, gid: 20, @@ -318,7 +345,8 @@ t.test('prefix handling', t => { t.match(h2, { cksumValid: true, cksum: 24673, - path: 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + + path: + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + 'r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/r/e/a/l/l/y/-/' + 'r/e/a/l/l/y/-/d/e/e/p/-/p/a/t/h/long-file-long-file-long-' + 'file-long-file-long-file-long-file-long-file-long-file-long-' + @@ -332,26 +360,30 @@ t.test('prefix handling', t => { t.test('long basename, long dirname', t => { const buf = Buffer.from( '6c6f6e672d6469726e616d652d6c6f6e672d6469726e616d652d6c6f6e672d64' + - '69726e616d652d6c6f6e672d6469726e616d652d6c6f6e672d6469726e616d65' + - '2d6c6f6e672d6469726e616d652d6c6f6e672d6469726e616d652d6c6f6e672d' + - '6469720030303037353520003035373736312000303030303234200030303030' + - '3030303134342000313236373735363735343000303334323035200030000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461720030306973616163730000000000000000000000000000000000' + - '0000000000000000007374616666000000000000000000000000000000000000' + - '0000000000000000003030303030302000303030303030200000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000', - 'hex') + '69726e616d652d6c6f6e672d6469726e616d652d6c6f6e672d6469726e616d65' + + '2d6c6f6e672d6469726e616d652d6c6f6e672d6469726e616d652d6c6f6e672d' + + '6469720030303037353520003035373736312000303030303234200030303030' + + '3030303134342000313236373735363735343000303334323035200030000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461720030306973616163730000000000000000000000000000000000' + + '0000000000000000007374616666000000000000000000000000000000000000' + + '0000000000000000003030303030302000303030303030200000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000', + 'hex', + ) const h = new Header({ - path: (new Array(30).join('long-dirname-')) + 'long-dirname/' + - (new Array(20).join('long-file-')) + 'long-file.txt', + path: + new Array(30).join('long-dirname-') + + 'long-dirname/' + + new Array(20).join('long-file-') + + 'long-file.txt', mode: 0o755, uid: 24561, gid: 20, @@ -376,7 +408,8 @@ t.test('prefix handling', t => { const h2 = new Header(b2) t.match(h2, { - path: 'long-dirname-long-dirname-long-dirname-long-dirname-' + + path: + 'long-dirname-long-dirname-long-dirname-long-dirname-' + 'long-dirname-long-dirname-long-dirname-long-dir', cksum: 14469, cksumValid: true, @@ -388,11 +421,15 @@ t.test('prefix handling', t => { }) t.test('throwers', t => { - t.throws(_ => new Header(Buffer.alloc(100)), - new Error('need 512 bytes for header')) + t.throws( + _ => new Header(Buffer.alloc(100)), + new Error('need 512 bytes for header'), + ) - t.throws(_ => new Header({}).encode(Buffer.alloc(100)), - new Error('need 512 bytes for header')) + t.throws( + _ => new Header({}).encode(Buffer.alloc(100)), + new Error('need 512 bytes for header'), + ) t.end() }) @@ -404,68 +441,72 @@ t.test('null block', t => { needPax: false, path: '', type: 'File', - mode: null, - uid: null, - gid: null, - size: null, - mtime: null, - cksum: null, + mode: undefined, + uid: undefined, + gid: undefined, + size: undefined, + mtime: undefined, + cksum: undefined, linkpath: '', - uname: null, - gname: null, + uname: undefined, + gname: undefined, devmaj: 0, devmin: 0, - atime: null, - ctime: null, + atime: undefined, + ctime: undefined, nullBlock: true, }) t.end() }) t.test('unknown type', t => { - const h = new Header(Buffer.from( - '666f6f2e74787400000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000030303037353520003035373736312000303030303234200030303030' + - '303030313434200031323637373536373534300030303630373620005a000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000', - 'hex')) - - t.equal(h.type, 'Z') - t.equal(h.typeKey, 'Z') + const h = new Header( + Buffer.from( + '666f6f2e74787400000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000030303037353520003035373736312000303030303234200030303030' + + '303030313434200031323637373536373534300030303630373620005a000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000', + 'hex', + ), + ) + + t.equal(h.type, 'Unsupported') + t.equal(h.typeKey, 'Unsupported') t.end() }) t.test('dir as file with trailing /', t => { const b = Buffer.from( '782f792f00000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000030303030' + - '3030303030302000000000000000000000000000303034363136200030000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461720030300000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000003030303030302000303030303030200000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000', - 'hex') + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000030303030' + + '3030303030302000000000000000000000000000303034363136200030000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461720030300000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000003030303030302000303030303030200000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000', + 'hex', + ) const h = new Header(b) t.equal(h.type, 'Directory') b[156] = '0'.charCodeAt(0) @@ -478,24 +519,28 @@ t.test('null numeric values do not get written', t => { const b = Buffer.alloc(512) const h = new Header() h.encode(b, 0) - t.equal( - b.toString('hex'), - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000303033303737200030000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461720030300000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000003030303030302000303030303030200000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000') + t.same( + b, + Buffer.from( + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000303033303737200030000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461720030300000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000003030303030302000303030303030200000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000', + 'hex', + ), + ) const h2 = new Header(b) t.match(h2, { type: 'File', @@ -503,19 +548,19 @@ t.test('null numeric values do not get written', t => { needPax: false, nullBlock: false, path: '', - mode: null, - uid: null, - gid: null, - size: null, - mtime: null, + mode: undefined, + uid: undefined, + gid: undefined, + size: undefined, + mtime: undefined, cksum: 1599, linkpath: '', uname: '', gname: '', devmaj: 0, devmin: 0, - atime: null, - ctime: null, + atime: undefined, + ctime: undefined, }) t.end() }) @@ -535,22 +580,23 @@ t.test('big numbers', t => { t.test('dir with long body', t => { const b = Buffer.from( '7061636b6167652f76656e646f72000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000030303037353520003030303030302000303030303030200030303030' + - '3030313030303020313330363133303232343120303132303236200035000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461720030300000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000003030303030302000303030303030200000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000', - 'hex') + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000030303037353520003030303030302000303030303030200030303030' + + '3030313030303020313330363133303232343120303132303236200035000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461720030300000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000003030303030302000303030303030200000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000', + 'hex', + ) const h = new Header(b) t.equal(h.type, 'Directory') t.equal(h.size, 0) @@ -558,13 +604,18 @@ t.test('dir with long body', t => { }) t.test('null block, global extended header', t => { - const h = new Header(Buffer.alloc(512), 0, { - undef: undefined, - blerg: 'bloo', - }, { - path: '/global.path', - foo: 'global foo', - }) + const h = new Header( + Buffer.alloc(512), + 0, + { + undef: undefined, + blerg: 'bloo', + }, + { + path: '/global.path', + foo: 'global foo', + }, + ) t.match(h, { cksumValid: false, needPax: false, @@ -593,22 +644,26 @@ t.test('null block, global extended header', t => { t.test('gnutar-generated 10gb file size', t => { const b = Buffer.from( '313067622e696d67000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000030303030363634003030303137353000303030313735300080000000' + - '0000000280000000313334373434303132303500303131313437002030000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0075737461722020006973616163730000000000000000000000000000000000' + - '0000000000000000006973616163730000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000', 'hex') + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000030303030363634003030303137353000303030313735300080000000' + + '0000000280000000313334373434303132303500303131313437002030000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0075737461722020006973616163730000000000000000000000000000000000' + + '0000000000000000006973616163730000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000', + 'hex', + ) const h = new Header(b) t.equal(h.size, 1024 * 1024 * 1024 * 10, 'should be 10gb file') + // cannot set type to something invalid + t.throws(() => h.type = 'Z') t.end() }) diff --git a/test/high-level-opt.js b/test/high-level-opt.js deleted file mode 100644 index 7a82ef3f..00000000 --- a/test/high-level-opt.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict' - -const t = require('tap') -const hlo = require('../lib/high-level-opt.js') - -t.same(hlo(), {}) - -t.same(hlo({ - C: 'dir', - f: 'file', - z: 'zip', - P: 'preserve', - U: 'unlink', - 'strip-components': 99, - foo: 'bar', -}), { - cwd: 'dir', - file: 'file', - gzip: 'zip', - preservePaths: 'preserve', - unlink: 'unlink', - strip: 99, - foo: 'bar', -}) - -t.same(hlo({ - C: 'dir', - f: 'file', - z: 'zip', - P: 'preserve', - U: 'unlink', - stripComponents: 99, - foo: 'bar', -}), { - cwd: 'dir', - file: 'file', - gzip: 'zip', - preservePaths: 'preserve', - unlink: 'unlink', - strip: 99, - foo: 'bar', -}) diff --git a/test/index.js b/test/index.js index 548a1dee..147f821f 100644 --- a/test/index.js +++ b/test/index.js @@ -1,5 +1,6 @@ -const t = require('tap') -const tar = require('../') +import t from 'tap' +import * as tar from '../dist/esm/index.js' + t.match(tar, { create: Function, c: Function, @@ -13,7 +14,7 @@ t.match(tar, { x: Function, Pack: Function, Unpack: Function, - Parse: Function, + Parser: Function, ReadEntry: Function, WriteEntry: Function, Header: Function, @@ -67,7 +68,7 @@ t.match(tar, { ]), }, }) -t.match(tar.Pack.Sync, Function) -t.match(tar.WriteEntry.Sync, Function) -t.match(tar.WriteEntry.Tar, Function) +t.match(tar.PackSync, Function) +t.match(tar.WriteEntrySync, Function) +t.match(tar.WriteEntryTar, Function) t.match(tar.Pax.parse, Function) diff --git a/test/large-numbers.js b/test/large-numbers.js index 055493e9..f2b80467 100644 --- a/test/large-numbers.js +++ b/test/large-numbers.js @@ -1,8 +1,5 @@ -'use strict' -const large = require('../lib/large-numbers.js') -const encode = large.encode -const parse = large.parse -const t = require('tap') +import t from 'tap' +import { encode, parse } from '../dist/esm/large-numbers.js' t.test('parse', t => { const cases = new Map([ diff --git a/test/list.js b/test/list.js index 26f59d9f..1533dc6d 100644 --- a/test/list.js +++ b/test/list.js @@ -1,15 +1,22 @@ -'use strict' -const t = require('tap') -const list = require('../lib/list.js') -const path = require('path') -const fs = require('fs') -const mutateFS = require('mutate-fs') +import fs, { readFileSync } from 'fs' +import mutateFS from 'mutate-fs' +import { dirname, resolve } from 'path' +import t from 'tap' +import { fileURLToPath } from 'url' +import { list } from '../dist/esm/list.js' + +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) + +const lp = JSON.parse( + readFileSync(__dirname + '/fixtures/parse/long-paths.json', 'utf8'), +) t.test('basic', t => { - const file = path.resolve(__dirname, 'fixtures/tars/long-paths.tar') - const expect = require('./fixtures/parse/long-paths.json').filter( - e => Array.isArray(e) && e[0] === 'entry' - ).map(e => e[1].path) + const file = resolve(__dirname, 'fixtures/tars/long-paths.tar') + const expect = lp + .filter(e => Array.isArray(e) && e[0] === 'entry') + .map(e => e[1].path) const check = (actual, t) => { t.same(actual, expect) @@ -30,30 +37,33 @@ t.test('basic', t => { return check(actual, t) }) - t.test('async promise', t => { + t.test('async promise', async t => { const actual = [] const onentry = entry => actual.push(entry.path) - return list({ - file: file, - onentry: onentry, - maxReadSize: maxReadSize, - }).then(_ => check(actual, t)) + return await list({ + file, + onentry, + maxReadSize, + }).then(() => check(actual, t)) }) t.test('async cb', t => { const actual = [] const onentry = entry => actual.push(entry.path) - list({ - file: file, - onentry: onentry, - maxReadSize: maxReadSize, - }, er => { - if (er) { - throw er - } - check(actual, t) - t.end() - }) + list( + { + file: file, + onentry: onentry, + maxReadSize: maxReadSize, + }, + er => { + if (er) { + throw er + } + check(actual, t) + t.end() + }, + ) }) t.end() }) @@ -79,7 +89,7 @@ t.test('basic', t => { t.end() }) - t.test('no onentry function', t => list({ file: file })) + t.test('no onentry function', () => list({ file: file })) t.test('limit to specific files', t => { const fileList = [ @@ -98,35 +108,43 @@ t.test('basic', t => { 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', ] - t.test('no filter function', t => { + t.test('no filter function', async t => { const check = _ => t.same(actual, expect) const actual = [] - return list({ - file: file, - onentry: entry => actual.push(entry.path), - }, fileList).then(check) + return list( + { + file: file, + onentry: entry => actual.push(entry.path), + }, + fileList, + ).then(check) }) t.test('no filter function, stream', t => { const check = _ => t.same(actual, expect) const actual = [] const onentry = entry => actual.push(entry.path) - fs.createReadStream(file).pipe(list(fileList) - .on('entry', onentry) - .on('end', _ => { - check() - t.end() - })) + fs.createReadStream(file).pipe( + list(fileList) + .on('entry', onentry) + .on('end', _ => { + check() + t.end() + }), + ) }) - t.test('filter function', t => { + t.test('filter function', async t => { const check = _ => t.same(actual, expect.slice(0, 1)) const actual = [] - return list({ - file: file, - filter: path => path === expect[0], - onentry: entry => actual.push(entry.path), - }, fileList).then(check) + return list( + { + file: file, + filter: path => path === expect[0], + onentry: entry => actual.push(entry.path), + }, + fileList, + ).then(check) }) return t.test('list is unmunged', t => { @@ -142,10 +160,14 @@ t.test('basic', t => { }) t.test('bad args', t => { - t.throws(_ => list({ file: __filename, sync: true }, _ => _), - new TypeError('callback not supported for sync tar functions')) - t.throws(_ => list(_ => _), - new TypeError('callback only supported with file option')) + t.throws( + _ => list({ file: __filename, sync: true }, _ => _), + new TypeError('callback not supported for sync tar functions'), + ) + t.throws( + _ => list(_ => _), + new TypeError('callback only supported with file option'), + ) t.end() }) @@ -172,11 +194,15 @@ t.test('read fail', t => { const poop = new Error('poop') t.teardown(mutateFS.fail('read', poop)) t.plan(1) - t.throws(_ => list({ - file: __filename, - sync: true, - maxReadSize: 10, - }), poop) + t.throws( + _ => + list({ + file: __filename, + sync: true, + maxReadSize: 10, + }), + poop, + ) }) t.test('cb', t => { const poop = new Error('poop') @@ -194,7 +220,7 @@ t.test('read fail', t => { }) t.test('noResume option', t => { - const file = path.resolve(__dirname, 'fixtures/tars/file.tar') + const file = resolve(__dirname, 'fixtures/tars/file.tar') t.test('sync', t => { let e list({ @@ -214,16 +240,18 @@ t.test('noResume option', t => { e.on('end', _ => t.end()) }) - t.test('async', t => list({ - file: file, - onentry: entry => { - process.nextTick(_ => { - t.notOk(entry.flowing) - entry.resume() - }) - }, - noResume: true, - })) + t.test('async', t => + list({ + file: file, + onentry: entry => { + process.nextTick(_ => { + t.notOk(entry.flowing) + entry.resume() + }) + }, + noResume: true, + }), + ) t.end() }) diff --git a/test/load-all.js b/test/load-all.js index 524a3f4e..111a5fb6 100644 --- a/test/load-all.js +++ b/test/load-all.js @@ -1,10 +1,16 @@ -'use strict' // just load all the files so we can't cheat coverage by avoiding something -require('../') -const fs = require('fs') -const path = require('path') -const lib = path.resolve(__dirname, '../lib') -fs.readdirSync(lib) - .filter(f => /\.js$/.test(f)) - .forEach(f => require('../lib/' + f)) -require('tap').pass('all lib files loaded') +import fs from 'fs' +import t from 'tap' +import path, { dirname } from 'path' +import { fileURLToPath } from 'url' +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) +const lib = path.resolve(__dirname, '../dist/esm') +await Promise.all( + fs + .readdirSync(lib) + .filter(f => /\.js$/.test(f)) + .map(f => import('../dist/esm/' + f)), +) + +t.pass('all lib files loaded') diff --git a/test/make-tar.js b/test/make-tar.js deleted file mode 100644 index 668d2164..00000000 --- a/test/make-tar.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' -// a little utility to create virtual tar data -if (module === require.main) { - return require('tap').pass('this is fine') -} - -const Header = require('../lib/header.js') -module.exports = chunks => { - let dataLen = 0 - return Buffer.concat(chunks.map(chunk => { - if (Buffer.isBuffer(chunk)) { - dataLen += chunk.length - return chunk - } - const size = Math.max(typeof chunk === 'string' - ? 512 * Math.ceil(chunk.length / 512) - : 512) - dataLen += size - const buf = Buffer.alloc(size) - if (typeof chunk === 'string') { - buf.write(chunk) - } else { - new Header(chunk).encode(buf, 0) - } - return buf - }), dataLen) -} diff --git a/test/map.js b/test/map.js index fcd4e47f..33d3251b 100644 --- a/test/map.js +++ b/test/map.js @@ -1,7 +1,9 @@ -const t = require('tap') -const map = require('../map.js') -t.equal(map('test/index.js'), 'index.js') -t.same(map('test/unpack.js'), ['lib/unpack.js', 'lib/mkdir.js']) +import t from 'tap' +import map from '../map.js' +import { fileURLToPath } from 'url' +const __filename = fileURLToPath(import.meta.url) +t.equal(map('test/index.js'), 'src/index.ts') +t.same(map('test/unpack.js'), ['src/unpack.ts', 'src/mkdir.ts']) t.same(map('test/load-all.js'), []) t.equal(map(__filename), 'map.js') -t.equal(map('test/asdf'), 'lib/asdf') +t.equal(map('test/asdf'), 'src/asdf') diff --git a/test/mode-fix.js b/test/mode-fix.js index 779124b1..6c5b54a6 100644 --- a/test/mode-fix.js +++ b/test/mode-fix.js @@ -1,16 +1,15 @@ -'use strict' -const t = require('tap') -const mf = require('../lib/mode-fix.js') +import t from 'tap' +import { modeFix } from '../dist/esm/mode-fix.js' -t.equal(mf(0o10644, false), 0o644) -t.equal(mf(0o10644, true), 0o755) -t.equal(mf(0o10604, true), 0o705) -t.equal(mf(0o10600, true), 0o700) -t.equal(mf(0o10066, true), 0o077) +t.equal(modeFix(0o10644, false), 0o644) +t.equal(modeFix(0o10644, true), 0o755) +t.equal(modeFix(0o10604, true), 0o705) +t.equal(modeFix(0o10600, true), 0o700) +t.equal(modeFix(0o10066, true), 0o077) -t.equal(mf(0o10664, false, true), 0o644) -t.equal(mf(0o10066, false, true), 0o644) -t.equal(mf(0o10666, true, true), 0o755) -t.equal(mf(0o10604, true, true), 0o705) -t.equal(mf(0o10600, true, true), 0o700) -t.equal(mf(0o10066, true, true), 0o755) +t.equal(modeFix(0o10664, false, true), 0o644) +t.equal(modeFix(0o10066, false, true), 0o644) +t.equal(modeFix(0o10666, true, true), 0o755) +t.equal(modeFix(0o10604, true, true), 0o705) +t.equal(modeFix(0o10600, true, true), 0o700) +t.equal(modeFix(0o10066, true, true), 0o755) diff --git a/test/normalize-unicode.js b/test/normalize-unicode.js index 0d34f38c..969ee6ca 100644 --- a/test/normalize-unicode.js +++ b/test/normalize-unicode.js @@ -1,18 +1,32 @@ +import t from 'tap' + process.env.TESTING_TAR_FAKE_PLATFORM = 'win32' -const t = require('tap') -const normalize = require('../lib/normalize-unicode.js') -const stripSlash = require('../lib/strip-trailing-slashes.js') -const normPath = require('../lib/normalize-windows-path.js') + +const [ + { normalizeUnicode }, + { stripTrailingSlashes }, + { normalizeWindowsPath }, +] = await Promise.all([ + import('../dist/esm/normalize-unicode.js'), + import('../dist/esm/strip-trailing-slashes.js'), + import('../dist/esm/normalize-windows-path.js'), +]) // café const cafe1 = Buffer.from([0x63, 0x61, 0x66, 0xc3, 0xa9]).toString() // cafe with a ` -const cafe2 = Buffer.from([0x63, 0x61, 0x66, 0x65, 0xcc, 0x81]).toString() +const cafe2 = Buffer.from([ + 0x63, 0x61, 0x66, 0x65, 0xcc, 0x81, +]).toString() -t.equal(normalize(cafe1), normalize(cafe2), 'matching unicodes') -t.equal(normalize(cafe1), normalize(cafe2), 'cached') -t.equal(normalize('foo'), 'foo', 'non-unicode string') +t.equal( + normalizeUnicode(cafe1), + normalizeUnicode(cafe2), + 'matching unicodes', +) +t.equal(normalizeUnicode(cafe1), normalizeUnicode(cafe2), 'cached') +t.equal(normalizeUnicode('foo'), 'foo', 'non-unicode string') t.test('normalize with strip slashes', t => { const paths = [ @@ -28,8 +42,12 @@ t.test('normalize with strip slashes', t => { for (const path of paths) { t.test(JSON.stringify(path), t => { - const a = normalize(stripSlash(normPath(path))) - const b = stripSlash(normPath(normalize(path))) + const a = normalizeUnicode( + stripTrailingSlashes(normalizeWindowsPath(path)), + ) + const b = stripTrailingSlashes( + normalizeWindowsPath(normalizeUnicode(path)), + ) t.matchSnapshot(a, 'normalized') t.equal(a, b, 'order should not matter') t.end() diff --git a/test/normalize-windows-path.js b/test/normalize-windows-path.js index e9c705ab..8fbaa647 100644 --- a/test/normalize-windows-path.js +++ b/test/normalize-windows-path.js @@ -1,28 +1,38 @@ -const t = require('tap') +import t from 'tap' const realPlatform = process.platform const fakePlatform = realPlatform === 'win32' ? 'posix' : 'win32' -t.test('posix', t => { +t.test('posix', async t => { if (realPlatform === 'win32') { process.env.TESTING_TAR_FAKE_PLATFORM = fakePlatform } else { delete process.env.TESTING_TAR_FAKE_PLATFORM } - const normPath = t.mock('../lib/normalize-windows-path.js') - t.equal(normPath('/some/path/back\\slashes'), '/some/path/back\\slashes') - t.equal(normPath('c:\\foo\\bar'), 'c:\\foo\\bar') + const { normalizeWindowsPath } = await t.mockImport( + '../dist/esm/normalize-windows-path.js', + ) + t.equal( + normalizeWindowsPath('/some/path/back\\slashes'), + '/some/path/back\\slashes', + ) + t.equal(normalizeWindowsPath('c:\\foo\\bar'), 'c:\\foo\\bar') t.end() }) -t.test('win32', t => { +t.test('win32', async t => { if (realPlatform !== 'win32') { process.env.TESTING_TAR_FAKE_PLATFORM = fakePlatform } else { delete process.env.TESTING_TAR_FAKE_PLATFORM } - const normPath = t.mock('../lib/normalize-windows-path.js') - t.equal(normPath('/some/path/back\\slashes'), '/some/path/back/slashes') - t.equal(normPath('c:\\foo\\bar'), 'c:/foo/bar') + const { normalizeWindowsPath } = await t.mockImport( + '../dist/esm/normalize-windows-path.js', + ) + t.equal( + normalizeWindowsPath('/some/path/back\\slashes'), + '/some/path/back/slashes', + ) + t.equal(normalizeWindowsPath('c:\\foo\\bar'), 'c:/foo/bar') t.end() }) diff --git a/test/options.js b/test/options.js new file mode 100644 index 00000000..5e10df5b --- /dev/null +++ b/test/options.js @@ -0,0 +1,65 @@ +import t from 'tap' +import { + dealias, + isSync, + isSyncFile, + isFile, +} from '../dist/esm/options.js' + +t.same(dealias(), {}) +t.same(dealias(false), {}) + +t.same( + dealias({ + C: 'dir', + f: 'file', + z: 'zip', + P: 'preserve', + U: 'unlink', + 'strip-components': 99, + foo: 'bar', + }), + { + cwd: 'dir', + file: 'file', + gzip: 'zip', + preservePaths: 'preserve', + unlink: 'unlink', + strip: 99, + foo: 'bar', + }, +) + +t.same( + dealias({ + C: 'dir', + f: 'file', + z: 'zip', + P: 'preserve', + U: 'unlink', + stripComponents: 99, + foo: 'bar', + }), + { + cwd: 'dir', + file: 'file', + gzip: 'zip', + preservePaths: 'preserve', + unlink: 'unlink', + strip: 99, + foo: 'bar', + }, +) + +t.equal(isSyncFile(dealias({ sync: true, f: 'x' })), true) +t.equal(isSyncFile(dealias({ file: 'x' })), false) +t.equal(isSyncFile(dealias({ sync: true })), false) +t.equal(isSyncFile(dealias({})), false) +t.equal(isSync(dealias({ sync: true, f: 'x' })), true) +t.equal(isSync(dealias({ file: 'x' })), false) +t.equal(isSync(dealias({ sync: true })), true) +t.equal(isSync(dealias({})), false) +t.equal(isFile(dealias({ sync: true, f: 'x' })), true) +t.equal(isFile(dealias({ file: 'x' })), true) +t.equal(isFile(dealias({ sync: true })), false) +t.equal(isFile(dealias({})), false) diff --git a/test/pack.js b/test/pack.js index a4f8bfbe..dae2fba9 100644 --- a/test/pack.js +++ b/test/pack.js @@ -1,37 +1,45 @@ -'use strict' -const t = require('tap') -const Pack = require('../lib/pack.js') -const PackSync = Pack.Sync -const fs = require('fs') -const path = require('path') +import t from 'tap' +import { Pack, PackSync } from '../dist/esm/pack.js' +import fs from 'fs' +import path from 'path' +import { fileURLToPath } from 'url' + +import { Header } from '../dist/esm/header.js' +import zlib from 'zlib' +import * as miniz from 'minizlib' +import mutateFS from 'mutate-fs' +import { Minipass } from 'minipass' +import EE from 'events' +import { rimraf } from 'rimraf' +import { mkdirp } from 'mkdirp' +import { ReadEntry } from '../dist/esm/read-entry.js' +import { normalizeWindowsPath as normPath } from '../dist/esm/normalize-windows-path.js' + +const { default: chmodr } = await import('chmodr') + +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) + const fixtures = path.resolve(__dirname, 'fixtures') const files = path.resolve(fixtures, 'files') const tars = path.resolve(fixtures, 'tars') -const chmodr = require('chmodr') -const Header = require('../lib/header.js') -const zlib = require('zlib') -const miniz = require('minizlib') -const mutateFS = require('mutate-fs') -const { Minipass } = require('minipass') + process.env.USER = 'isaacs' -const EE = require('events').EventEmitter -const rimraf = require('rimraf') -const mkdirp = require('mkdirp') -const ReadEntry = require('../lib/read-entry.js') const isWindows = process.platform === 'win32' -const normPath = require('../lib/normalize-windows-path.js') const ctime = new Date('2017-05-10T01:03:12.000Z') const atime = new Date('2017-04-17T00:00:00.000Z') const mtime = new Date('2016-04-01T19:00:00.000Z') -t.teardown(mutateFS.statMutate((er, st) => { - if (st) { - st.ctime = ctime - st.atime = atime - st.mtime = mtime - } -})) +t.teardown( + mutateFS.statMutate((_er, st) => { + if (st) { + st.ctime = ctime + st.atime = atime + st.mtime = mtime + } + }), +) t.test('set up', t => { const one = fs.statSync(files + '/hardlink-1') @@ -54,7 +62,7 @@ t.test('pack a file', t => { .on('end', _ => { const data = Buffer.concat(out) t.equal(data.length, 2048) - t.match(data.slice(512).toString(), /^a\0{511}\0{1024}$/) + t.match(data.subarray(512).toString(), /^a\0{511}\0{1024}$/) const h = new Header(data) const expect = { cksumValid: true, @@ -84,7 +92,7 @@ t.test('pack a file', t => { throw new Error('no data!') } - t.equal(sync.slice(512).toString(), data.slice(512).toString()) + t.equal(sync.subarray(512).toString(), data.subarray(512).toString()) const hs = new Header(sync) t.match(hs, expect) t.end() @@ -93,13 +101,13 @@ t.test('pack a file', t => { t.test('pack a file with a prefix', t => { const out = [] - new Pack({ cwd: files, prefix: 'package/' }) + new Pack({ mtime, cwd: files, prefix: 'package/' }) .end('.dotfile') .on('data', c => out.push(c)) .on('end', _ => { const data = Buffer.concat(out) t.equal(data.length, 2048) - t.match(data.slice(512).toString(), /^.\n\0{510}\0{1024}$/) + t.match(data.subarray(512).toString(), /^.\n\0{510}\0{1024}$/) const h = new Header(data) const expect = { cksumValid: true, @@ -121,8 +129,10 @@ t.test('pack a file with a prefix', t => { } t.match(h, expect) const sync = new PackSync({ cwd: files, prefix: 'package' }) - .add('.dotfile').end().read() - t.equal(sync.slice(512).toString(), data.slice(512).toString()) + .add('.dotfile') + .end() + .read() + t.equal(sync.subarray(512).toString(), data.subarray(512).toString()) const hs = new Header(sync) t.match(hs, expect) t.end() @@ -163,15 +173,21 @@ t.test('portable pack a dir', t => { } t.match(h, expect) t.equal(data.length, 2048) - t.match(data.slice(1024).toString(), /^\0{1024}$/) + t.match(data.subarray(1024).toString(), /^\0{1024}$/) - const syncgz = new PackSync({ cwd: files, portable: true, gzip: true }) - .add('dir').end().read() + const syncgz = new PackSync({ + cwd: files, + portable: true, + gzip: true, + }) + .add('dir') + .end() + .read() t.equal(syncgz[9], 255, 'gzip OS flag set to "unknown"') const sync = new miniz.Gunzip().end(zipped).read() - t.equal(sync.slice(512).toString(), data.slice(512).toString()) + t.equal(sync.subarray(512).toString(), data.subarray(512).toString()) const hs = new Header(sync) t.match(hs, expect) @@ -193,8 +209,8 @@ t.test('portable pack a dir', t => { ctime: null, nullBlock: false, } - t.match(new Header(data.slice(512)), expect2) - t.match(new Header(sync.slice(512)), expect2) + t.match(new Header(data.subarray(512)), expect2) + t.match(new Header(sync.subarray(512)), expect2) t.end() }) }) @@ -235,11 +251,13 @@ t.test('use process cwd if cwd not specified', t => { } t.match(h, expect) t.equal(data.length, 2048) - t.match(data.slice(1024).toString(), /^\0{1024}$/) + t.match(data.subarray(1024).toString(), /^\0{1024}$/) const sync = new PackSync({ cwd: files }) - .add('dir').end().read() - t.equal(sync.slice(512).toString(), data.slice(512).toString()) + .add('dir') + .end() + .read() + t.equal(sync.subarray(512).toString(), data.subarray(512).toString()) const hs = new Header(sync) t.match(hs, expect) @@ -261,15 +279,15 @@ t.test('use process cwd if cwd not specified', t => { ctime: ctime, nullBlock: false, } - t.match(new Header(data.slice(512)), expect2) - t.match(new Header(sync.slice(512)), expect2) + t.match(new Header(data.subarray(512)), expect2) + t.match(new Header(sync.subarray(512)), expect2) t.end() }) }) t.test('filter', t => { const out = [] - const filter = (path, stat) => stat.isDirectory() + const filter = (_path, stat) => stat.isDirectory() // only include directories, so dir/x should not appear new Pack({ cwd: files, filter: filter }) @@ -301,11 +319,13 @@ t.test('filter', t => { } t.match(h, expect) t.equal(data.length, 1536) - t.match(data.slice(512).toString(), /^\0{1024}$/) + t.match(data.subarray(512).toString(), /^\0{1024}$/) const sync = new PackSync({ cwd: files, filter: filter }) - .add('dir').end().read() - t.equal(sync.slice(512).toString(), data.slice(512).toString()) + .add('dir') + .end() + .read() + t.equal(sync.subarray(512).toString(), data.subarray(512).toString()) const hs = new Header(sync) t.match(hs, expect) t.end() @@ -314,7 +334,7 @@ t.test('filter', t => { t.test('add the same dir twice (exercise cache code)', t => { const out = [] - const filter = (path, stat) => stat.isDirectory() + const filter = (_path, stat) => stat.isDirectory() // only include directories, so dir/x should not appear const pack = new Pack({ cwd: files, filter: filter }) @@ -346,10 +366,10 @@ t.test('add the same dir twice (exercise cache code)', t => { nullBlock: false, } t.match(h, expect) - const h2 = new Header(data.slice(512)) + const h2 = new Header(data.subarray(512)) t.match(h2, expect) t.equal(data.length, 2048) - t.match(data.slice(1024).toString(), /^\0{1024}$/) + t.match(data.subarray(1024).toString(), /^\0{1024}$/) const sync = new PackSync({ cwd: files, @@ -358,11 +378,17 @@ t.test('add the same dir twice (exercise cache code)', t => { readdirCache: pack.readdirCache, statCache: pack.statCache, }) - .add('dir').add('dir').end().read() - t.equal(sync.slice(1024).toString(), data.slice(1024).toString()) + .add('dir') + .add('dir') + .end() + .read() + t.equal( + sync.subarray(1024).toString(), + data.subarray(1024).toString(), + ) const hs = new Header(sync) t.match(hs, expect) - const hs2 = new Header(sync.slice(512)) + const hs2 = new Header(sync.subarray(512)) t.match(hs2, expect) t.end() }) @@ -384,7 +410,10 @@ t.test('if brotli is truthy, make it an object', t => { t.test('throws if both gzip and brotli are truthy', t => { const opt = { gzip: true, brotli: true } - t.throws(_ => new Pack(opt), new TypeError('gzip and brotli are mutually exclusive')) + t.throws( + _ => new Pack(opt), + new TypeError('gzip and brotli are mutually exclusive'), + ) t.end() }) @@ -404,14 +433,16 @@ t.test('gzip, also a very deep path', t => { const data = zlib.unzipSync(zipped) const entries = [] for (var i = 0; i < data.length; i += 512) { - const slice = data.slice(i, i + 512) + const slice = data.subarray(i, i + 512) const h = new Header(slice) if (h.nullBlock) { entries.push('null block') } else if (h.cksumValid) { entries.push([h.type, h.path]) } else if (entries[entries.length - 1][0] === 'File') { - entries[entries.length - 1].push(slice.toString().replace(/\0.*$/, '')) + entries[entries.length - 1].push( + slice.toString().replace(/\0.*$/, ''), + ) } } @@ -436,27 +467,72 @@ t.test('gzip, also a very deep path', t => { ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/'], ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/'], ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt', 'short\n'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'], - ['ExtendedHeader', 'PaxHeader/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', '2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222'], - ['ExtendedHeader', 'PaxHeader/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccc'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccccccccccccc', 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt', + 'short\n', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111', + ], + [ + 'ExtendedHeader', + 'PaxHeader/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222', + ], + [ + 'ExtendedHeader', + 'PaxHeader/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccc', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccccccccccccc', + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ], ['ExtendedHeader', 'PaxHeader/Ω.txt'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', 'Ω'], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', + 'Ω', + ], 'null block', 'null block', ] let ok = true entries.forEach((entry, i) => { - ok = ok && + ok = + ok && t.equal(entry[0], expect[i][0]) && t.equal(entry[1], expect[i][1]) && (!entry[2] || t.equal(entry[2], expect[i][2])) @@ -483,14 +559,16 @@ t.test('brotli, also a very deep path', t => { const data = zlib.brotliDecompressSync(zipped) const entries = [] for (var i = 0; i < data.length; i += 512) { - const slice = data.slice(i, i + 512) + const slice = data.subarray(i, i + 512) const h = new Header(slice) if (h.nullBlock) { entries.push('null block') } else if (h.cksumValid) { entries.push([h.type, h.path]) } else if (entries[entries.length - 1][0] === 'File') { - entries[entries.length - 1].push(slice.toString().replace(/\0.*$/, '')) + entries[entries.length - 1].push( + slice.toString().replace(/\0.*$/, ''), + ) } } @@ -515,30 +593,75 @@ t.test('brotli, also a very deep path', t => { ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/'], ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/'], ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt', 'short\n'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'], - ['ExtendedHeader', 'PaxHeader/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', '2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222'], - ['ExtendedHeader', 'PaxHeader/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccc'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccccccccccccc', 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt', + 'short\n', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111', + ], + [ + 'ExtendedHeader', + 'PaxHeader/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222', + ], + [ + 'ExtendedHeader', + 'PaxHeader/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccc', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccccccccccccc', + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ], ['ExtendedHeader', 'PaxHeader/Ω.txt'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', 'Ω'], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', + 'Ω', + ], 'null block', 'null block', ] let ok = true entries.forEach((entry, i) => { - ok = ok && - t.equal(entry[0], expect[i][0]) && - t.equal(entry[1], expect[i][1]) && - (!entry[2] || t.equal(entry[2], expect[i][2])) + ok = + ok && + t.equal(entry[0], expect[i][0]) && + t.equal(entry[1], expect[i][1]) && + (!entry[2] || t.equal(entry[2], expect[i][2])) }) t.end() @@ -549,7 +672,8 @@ t.test('very deep gzip path, sync', t => { const pack = new PackSync({ cwd: files, gzip: true, - }).add('dir') + }) + .add('dir') .add('long-path') .end() @@ -562,14 +686,16 @@ t.test('very deep gzip path, sync', t => { const data = zlib.unzipSync(zipped) const entries = [] for (var i = 0; i < data.length; i += 512) { - const slice = data.slice(i, i + 512) + const slice = data.subarray(i, i + 512) const h = new Header(slice) if (h.nullBlock) { entries.push('null block') } else if (h.cksumValid) { entries.push([h.type, h.path]) } else if (entries[entries.length - 1][0] === 'File') { - entries[entries.length - 1].push(slice.toString().replace(/\0.*$/, '')) + entries[entries.length - 1].push( + slice.toString().replace(/\0.*$/, ''), + ) } } @@ -596,25 +722,64 @@ t.test('very deep gzip path, sync', t => { ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/'], ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/'], ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt', 'short\n'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'], - ['ExtendedHeader', 'PaxHeader/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', '2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222'], - ['ExtendedHeader', 'PaxHeader/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccc'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccccccccccccc', 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt', + 'short\n', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111', + ], + [ + 'ExtendedHeader', + 'PaxHeader/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222', + ], + [ + 'ExtendedHeader', + 'PaxHeader/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccc', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccccccccccccc', + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ], ['ExtendedHeader', 'PaxHeader/Ω.txt'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', 'Ω'], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', + 'Ω', + ], 'null block', 'null block', ] let ok = true entries.forEach((entry, i) => { - ok = ok && + ok = + ok && t.equal(entry[0], expect[i][0]) && t.equal(entry[1], expect[i][1]) && (!entry[2] || t.equal(entry[2], expect[i][2])) @@ -628,7 +793,8 @@ t.test('very deep brotli path, sync', t => { const pack = new PackSync({ cwd: files, brotli: true, - }).add('dir') + }) + .add('dir') .add('long-path') .end() @@ -641,14 +807,16 @@ t.test('very deep brotli path, sync', t => { const data = zlib.brotliDecompressSync(zipped) const entries = [] for (var i = 0; i < data.length; i += 512) { - const slice = data.slice(i, i + 512) + const slice = data.subarray(i, i + 512) const h = new Header(slice) if (h.nullBlock) { entries.push('null block') } else if (h.cksumValid) { entries.push([h.type, h.path]) } else if (entries[entries.length - 1][0] === 'File') { - entries[entries.length - 1].push(slice.toString().replace(/\0.*$/, '')) + entries[entries.length - 1].push( + slice.toString().replace(/\0.*$/, ''), + ) } } @@ -675,28 +843,67 @@ t.test('very deep brotli path, sync', t => { ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/'], ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/'], ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/'], - ['Directory', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt', 'short\n'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'], - ['ExtendedHeader', 'PaxHeader/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', '2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222'], - ['ExtendedHeader', 'PaxHeader/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccc'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccccccccccccc', 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/', + ], + [ + 'Directory', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt', + 'short\n', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111', + ], + [ + 'ExtendedHeader', + 'PaxHeader/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222', + ], + [ + 'ExtendedHeader', + 'PaxHeader/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccc', + ], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccccccccccccc', + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ], ['ExtendedHeader', 'PaxHeader/Ω.txt'], - ['File', 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', 'Ω'], + [ + 'File', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt', + 'Ω', + ], 'null block', 'null block', ] let ok = true entries.forEach((entry, i) => { - ok = ok && + ok = + ok && t.equal(entry[0], expect[i][0]) && - t.equal(entry[1], expect[i][1]) && - (!entry[2] || t.equal(entry[2], expect[i][2])) + t.equal(entry[1], expect[i][1]) && + (!entry[2] || t.equal(entry[2], expect[i][2])) }) t.end() @@ -711,8 +918,10 @@ t.test('write after end', t => { t.test('emit error when stat fail', t => { t.teardown(mutateFS.statFail(new Error('xyz'))) - t.throws(_ => new PackSync({ cwd: files }).add('one-byte.txt'), - new Error('xyz')) + t.throws( + _ => new PackSync({ cwd: files }).add('one-byte.txt'), + new Error('xyz'), + ) new Pack({ cwd: files }).add('one-byte.txt').on('error', e => { t.match(e, { message: 'xyz' }) @@ -722,7 +931,10 @@ t.test('emit error when stat fail', t => { t.test('readdir fail', t => { t.teardown(mutateFS.fail('readdir', new Error('xyz'))) - t.throws(_ => new PackSync({ cwd: files }).add('dir'), new Error('xyz')) + t.throws( + _ => new PackSync({ cwd: files }).add('dir'), + new Error('xyz'), + ) new Pack({ cwd: files }).add('dir').on('error', e => { t.match(e, { message: 'xyz' }) @@ -764,7 +976,7 @@ t.test('pipe into a slow reader', t => { } t.match(h, expect) t.equal(data.length, 21504) - t.match(data.slice(data.length - 1024).toString(), /^\0{1024}$/) + t.match(data.subarray(data.length - 1024).toString(), /^\0{1024}$/) t.end() }) }) @@ -772,11 +984,13 @@ t.test('pipe into a slow reader', t => { t.test('pipe into a slow gzip reader', t => { const out = [] const mp2 = new miniz.Unzip() - const p = new Pack({ cwd: files, gzip: true }).add('long-path').end() + const p = new Pack({ cwd: files, gzip: true }) + .add('long-path') + .end() p.pause() class SlowStream extends EE { - write (chunk) { + write(chunk) { mp2.write(chunk) setTimeout(_ => { this.emit('drain') @@ -785,7 +999,7 @@ t.test('pipe into a slow gzip reader', t => { return false } - end (chunk) { + end(chunk) { return mp2.end(chunk) } } @@ -823,7 +1037,7 @@ t.test('pipe into a slow gzip reader', t => { } t.match(h, expect) t.equal(data.length, 21504) - t.match(data.slice(data.length - 1024).toString(), /^\0{1024}$/) + t.match(data.subarray(data.length - 1024).toString(), /^\0{1024}$/) t.end() }) }) @@ -835,12 +1049,12 @@ t.test('ignores mid-queue', t => { let didFirst = false const p = new Pack({ cwd: tars, - filter: (p, st) => { + filter: (p, _st) => { if (p === './') { return true } if (!didFirst) { - return didFirst = true + return (didFirst = true) } return false }, @@ -852,8 +1066,8 @@ t.test('ignores mid-queue', t => { p.on('data', c => out.push(c)) p.on('end', _ => { const data = Buffer.concat(out) - t.equal(data.slice(0, 100).toString().replace(/\0.*$/, ''), './') - const file = data.slice(512, 612).toString().replace(/\0.*$/, '') + t.equal(data.subarray(0, 100).toString().replace(/\0.*$/, ''), './') + const file = data.subarray(512, 612).toString().replace(/\0.*$/, '') t.not(files.indexOf(file), -1) t.end() }) @@ -869,17 +1083,21 @@ t.test('warnings', t => { const p = new Pack({ cwd: files, onwarn: (c, m, p) => warnings.push([c, m, p]), - }).end(f).on('data', c => out.push(c)) + }) + .end(f) + .on('data', c => out.push(c)) const out = [] p.on('end', _ => { const data = Buffer.concat(out) t.equal(data.length, 2048) - t.match(warnings, [[ - 'TAR_ENTRY_INFO', - /stripping .* from absolute path/, - { path: normPath(f) }, - ]]) + t.match(warnings, [ + [ + 'TAR_ENTRY_INFO', + /stripping .* from absolute path/, + { path: normPath(f) }, + ], + ]) t.match(new Header(data), { path: normPath(f).replace(/^(\/|[a-z]:\/)/i, ''), @@ -900,7 +1118,9 @@ t.test('warnings', t => { strict: strict, preservePaths: true, onwarn: (c, m, p) => warnings.push([c, m, p]), - }).end(f).on('data', c => out.push(c)) + }) + .end(f) + .on('data', c => out.push(c)) p.on('end', _ => { const data = Buffer.concat(out) t.equal(warnings.length, 0) @@ -918,13 +1138,15 @@ t.test('warnings', t => { new Pack({ strict: true, cwd: files, - }).end(f).on('error', e => { - t.match(e, { - message: /stripping .* from absolute path/, - path: normPath(f), - }) - t.end() }) + .end(f) + .on('error', e => { + t.match(e, { + message: /stripping .* from absolute path/, + path: normPath(f), + }) + t.end() + }) }) t.end() @@ -963,7 +1185,7 @@ t.test('no dir recurse', t => { }) t.test('sync', t => { - const p = new Pack.Sync({ + const p = new PackSync({ cwd: dir, noDirRecurse: true, }) @@ -975,48 +1197,57 @@ t.test('no dir recurse', t => { t.end() }) -t.test('follow', { skip: isWindows && 'file symlinks not available' }, t => { - const check = (out, t) => { - const data = Buffer.concat(out) - t.equal(data.length, 2048) - t.match(new Header(data, 0), { - type: 'File', - cksumValid: true, - needPax: false, - path: 'symlink', - mode: isWindows ? 0o666 : 0o644, - size: 26, - }) - t.match(data.slice(512).toString(), /this link is like diamond\n\0+$/) - t.end() - } +t.test( + 'follow', + { skip: isWindows && 'file symlinks not available' }, + t => { + const check = (out, t) => { + const data = Buffer.concat(out) + t.equal(data.length, 2048) + t.match(new Header(data, 0), { + type: 'File', + cksumValid: true, + needPax: false, + path: 'symlink', + mode: isWindows ? 0o666 : 0o644, + size: 26, + }) + t.match( + data.subarray(512).toString(), + /this link is like diamond\n\0+$/, + ) + t.end() + } - t.test('async', t => { - const out = [] - const p = new Pack({ cwd: files, follow: true }) - p.on('data', c => out.push(c)) - p.on('end', _ => check(out, t)) - p.end('symlink') - }) + t.test('async', t => { + const out = [] + const p = new Pack({ cwd: files, follow: true }) + p.on('data', c => out.push(c)) + p.on('end', _ => check(out, t)) + p.end('symlink') + }) - t.test('sync', t => { - const out = [] - const p = new Pack.Sync({ cwd: files, follow: true }) - p.on('data', c => out.push(c)) - p.end('symlink') - check(out, t) - }) + t.test('sync', t => { + const out = [] + const p = new PackSync({ cwd: files, follow: true }) + p.on('data', c => out.push(c)) + p.end('symlink') + check(out, t) + }) - t.end() -}) + t.end() + }, +) t.test('pack ReadEntries', t => { t.test('basic', t => { - const readEntry = new ReadEntry(new Header({ - path: 'x', - type: 'File', - size: 1, - })) + const readEntry = new ReadEntry( + new Header({ + path: 'x', + type: 'File', + size: 1, + }), + ) const p = new Pack() p.end(readEntry) const out = [] @@ -1024,9 +1255,9 @@ t.test('pack ReadEntries', t => { p.on('end', _ => { const data = Buffer.concat(out) t.equal(data.length, 2048) - t.match(data.slice(1024).toString(), /^\0+$/) - t.equal(data.slice(0, 100).toString().replace(/\0.*$/, ''), 'x') - t.equal(data.slice(512, 514).toString(), 'x\0') + t.match(data.subarray(1024).toString(), /^\0+$/) + t.equal(data.subarray(0, 100).toString().replace(/\0.*$/, ''), 'x') + t.equal(data.subarray(512, 514).toString(), 'x\0') t.end() }) const buf = Buffer.alloc(512) @@ -1035,11 +1266,13 @@ t.test('pack ReadEntries', t => { }) t.test('prefix', t => { - const readEntry = new ReadEntry(new Header({ - path: 'x', - type: 'File', - size: 1, - })) + const readEntry = new ReadEntry( + new Header({ + path: 'x', + type: 'File', + size: 1, + }), + ) const p = new Pack({ prefix: 'y' }) p.end(readEntry) const out = [] @@ -1047,9 +1280,12 @@ t.test('pack ReadEntries', t => { p.on('end', _ => { const data = Buffer.concat(out) t.equal(data.length, 2048) - t.match(data.slice(1024).toString(), /^\0+$/) - t.equal(data.slice(0, 100).toString().replace(/\0.*$/, ''), 'y/x') - t.equal(data.slice(512, 514).toString(), 'x\0') + t.match(data.subarray(1024).toString(), /^\0+$/) + t.equal( + data.subarray(0, 100).toString().replace(/\0.*$/, ''), + 'y/x', + ) + t.equal(data.subarray(512, 514).toString(), 'x\0') t.end() }) const buf = Buffer.alloc(512) @@ -1058,21 +1294,27 @@ t.test('pack ReadEntries', t => { }) t.test('filter out', t => { - const re1 = new ReadEntry(new Header({ - path: 'a', - type: 'File', - size: 1, - })) - const re2 = new ReadEntry(new Header({ - path: 'x', - type: 'File', - size: 1, - })) - const re3 = new ReadEntry(new Header({ - path: 'y', - type: 'File', - size: 1, - })) + const re1 = new ReadEntry( + new Header({ + path: 'a', + type: 'File', + size: 1, + }), + ) + const re2 = new ReadEntry( + new Header({ + path: 'x', + type: 'File', + size: 1, + }), + ) + const re3 = new ReadEntry( + new Header({ + path: 'y', + type: 'File', + size: 1, + }), + ) const p = new Pack({ filter: p => p === 'x' }) p.add(re1) p.add(re2) @@ -1082,9 +1324,9 @@ t.test('pack ReadEntries', t => { p.on('end', _ => { const data = Buffer.concat(out) t.equal(data.length, 2048) - t.match(data.slice(1024).toString(), /^\0+$/) - t.equal(data.slice(0, 100).toString().replace(/\0.*$/, ''), 'x') - t.equal(data.slice(512, 514).toString(), 'x\0') + t.match(data.subarray(1024).toString(), /^\0+$/) + t.equal(data.subarray(0, 100).toString().replace(/\0.*$/, ''), 'x') + t.equal(data.subarray(512, 514).toString(), 'x\0') t.end() }) { @@ -1119,7 +1361,7 @@ t.test('filter out everything', t => { t.test('sync', t => { const out = [] - const p = new Pack.Sync({ cwd: files, filter: filter }) + const p = new PackSync({ cwd: files, filter: filter }) p.on('data', c => out.push(c)) p.end('./') check(out, t) @@ -1127,7 +1369,7 @@ t.test('filter out everything', t => { t.test('async', t => { const out = [] - const p = new Pack.Sync({ cwd: files, filter: filter }) + const p = new PackSync({ cwd: files, filter: filter }) p.on('data', c => out.push(c)) p.on('end', _ => check(out, t)) p.end('./') @@ -1149,41 +1391,53 @@ t.test('fs.open fails', t => { t.test('sync', t => { t.plan(1) - t.throws(_ => - new Pack.Sync({ cwd: files }).end('one-byte.txt'), poop) + t.throws( + _ => new PackSync({ cwd: files }).end('one-byte.txt'), + poop, + ) }) t.end() }) -const write = opts => new Promise((resolve, reject) => { - const p = new Pack() - let totalSize = 0 - p.on('data', d => totalSize += d.length) - p.once('error', reject) - p.once('end', () => resolve(totalSize)) - - const file1 = new ReadEntry(new Header({ - path: 'file1.txt', - size: 5, - })) - if (opts.before) { - file1.end('file1') - p.add(file1) - } else { - p.add(file1) - file1.end('file1') - } +const write = opts => + new Promise((resolve, reject) => { + const p = new Pack() + let totalSize = 0 + p.on('data', d => (totalSize += d.length)) + p.once('error', reject) + p.once('end', () => resolve(totalSize)) + + const file1 = new ReadEntry( + new Header({ + path: 'file1.txt', + size: 5, + type: 'File', + }), + ) + if (opts.before) { + file1.end('file1') + p.add(file1) + } else { + p.add(file1) + file1.end('file1') + } - p.end() -}) + p.end() + }) t.test('padding works regardless of arite/add order', t => Promise.all([ write({ before: true }), write({ before: false }), ]).then(res => - t.equal(res[0], res[1], 'length is the same regardless of write/add order'))) + t.equal( + res[0], + res[1], + 'length is the same regardless of write/add order', + ), + ), +) t.test('prefix and subdirs', t => { const dir = path.resolve(fixtures, 'pack-prefix-subdirs') @@ -1214,7 +1468,8 @@ t.test('prefix and subdirs', t => { const check = (out, t) => { const data = Buffer.concat(out) expect.forEach((e, i) => - t.equal(e, data.slice(i * 512, i * 512 + e.length).toString())) + t.equal(e, data.subarray(i * 512, i * 512 + e.length).toString()), + ) t.end() } @@ -1235,8 +1490,8 @@ t.test('prefix and subdirs', t => { }) return t.test('sync', t => { - t.test('.', t => runTest(t, '.', Pack.Sync)) - return t.test('./', t => runTest(t, './', Pack.Sync)) + t.test('.', t => runTest(t, '.', PackSync)) + return t.test('./', t => runTest(t, './', PackSync)) }) }) @@ -1291,9 +1546,9 @@ t.test('prefix and hard links', t => { const data = Buffer.concat(out) expect.forEach((e, i) => { if (typeof e === 'string') { - t.equal(data.slice(i * 512, i * 512 + e.length).toString(), e) + t.equal(data.subarray(i * 512, i * 512 + e.length).toString(), e) } else { - t.match(new Header(data.slice(i * 512, (i + 1) * 512)), e) + t.match(new Header(data.subarray(i * 512, (i + 1) * 512)), e) } }) t.end() @@ -1330,8 +1585,8 @@ t.test('prefix and hard links', t => { }) t.test('sync', t => { - t.test('.', t => runTest(t, '.', Pack.Sync)) - return t.test('./', t => runTest(t, './', Pack.Sync)) + t.test('.', t => runTest(t, '.', PackSync)) + return t.test('./', t => runTest(t, './', PackSync)) }) t.end() diff --git a/test/parse.js b/test/parse.js index 2cc68782..ebee05e6 100644 --- a/test/parse.js +++ b/test/parse.js @@ -1,24 +1,30 @@ -'use strict' -const t = require('tap') -const Parse = require('../lib/parse.js') - -const makeTar = require('./make-tar.js') -const fs = require('fs') -const path = require('path') +import t from 'tap' +import { Parser } from '../dist/esm/parse.js' +import { makeTar } from './fixtures/make-tar.js' +import fs, { readFileSync } from 'fs' +import path, { dirname } from 'path' +import zlib from 'zlib' +import { Minipass } from 'minipass' +import { Header } from '../dist/esm/header.js' +import EE from 'events' +import { fileURLToPath } from 'url' + +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const tardir = path.resolve(__dirname, 'fixtures/tars') -const zlib = require('zlib') -const { Minipass } = require('minipass') -const Header = require('../lib/header.js') -const EE = require('events').EventEmitter t.test('fixture tests', t => { class ByteStream extends Minipass { - write (chunk) { + write(chunk) { for (let i = 0; i < chunk.length - 1; i++) { - super.write(chunk.slice(i, i + 1)) + super.write(chunk.subarray(i, i + 1)) } - return super.write(chunk.slice(chunk.length - 1, chunk.length)) + const ret = super.write(chunk.subarray(chunk.length - 1, chunk.length)) + if (ret === false) { + throw new Error('BS write return false') + } + return ret } } @@ -26,21 +32,28 @@ t.test('fixture tests', t => { let ok = true let cursor = 0 p.on('entry', entry => { - ok = ok && t.match(['entry', entry], expect[cursor++], entry.path) + ok = + ok && t.match(['entry', entry], expect[cursor++], entry.path) if (slow) { - setTimeout(_ => entry.resume()) + setTimeout(() => entry.resume()) } else { entry.resume() } }) p.on('ignoredEntry', entry => { - ok = ok && t.match(['ignoredEntry', entry], expect[cursor++], - 'ignored: ' + entry.path) + ok = + ok && + t.match( + ['ignoredEntry', entry], + expect[cursor++], + 'ignored: ' + entry.path, + ) }) - p.on('warn', (c, message, data) => { - ok = ok && t.match(['warn', c, message], expect[cursor++], 'warn') + p.on('warn', (c, message, _data) => { + ok = + ok && t.match(['warn', c, message], expect[cursor++], 'warn') }) - p.on('nullBlock', _ => { + p.on('nullBlock', () => { ok = ok && t.match(['nullBlock'], expect[cursor++], 'null') }) p.on('error', er => { @@ -49,204 +62,261 @@ t.test('fixture tests', t => { p.on('meta', meta => { ok = ok && t.match(['meta', meta], expect[cursor++], 'meta') }) - p.on('eof', _ => { + p.on('eof', () => { ok = ok && t.match(['eof'], expect[cursor++], 'eof') }) - p.on('end', _ => { + p.on('end', () => { ok = ok && t.match(['end'], expect[cursor++], 'end') t.end() }) } t.jobs = 4 - const path = require('path') const parsedir = path.resolve(__dirname, 'fixtures/parse') const files = fs.readdirSync(tardir) - const maxMetaOpt = [250, null] + const maxMetaOpt = [250, undefined] const filterOpt = [true, false] const strictOpt = [true, false] const runTest = (file, maxMeta, filter, strict) => { const tardata = fs.readFileSync(file) const base = path.basename(file, '.tar') - t.test('file=' + base + '.tar' + - ' maxmeta=' + maxMeta + - ' filter=' + filter + - ' strict=' + strict, t => { - const o = - (maxMeta ? '-meta-' + maxMeta : '') + - (filter ? '-filter' : '') + - (strict ? '-strict' : '') - const tail = (o ? '-' + o : '') + '.json' - const eventsFile = parsedir + '/' + base + tail - const expect = require(eventsFile) - - t.test('uncompressed one byte at a time', t => { - const bs = new ByteStream() - const opt = (maxMeta || filter || strict) ? { - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, - } : null - const bp = new Parse(opt) - trackEvents(t, expect, bp) - bs.pipe(bp) - bs.end(tardata) - }) - - t.test('uncompressed all at once', t => { - const p = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, + t.test( + 'file=' + + base + + '.tar' + + ' maxmeta=' + + maxMeta + + ' filter=' + + filter + + ' strict=' + + strict, + t => { + const o = + (maxMeta ? '-meta-' + maxMeta : '') + + (filter ? '-filter' : '') + + (strict ? '-strict' : '') + const tail = (o ? '-' + o : '') + '.json' + const eventsFile = parsedir + '/' + base + tail + const expect = JSON.parse(readFileSync(eventsFile, 'utf8')) + + t.test('uncompressed one byte at a time', t => { + const bs = new ByteStream() + bs.on('data', c => { + if (!Buffer.isBuffer(c)) throw new Error('wat1') + if (c.length !== 1) throw new Error('wat2') + }) + const opt = + maxMeta || filter || strict + ? { + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + } + : undefined + const p = new Parser(opt) + trackEvents(t, expect, p) + bs.pipe(p) + bs.write(tardata) + bs.end() }) - trackEvents(t, expect, p) - p.end(tardata) - }) - - t.test('uncompressed one byte at a time, filename .tbr', t => { - const bs = new ByteStream() - const opt = (maxMeta || filter || strict) ? { - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, - file: 'example.tbr', - } : null - const bp = new Parse(opt) - trackEvents(t, expect, bp) - bs.pipe(bp) - bs.end(tardata) - }) - - t.test('uncompressed all at once, filename .tar.br', t => { - const p = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, - file: 'example.tar.br', + + t.test('uncompressed all at once', t => { + const p = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + }) + trackEvents(t, expect, p) + p.end(tardata) }) - trackEvents(t, expect, p) - p.end(tardata) - }) - - t.test('gzipped all at once', t => { - const p = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, + + t.test( + 'uncompressed one byte at a time, filename .tbr', + t => { + const bs = new ByteStream() + const opt = + maxMeta || filter || strict + ? { + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + file: 'example.tbr', + } + : undefined + const bp = new Parser(opt) + trackEvents(t, expect, bp) + bs.pipe(bp) + bs.end(tardata) + }, + ) + + t.test('uncompressed all at once, filename .tar.br', t => { + const p = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + file: 'example.tar.br', + }) + trackEvents(t, expect, p) + p.end(tardata) }) - trackEvents(t, expect, p) - p.end(zlib.gzipSync(tardata)) - }) - - t.test('gzipped all at once, filename .tbr', t => { - const p = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, - file: 'example.tbr', + + t.test('gzipped all at once', t => { + const p = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + }) + trackEvents(t, expect, p) + p.end(zlib.gzipSync(tardata)) }) - trackEvents(t, expect, p) - p.end(zlib.gzipSync(tardata)) - }) - - t.test('gzipped byte at a time', t => { - const bs = new ByteStream() - const bp = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, + + t.test('gzipped all at once, filename .tbr', t => { + const p = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + file: 'example.tbr', + }) + trackEvents(t, expect, p) + p.end(zlib.gzipSync(tardata)) }) - trackEvents(t, expect, bp) - bs.pipe(bp) - bs.end(zlib.gzipSync(tardata)) - }) - - t.test('compress with brotli based on filename .tar.br', t => { - const p = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, - file: 'example.tar.br', + + t.test('gzipped byte at a time', t => { + const bs = new ByteStream() + const bp = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + }) + trackEvents(t, expect, bp) + bs.pipe(bp) + bs.end(zlib.gzipSync(tardata)) }) - trackEvents(t, expect, p) - p.end(zlib.brotliCompressSync(tardata)) - }) - - t.test('compress with brotli based on filename .tbr', t => { - const p = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, - file: 'example.tbr', + + t.test( + 'compress with brotli based on filename .tar.br', + t => { + const p = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + file: 'example.tar.br', + }) + trackEvents(t, expect, p) + p.end(zlib.brotliCompressSync(tardata)) + }, + ) + + t.test('compress with brotli based on filename .tbr', t => { + const p = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + file: 'example.tbr', + }) + trackEvents(t, expect, p) + p.end(zlib.brotliCompressSync(tardata)) }) - trackEvents(t, expect, p) - p.end(zlib.brotliCompressSync(tardata)) - }) - - t.test('compress with brotli all at once', t => { - const p = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, - brotli: {}, + + t.test('compress with brotli all at once', t => { + const p = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + brotli: {}, + }) + trackEvents(t, expect, p) + p.end(zlib.brotliCompressSync(tardata)) }) - trackEvents(t, expect, p) - p.end(zlib.brotliCompressSync(tardata)) - }) - - t.test('compress with brotli byte at a time', t => { - const bs = new ByteStream() - const bp = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, - brotli: {}, + + t.test('compress with brotli byte at a time', t => { + const bs = new ByteStream() + const bp = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + brotli: {}, + }) + trackEvents(t, expect, bp) + bs.pipe(bp) + bs.end(zlib.brotliCompressSync(tardata)) }) - trackEvents(t, expect, bp) - bs.pipe(bp) - bs.end(zlib.brotliCompressSync(tardata)) - }) - - t.test('compress with brotli .tbr byte at a time', t => { - const bs = new ByteStream() - const bp = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, - file: 'example.tbr', + + t.test('compress with brotli .tbr byte at a time', t => { + const bs = new ByteStream() + const bp = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + file: 'example.tbr', + }) + trackEvents(t, expect, bp) + bs.pipe(bp) + bs.end(zlib.brotliCompressSync(tardata)) }) - trackEvents(t, expect, bp) - bs.pipe(bp) - bs.end(zlib.brotliCompressSync(tardata)) - }) - - t.test('async chunks', t => { - const p = new Parse({ - maxMetaEntrySize: maxMeta, - filter: filter ? (path, entry) => entry.size % 2 !== 0 : null, - strict: strict, + + t.test('async chunks', t => { + const p = new Parser({ + maxMetaEntrySize: maxMeta, + filter: filter + ? (_path, entry) => entry.size % 2 !== 0 + : undefined, + strict: strict, + }) + trackEvents(t, expect, p, true) + p.write(tardata.subarray(0, Math.floor(tardata.length / 2))) + process.nextTick(() => + p.end(tardata.subarray(Math.floor(tardata.length / 2))), + ) }) - trackEvents(t, expect, p, true) - p.write(tardata.slice(0, Math.floor(tardata.length / 2))) - process.nextTick(_ => p.end(tardata.slice(Math.floor(tardata.length / 2)))) - }) - t.end() - }) + t.end() + }, + ) } files - .map(f => path.resolve(tardir, f)).forEach(file => + .map(f => path.resolve(tardir, f)) + .forEach(file => maxMetaOpt.forEach(maxMeta => strictOpt.forEach(strict => filterOpt.forEach(filter => - runTest(file, maxMeta, filter, strict))))) + runTest(file, maxMeta, filter, strict), + ), + ), + ), + ) t.end() }) t.test('strict warn with an error emits that error', t => { t.plan(1) - const p = new Parse({ + const p = new Parser({ strict: true, }) p.on('error', emitted => t.equal(emitted, er)) @@ -256,8 +326,8 @@ t.test('strict warn with an error emits that error', t => { t.test('onwarn gets added to the warn event', t => { t.plan(1) - const p = new Parse({ - onwarn (code, message) { + const p = new Parser({ + onwarn(_code, message) { t.equal(message, 'this is fine') }, }) @@ -266,7 +336,7 @@ t.test('onwarn gets added to the warn event', t => { t.test('onentry gets added to entry event', t => { t.plan(1) - const p = new Parse({ + const p = new Parser({ onentry: entry => t.equal(entry, 'yes hello this is dog'), }) p.emit('entry', 'yes hello this is dog') @@ -400,36 +470,56 @@ t.test('drain event timings', t => { ].map(chunks => makeTar(chunks)) const expect = [ - 'one', 'two', 'three', - 'four', 'five', 'six', 'seven', 'eight', - 'four', 'five', 'six', 'seven', 'eight', + 'one', + 'two', + 'three', + 'four', + 'five', + 'six', + 'seven', + 'eight', + 'four', + 'five', + 'six', + 'seven', + 'eight', 'nine', - 'one', 'two', 'three', - 'four', 'five', 'six', 'seven', 'eight', - 'four', 'five', 'six', 'seven', 'eight', + 'one', + 'two', + 'three', + 'four', + 'five', + 'six', + 'seven', + 'eight', + 'four', + 'five', + 'six', + 'seven', + 'eight', 'nine', ] class SlowStream extends EE { - write () { - setTimeout(_ => this.emit('drain')) + write() { + setTimeout(() => this.emit('drain')) return false } - end () { + end() { return this.write() } } let currentEntry const autoPipe = true - const p = new Parse({ + const p = new Parser({ ondone, onentry: entry => { t.equal(entry.path, expect.shift()) currentEntry = entry if (autoPipe) { - setTimeout(_ => entry.pipe(new SlowStream())) + setTimeout(() => entry.pipe(new SlowStream())) } }, }) @@ -441,7 +531,7 @@ t.test('drain event timings', t => { }) let interval - const go = _ => { + const go = () => { const d = data.shift() if (d === undefined) { return p.end() @@ -454,19 +544,21 @@ t.test('drain event timings', t => { } const hunklen = Math.floor(d.length / 2) - const hunks = [ - d.slice(0, hunklen), - d.slice(hunklen), - ] + const hunks = [d.subarray(0, hunklen), d.subarray(hunklen)] p.write(hunks[0]) if (currentEntry && !paused) { - console.error('has current entry') currentEntry.pause() paused = true } - if (!t.equal(p.write(hunks[1]), false, 'write should return false: ' + d)) { + if ( + !t.equal( + p.write(hunks[1]), + false, + 'write should return false: ' + d, + ) + ) { return t.end() } @@ -478,7 +570,7 @@ t.test('drain event timings', t => { } p.once('drain', go) - p.on('end', _ => { + p.on('end', () => { clearInterval(interval) t.ok(sawOndone) t.end() @@ -542,18 +634,18 @@ t.test('consume while consuming', t => { ]) const runTest = (t, size) => { - const p = new Parse() - const first = data.slice(0, size) - const rest = data.slice(size) - p.once('entry', entry => { + const p = new Parser() + const first = data.subarray(0, size) + const rest = data.subarray(size) + p.once('entry', _entry => { for (let pos = 0; pos < rest.length; pos += size) { - p.write(rest.slice(pos, pos + size)) + p.write(rest.subarray(pos, pos + size)) } p.end() }) .on('entry', entry => entry.resume()) - .on('end', _ => t.end()) + .on('end', () => t.end()) .write(first) } @@ -579,7 +671,9 @@ t.test('truncated input', t => { t.test('truncated at block boundary', t => { const warnings = [] - const p = new Parse({ onwarn: (c, message) => warnings.push(message) }) + const p = new Parser({ + onwarn: (_c, message) => warnings.push(message), + }) p.end(data) t.same(warnings, [ 'Truncated input (needed 512 more bytes, only 0 available)', @@ -589,7 +683,9 @@ t.test('truncated input', t => { t.test('truncated mid-block', t => { const warnings = [] - const p = new Parse({ onwarn: (c, message) => warnings.push(message) }) + const p = new Parser({ + onwarn: (_c, message) => warnings.push(message), + }) p.write(data) p.end(Buffer.from('not a full block')) t.same(warnings, [ @@ -617,33 +713,37 @@ t.test('truncated gzip input', t => { '', ]) const tgz = zlib.gzipSync(raw) - const split = Math.floor(tgz.length * 2 / 3) - const trunc = tgz.slice(0, split) + const split = Math.floor((tgz.length * 2) / 3) + const trunc = tgz.subarray(0, split) const skipEarlyEnd = process.version.match(/^v4\./) - t.test('early end', { - skip: skipEarlyEnd ? 'not a zlib error on v4' : false, - }, t => { - const warnings = [] - const p = new Parse() - p.on('error', er => warnings.push(er.message)) - let aborted = false - p.on('abort', _ => aborted = true) - p.end(trunc) - t.equal(aborted, true, 'aborted writing') - t.same(warnings, ['zlib: unexpected end of file']) - t.end() - }) + t.test( + 'early end', + { + skip: skipEarlyEnd ? 'not a zlib error on v4' : false, + }, + t => { + const warnings = [] + const p = new Parser() + p.on('error', er => warnings.push(er.message)) + let aborted = false + p.on('abort', () => (aborted = true)) + p.end(trunc) + t.equal(aborted, true, 'aborted writing') + t.same(warnings, ['zlib: unexpected end of file']) + t.end() + }, + ) t.test('just wrong', t => { const warnings = [] - const p = new Parse() + const p = new Parser() p.on('error', er => warnings.push(er.message)) let aborted = false - p.on('abort', _ => aborted = true) + p.on('abort', () => (aborted = true)) p.write(trunc) p.write(trunc) - p.write(tgz.slice(split)) + p.write(tgz.subarray(split)) p.end() t.equal(aborted, true, 'aborted writing') t.match(warnings, [/^zlib: /]) @@ -655,40 +755,42 @@ t.test('truncated gzip input', t => { t.test('end while consuming', t => { // https://github.com/npm/node-tar/issues/157 - const data = zlib.gzipSync(makeTar([ - { - path: 'package/package.json', - type: 'File', - size: 130, - }, - new Array(131).join('x'), - { - path: 'package/node_modules/@c/d/node_modules/e/package.json', - type: 'File', - size: 30, - }, - new Array(31).join('e'), - { - path: 'package/node_modules/@c/d/package.json', - type: 'File', - size: 33, - }, - new Array(34).join('d'), - { - path: 'package/node_modules/a/package.json', - type: 'File', - size: 59, - }, - new Array(60).join('a'), - { - path: 'package/node_modules/b/package.json', - type: 'File', - size: 30, - }, - new Array(31).join('b'), - '', - '', - ])) + const data = zlib.gzipSync( + makeTar([ + { + path: 'package/package.json', + type: 'File', + size: 130, + }, + new Array(131).join('x'), + { + path: 'package/node_modules/@c/d/node_modules/e/package.json', + type: 'File', + size: 30, + }, + new Array(31).join('e'), + { + path: 'package/node_modules/@c/d/package.json', + type: 'File', + size: 33, + }, + new Array(34).join('d'), + { + path: 'package/node_modules/a/package.json', + type: 'File', + size: 59, + }, + new Array(60).join('a'), + { + path: 'package/node_modules/b/package.json', + type: 'File', + size: 30, + }, + new Array(31).join('b'), + '', + '', + ]), + ) const actual = [] const expect = [ @@ -700,7 +802,7 @@ t.test('end while consuming', t => { ] const mp = new Minipass() - const p = new Parse({ + const p = new Parser({ onentry: entry => { actual.push(entry.path) entry.resume() @@ -716,7 +818,7 @@ t.test('end while consuming', t => { }) t.test('bad archives', t => { - const p = new Parse() + const p = new Parser() const warnings = [] p.on('warn', (code, msg, data) => { warnings.push([code, msg, data]) @@ -735,8 +837,8 @@ t.test('bad archives', t => { }) t.test('header that throws', t => { - const p = new Parse() - p.on('warn', (c, m, d) => { + const p = new Parser() + p.on('warn', (_c, m, d) => { t.equal(m, 'invalid base256 encoding') t.match(d, { code: 'TAR_ENTRY_INVALID', @@ -753,14 +855,19 @@ t.test('header that throws', t => { }) h.encode() const buf = h.block - const bad = Buffer.from([0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]) + const bad = Buffer.from([ + 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + ]) bad.copy(buf, 100) - t.throws(() => new Header(buf), 'the header with that buffer throws') + t.throws( + () => new Header(buf), + 'the header with that buffer throws', + ) p.write(buf) }) t.test('warnings that are not so bad', t => { - const p = new Parse() + const p = new Parser() const warnings = [] p.on('warn', (code, m, d) => { warnings.push([code, m, d]) @@ -768,7 +875,7 @@ t.test('warnings that are not so bad', t => { }) // the parser doesn't actually decide what's "ok" or "supported", // it just parses. So we have to set it ourselves like unpack does - p.once('entry', entry => entry.invalid = true) + p.once('entry', entry => (entry.invalid = true)) p.on('entry', entry => entry.resume()) const data = makeTar([ { diff --git a/test/path-reservations.js b/test/path-reservations.js index 9a1d7a77..6d9f7452 100644 --- a/test/path-reservations.js +++ b/test/path-reservations.js @@ -1,19 +1,25 @@ -const t = require('tap') +import t from 'tap' + +import { posix, win32 } from 'node:path' // load up the posix and windows versions of the reserver if (process.platform === 'win32') { process.env.TESTING_TAR_FAKE_PLATFORM = 'posix' } -const { reserve } = t.mock('../lib/path-reservations.js', { - path: require('path').posix, -})() + + +const { PathReservations } = await t.mockImport('../dist/esm/path-reservations.js', { + path: posix, +}) + delete process.env.TESTING_TAR_FAKE_PLATFORM if (process.platform !== 'win32') { process.env.TESTING_TAR_FAKE_PLATFORM = 'win32' } -const { reserve: winReserve } = t.mock('../lib/path-reservations.js', { - path: require('path').win32, -})() + +const { PathReservations: WinPathReservations } = await t.mockImport('../dist/esm/path-reservations.js', { + path: win32, +}) t.test('basic race', t => { // simulate the race conditions we care about @@ -62,11 +68,13 @@ t.test('basic race', t => { t.end() } - t.ok(reserve(['a/b/c/d'], file), 'file starts right away') - t.notOk(reserve(['a/B/c////D', 'a/b/e'], link), 'link waits') - t.notOk(reserve(['a/b/e/f'], dir), 'dir waits') - t.notOk(reserve(['a/b'], dir2), 'dir2 waits') - t.notOk(reserve(['a/b/x'], dir3), 'dir3 waits') + const r = new PathReservations() + + t.ok(r.reserve(['a/b/c/d'], file), 'file starts right away') + t.notOk(r.reserve(['a/B/c////D', 'a/b/e'], link), 'link waits') + t.notOk(r.reserve(['a/b/e/f'], dir), 'dir waits') + t.notOk(r.reserve(['a/b'], dir2), 'dir2 waits') + t.notOk(r.reserve(['a/b/x'], dir3), 'dir3 waits') }) t.test('unicode shenanigans', t => { @@ -89,8 +97,9 @@ t.test('unicode shenanigans', t => { } const cafePath1 = `c/a/f/${e1}` const cafePath2 = `c/a/f/${e2}` - t.ok(reserve([cafePath1], cafe1)) - t.notOk(reserve([cafePath2], cafe2)) + const r = new PathReservations() + t.ok(r.reserve([cafePath1], cafe1)) + t.notOk(r.reserve([cafePath2], cafe2)) }) t.test('absolute paths and trailing slash', t => { @@ -128,14 +137,15 @@ t.test('absolute paths and trailing slash', t => { t.end() } } - t.ok(reserve(['/p/a/t/h'], a1)) - t.notOk(reserve(['/p/a/t/h/'], a2)) - t.ok(reserve(['p/a/t/h'], r1)) - t.notOk(reserve(['p/a/t/h/'], r2)) + const r = new PathReservations() + t.ok(r.reserve(['/p/a/t/h'], a1)) + t.notOk(r.reserve(['/p/a/t/h/'], a2)) + t.ok(r.reserve(['p/a/t/h'], r1)) + t.notOk(r.reserve(['p/a/t/h/'], r2)) }) t.test('on windows, everything collides with everything', t => { - const reserve = winReserve + const r = new WinPathReservations() let called1 = false let called2 = false const f1 = done => { @@ -151,6 +161,6 @@ t.test('on windows, everything collides with everything', t => { done() t.end() } - t.equal(reserve(['some/path'], f1), true) - t.equal(reserve(['other/path'], f2), false) + t.equal(r.reserve(['some/path'], f1), true) + t.equal(r.reserve(['other/path'], f2), false) }) diff --git a/test/pax.js b/test/pax.js index cef9fc51..eb7f9260 100644 --- a/test/pax.js +++ b/test/pax.js @@ -1,6 +1,5 @@ -'use strict' -const t = require('tap') -const Pax = require('../lib/pax.js') +import t from 'tap' +import { Pax } from '../dist/esm/pax.js' t.test('create a pax', t => { const p = new Pax({ @@ -18,8 +17,6 @@ t.test('create a pax', t => { nlink: 1, }) - // console.log(p.encode().toString('hex').split('').reduce((s,c)=>{if(s[s.length-1].length<64)s[s.length-1]+=c;else s.push(c);return s},[''])) - const buf = Buffer.from( // pax entry header '5061784865616465722f666f6f2e747874000000000000000000000000000000' + @@ -59,13 +56,13 @@ t.test('create a pax', t => { 'hex') const actual = p.encode() - t.equal(actual.toString('hex'), buf.toString('hex')) + t.match(actual, buf) t.end() }) t.test('null pax', t => { const p = new Pax({}) - t.equal(p.encode(), null) + t.same(p.encode(), Buffer.allocUnsafe(0)) t.end() }) @@ -74,8 +71,6 @@ t.test('tiny pax', t => { // an error? const p = new Pax({ path: 'ab' }, true) const actual = p.encode() - // console.log(actual.toString('hex').split('').reduce((s,c)=>{if(s[s.length-1].length<64)s[s.length-1]+=c;else s.push(c);return s},[''])) - // return Promise.resolve() const buf = Buffer.from( // header @@ -120,104 +115,112 @@ t.test('tiny pax', t => { '0000000000000000000000000000000000000000000000000000000000000000', 'hex') - t.equal(actual.toString('hex'), buf.toString('hex')) + t.same(actual, buf) t.end() }) t.test('parse', t => { - t.same(Pax.parse('11 path=ab\n', { uid: 24561 }, true), { - atime: null, - charset: null, - comment: null, - ctime: null, - gid: null, - gname: null, - linkpath: null, - mtime: null, + const p = Pax.parse('11 path=ab\n', { uid: 24561 }, true) + t.same(p, Object.assign(Object.create(Pax.prototype), { + atime: undefined, + mode: undefined, + charset: undefined, + comment: undefined, + ctime: undefined, + gid: undefined, + gname: undefined, + linkpath: undefined, + mtime: undefined, path: 'ab', - size: null, + size: undefined, uid: 24561, - uname: null, - dev: null, - ino: null, - nlink: null, + uname: undefined, + dev: undefined, + ino: undefined, + nlink: undefined, global: true, - }) + })) - t.same(Pax.parse('11 path=ab\n', null, false), { - atime: null, - charset: null, - comment: null, - ctime: null, - gid: null, - gname: null, - linkpath: null, - mtime: null, + t.same(Pax.parse('11 path=ab\n'), Object.assign(Object.create(Pax.prototype), { + atime: undefined, + mtime: undefined, + ctime: undefined, + charset: undefined, + comment: undefined, + gid: undefined, + gname: undefined, + uname: undefined, + linkpath: undefined, path: 'ab', - size: null, - uid: null, - uname: null, - dev: null, - ino: null, - nlink: null, + size: undefined, + mode: undefined, + uid: undefined, + uname: undefined, + dev: undefined, + ino: undefined, + nlink: undefined, global: false, - }) + })) - t.same(Pax.parse('9 gid=20\n9 path=x\n', null, false), { - atime: null, - charset: null, - comment: null, - ctime: null, + t.same(Pax.parse('9 gid=20\n9 path=x\n'), { + atime: undefined, + mtime: undefined, + ctime: undefined, + charset: undefined, + comment: undefined, gid: 20, - gname: null, - linkpath: null, - mtime: null, + gname: undefined, + linkpath: undefined, + mtime: undefined, path: 'x', - size: null, - uid: null, - uname: null, - dev: null, - ino: null, - nlink: null, + size: undefined, + uid: undefined, + uname: undefined, + dev: undefined, + ino: undefined, + nlink: undefined, + mode: undefined, global: false, }) - t.same(Pax.parse('9 gid=20\n9 path=x\n', null, false), { - atime: null, - charset: null, - comment: null, - ctime: null, + t.same(Pax.parse('9 gid=20\n9 path=x\n'), { + atime: undefined, + charset: undefined, + comment: undefined, + ctime: undefined, gid: 20, - gname: null, - linkpath: null, - mtime: null, + gname: undefined, + linkpath: undefined, + mtime: undefined, path: 'x', - size: null, - uid: null, - uname: null, - dev: null, - ino: null, - nlink: null, + size: undefined, + uid: undefined, + uname: undefined, + dev: undefined, + ino: undefined, + mode: undefined, + nlink: undefined, global: false, }) - t.same(Pax.parse('20 mtime=1491436800\n', null, false), { - atime: null, - charset: null, - comment: null, - ctime: null, - gid: null, - gname: null, - linkpath: null, + t.same(Pax.parse('20 mtime=1491436800\n'), { + atime: undefined, + charset: undefined, + comment: undefined, + ctime: undefined, + gid: undefined, + gname: undefined, + linkpath: undefined, mtime: new Date('2017-04-06'), - path: null, - size: null, - uid: null, - uname: null, - dev: null, - ino: null, - nlink: null, + path: undefined, + size: undefined, + uid: undefined, + uname: undefined, + dev: undefined, + ino: undefined, + nlink: undefined, + mode: undefined, global: false, }) @@ -230,22 +233,23 @@ t.test('parse', t => { const noKey = '10 =pathx\n' - t.same(Pax.parse(breaky + '9 gid=20\n10 path=x\n' + noKey, null, false), { - atime: null, - charset: null, - comment: null, - ctime: null, + t.same(Pax.parse(breaky + '9 gid=20\n10 path=x\n' + noKey), { + atime: undefined, + charset: undefined, + comment: undefined, + ctime: undefined, gid: 20, - gname: null, - linkpath: null, - mtime: null, + gname: undefined, + linkpath: undefined, + mtime: undefined, path: 'x', - size: null, - uid: null, - uname: null, - dev: null, - ino: null, - nlink: null, + size: undefined, + uid: undefined, + uname: undefined, + dev: undefined, + ino: undefined, + nlink: undefined, + mode: undefined, global: false, }) diff --git a/test/read-entry.js b/test/read-entry.js index 4e12e87a..6d690390 100644 --- a/test/read-entry.js +++ b/test/read-entry.js @@ -1,7 +1,6 @@ -'use strict' -const t = require('tap') -const ReadEntry = require('../lib/read-entry.js') -const Header = require('../lib/header.js') +import t from 'tap' +import { ReadEntry } from '../dist/esm/read-entry.js' +import { Header } from '../dist/esm/header.js' t.test('create read entry', t => { const h = new Header({ @@ -19,7 +18,11 @@ t.test('create read entry', t => { }) h.encode() - const entry = new ReadEntry(h, { x: 'y', path: 'foo.txt' }, { z: 0, a: null, b: undefined }) + const entry = new ReadEntry( + h, + { x: 'y', path: 'foo.txt' }, + { z: 0, a: null, b: undefined }, + ) t.ok(entry.header.cksumValid, 'header checksum should be valid') @@ -67,8 +70,8 @@ t.test('create read entry', t => { let data = '' let ended = false - entry.on('data', c => data += c) - entry.on('end', _ => ended = true) + entry.on('data', c => (data += c)) + entry.on('end', _ => (ended = true)) const body = Buffer.alloc(512) body.write(new Array(101).join('z'), 0) @@ -81,6 +84,85 @@ t.test('create read entry', t => { t.end() }) +t.test('entry with extended linkpath', t => { + const h = new Header({ + path: 'oof.txt', + mode: 0o755, + uid: 24561, + gid: 20, + size: 0, + mtime: new Date('2016-04-01T22:00Z'), + ctime: new Date('2016-04-01T22:00Z'), + atime: new Date('2016-04-01T22:00Z'), + type: 'SymbolicLink', + uname: 'isaacs', + gname: 'staff', + }) + h.encode() + + const entry = new ReadEntry( + h, + { x: 'y', linkpath: 'bar.txt', path: 'foo.txt' }, + { z: 0, a: null, b: undefined }, + ) + + t.ok(entry.header.cksumValid, 'header checksum should be valid') + + t.match(entry, { + extended: { x: 'y', path: 'foo.txt', linkpath: 'bar.txt' }, + globalExtended: { z: 0, a: null, b: undefined }, + header: { + cksumValid: true, + needPax: false, + path: 'oof.txt', + mode: 0o755, + uid: 24561, + gid: 20, + size: 0, + mtime: new Date('2016-04-01T22:00:00.000Z'), + typeKey: '2', + type: 'SymbolicLink', + linkpath: null, + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + atime: new Date('2016-04-01T22:00:00.000Z'), + ctime: new Date('2016-04-01T22:00:00.000Z'), + }, + blockRemain: 0, + remain: 0, + type: 'SymbolicLink', + meta: false, + ignore: false, + path: 'foo.txt', + mode: 0o755, + uid: 24561, + gid: 20, + uname: 'isaacs', + gname: 'staff', + size: 0, + mtime: new Date('2016-04-01T22:00:00.000Z'), + atime: new Date('2016-04-01T22:00:00.000Z'), + ctime: new Date('2016-04-01T22:00:00.000Z'), + linkpath: 'bar.txt', + x: 'y', + z: 0, + }) + + let data = '' + entry.on('data', c => (data += c)) + + const body = Buffer.alloc(512) + body.write(new Array(101).join('z'), 0) + t.throws(() => entry.write(body)) + entry.end() + + t.equal(data, '') + + t.end() +}) + t.test('meta entry', t => { const h = new Header({ path: 'PaxHeader/foo.txt', @@ -102,11 +184,11 @@ t.test('meta entry', t => { let actual = '' const entry = new ReadEntry(h) - entry.on('data', c => actual += c) + entry.on('data', c => (actual += c)) - entry.write(body.slice(0, 1)) - entry.write(body.slice(1, 25)) - entry.write(body.slice(25)) + entry.write(body.subarray(0, 1)) + entry.write(body.subarray(1, 25)) + entry.write(body.subarray(25)) t.throws(_ => entry.write(Buffer.alloc(1024))) t.equal(actual, expect) @@ -128,6 +210,8 @@ t.test('unknown entry type', t => { gname: 'staff', }) h.encode() + // this triggers its type to be Unsupported, which means that any + // data written to it will be thrown away. h.block.write('9', 156, 1, 'ascii') const body = Buffer.alloc(512) @@ -138,12 +222,12 @@ t.test('unknown entry type', t => { const entry = new ReadEntry(new Header(h.block)) - entry.on('data', c => actual += c) + entry.on('data', c => (actual += c)) - entry.write(body.slice(0, 1)) - entry.write(body.slice(1, 25)) - entry.write(body.slice(25)) - t.throws(_ => entry.write(Buffer.alloc(1024))) + entry.write(body.subarray(0, 1)) + entry.write(body.subarray(1, 25)) + entry.write(body.subarray(25)) + t.throws(() => entry.write(Buffer.alloc(1024))) t.equal(actual, expect) t.match(entry, { ignore: true }) @@ -209,8 +293,8 @@ t.test('entry without mode', t => { let data = '' let ended = false - entry.on('data', c => data += c) - entry.on('end', _ => ended = true) + entry.on('data', c => (data += c)) + entry.on('end', _ => (ended = true)) const body = Buffer.alloc(512) body.write(new Array(101).join('z'), 0) diff --git a/test/replace.js b/test/replace.js index 75c97027..22af74d7 100644 --- a/test/replace.js +++ b/test/replace.js @@ -1,25 +1,26 @@ -'use strict' -const t = require('tap') -const r = require('../lib/replace.js') -const path = require('path') -const fs = require('fs') -const mutateFS = require('mutate-fs') -const list = require('../lib/list.js') -const { resolve } = require('path') - +import t from 'tap' +import { replace as r } from '../dist/esm/replace.js' +import path, {dirname, resolve } from 'path' +import fs from 'fs' +import mutateFS from 'mutate-fs' +import { list } from '../dist/esm/list.js' +import {fileURLToPath} from 'url' +import zlib from 'zlib' +import { spawn } from 'child_process' + +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const fixtures = path.resolve(__dirname, 'fixtures') const tars = path.resolve(fixtures, 'tars') -const zlib = require('zlib') -const spawn = require('child_process').spawn const data = fs.readFileSync(tars + '/body-byte-counts.tar') -const dataNoNulls = data.slice(0, data.length - 1024) +const dataNoNulls = data.subarray(0, data.length - 1024) const fixtureDef = { 'body-byte-counts.tar': data, 'no-null-eof.tar': dataNoNulls, - 'truncated-head.tar': Buffer.concat([dataNoNulls, data.slice(0, 500)]), - 'truncated-body.tar': Buffer.concat([dataNoNulls, data.slice(0, 700)]), + 'truncated-head.tar': Buffer.concat([dataNoNulls, data.subarray(0, 500)]), + 'truncated-body.tar': Buffer.concat([dataNoNulls, data.subarray(0, 700)]), 'zero.tar': Buffer.from(''), 'empty.tar': Buffer.alloc(512), 'compressed.tgz': zlib.gzipSync(data), @@ -318,7 +319,7 @@ t.test('mtime cache', async t => { path.basename(__filename), ]) const mtc = {} - mtimeCache.forEach((v, k) => mtc[k] = mtimeCache.get(k).toISOString()) + mtimeCache.forEach((_v, k) => mtc[k] = mtimeCache.get(k).toISOString()) t.same(mtc, { '1024-bytes.txt': '2017-04-10T16:57:47.000Z', '512-bytes.txt': '2017-04-10T17:08:55.000Z', diff --git a/test/strip-absolute-path.js b/test/strip-absolute-path.js index 3e871a9f..59529d6f 100644 --- a/test/strip-absolute-path.js +++ b/test/strip-absolute-path.js @@ -1,5 +1,7 @@ -const t = require('tap') -const stripAbsolutePath = require('../lib/strip-absolute-path.js') +import t from 'tap' +import { stripAbsolutePath } from '../dist/esm/strip-absolute-path.js' +import realPath from 'node:path' + const cwd = process.cwd() t.test('basic', t => { @@ -9,34 +11,46 @@ t.test('basic', t => { 'c:///a/b/c': ['c:///', 'a/b/c'], '\\\\foo\\bar\\baz': ['\\\\foo\\bar\\', 'baz'], '//foo//bar//baz': ['//', 'foo//bar//baz'], - 'c:\\c:\\c:\\c:\\\\d:\\e/f/g': ['c:\\c:\\c:\\c:\\\\d:\\', 'e/f/g'], + 'c:\\c:\\c:\\c:\\\\d:\\e/f/g': [ + 'c:\\c:\\c:\\c:\\\\d:\\', + 'e/f/g', + ], } for (const [input, [root, stripped]] of Object.entries(cases)) { - t.strictSame(stripAbsolutePath(input, cwd), [root, stripped], input) + t.strictSame( + stripAbsolutePath(input, cwd), + [root, stripped], + input, + ) } t.end() }) -t.test('drive-local paths', t => { +t.test('drive-local paths', async t => { const env = process.env - t.teardown(() => process.env = env) + t.teardown(() => (process.env = env)) const cwd = 'D:\\safety\\land' - const realPath = require('path') // be windowsy const path = { ...realPath.win32, win32: realPath.win32, posix: realPath.posix, } - const stripAbsolutePath = t.mock('../lib/strip-absolute-path.js', { path }) + const { stripAbsolutePath } = await t.mockImport( + '../dist/esm/strip-absolute-path.js', + { path }, + ) const cases = { '/': ['/', ''], '////': ['////', ''], 'c:///a/b/c': ['c:///', 'a/b/c'], '\\\\foo\\bar\\baz': ['\\\\foo\\bar\\', 'baz'], '//foo//bar//baz': ['//', 'foo//bar//baz'], - 'c:\\c:\\c:\\c:\\\\d:\\e/f/g': ['c:\\c:\\c:\\c:\\\\d:\\', 'e/f/g'], + 'c:\\c:\\c:\\c:\\\\d:\\e/f/g': [ + 'c:\\c:\\c:\\c:\\\\d:\\', + 'e/f/g', + ], 'c:..\\system\\explorer.exe': ['c:', '..\\system\\explorer.exe'], 'd:..\\..\\unsafe\\land': ['d:', '..\\..\\unsafe\\land'], 'c:foo': ['c:', 'foo'], @@ -45,7 +59,13 @@ t.test('drive-local paths', t => { '\\\\?\\X:\\y\\z': ['\\\\?\\X:\\', 'y\\z'], } for (const [input, [root, stripped]] of Object.entries(cases)) { - if (!t.strictSame(stripAbsolutePath(input, cwd), [root, stripped], input)) { + if ( + !t.strictSame( + stripAbsolutePath(input, cwd), + [root, stripped], + input, + ) + ) { break } } diff --git a/test/strip-trailing-slashes.js b/test/strip-trailing-slashes.js index ce0695f8..97f8a16f 100644 --- a/test/strip-trailing-slashes.js +++ b/test/strip-trailing-slashes.js @@ -1,8 +1,8 @@ -const t = require('tap') -const stripSlash = require('../lib/strip-trailing-slashes.js') +import t from 'tap' +import { stripTrailingSlashes } from '../dist/esm/strip-trailing-slashes.js' const short = '///a///b///c///' const long = short.repeat(10) + '/'.repeat(1000000) -t.equal(stripSlash('no slash'), 'no slash') -t.equal(stripSlash(short), '///a///b///c') -t.equal(stripSlash(long), short.repeat(9) + '///a///b///c') +t.equal(stripTrailingSlashes('no slash'), 'no slash') +t.equal(stripTrailingSlashes(short), '///a///b///c') +t.equal(stripTrailingSlashes(long), short.repeat(9) + '///a///b///c') diff --git a/test/symlink-error.js b/test/symlink-error.js new file mode 100644 index 00000000..92a71bd3 --- /dev/null +++ b/test/symlink-error.js @@ -0,0 +1,11 @@ +import t from 'tap' +import { SymlinkError } from '../dist/esm/symlink-error.js' + +t.match(new SymlinkError('symlink', 'path'), { + name: 'SymlinkError', + path: 'path', + symlink: 'symlink', + syscall: 'symlink', + code: 'TAR_SYMLINK_ERROR', + message: 'TAR_SYMLINK_ERROR: Cannot extract through symbolic link', +}) diff --git a/test/types.js b/test/types.js index c2ca5f67..93425d39 100644 --- a/test/types.js +++ b/test/types.js @@ -1,6 +1,8 @@ -'use strict' -// not much to test here, just 2 maps. -const t = require('tap') -const types = require('../lib/types.js') +import t from 'tap' +import * as types from '../dist/esm/types.js' t.equal(types.name.get('0'), 'File') t.equal(types.code.get('File'), '0') +t.equal(types.isCode('0'), true) +t.equal(types.isCode('Z'), false) +t.equal(types.isName('TapeVolumeHeader'), true) +t.equal(types.isName('Unsupported'), false) diff --git a/test/unpack.js b/test/unpack.js index 2f1d3026..51ba1220 100644 --- a/test/unpack.js +++ b/test/unpack.js @@ -1,35 +1,38 @@ -'use strict' - process.umask(0o022) -const Unpack = require('../lib/unpack.js') -const UnpackSync = Unpack.Sync -const t = require('tap') -const { Minipass } = require('minipass') +import { Unpack, UnpackSync } from '../dist/esm/unpack.js' + +import fs from 'fs' +import { Minipass } from 'minipass' +import * as z from 'minizlib' +import path from 'path' +import { rimraf } from 'rimraf' +import t from 'tap' +import { fileURLToPath } from 'url' +import { Header } from '../dist/esm/header.js' +import { makeTar } from './fixtures/make-tar.js' -const makeTar = require('./make-tar.js') -const Header = require('../lib/header.js') -const z = require('minizlib') -const fs = require('fs') -const path = require('path') +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) const fixtures = path.resolve(__dirname, 'fixtures') const tars = path.resolve(fixtures, 'tars') const parses = path.resolve(fixtures, 'parse') const unpackdir = path.resolve(fixtures, 'unpack') -const { promisify } = require('util') -const rimraf = promisify(require('rimraf')) -const mkdirp = require('mkdirp') -const mutateFS = require('mutate-fs') -const eos = require('end-of-stream') -const normPath = require('../lib/normalize-windows-path.js') -const ReadEntry = require('../lib/read-entry.js') + +import eos from 'end-of-stream' +import { mkdirp } from 'mkdirp' +import mutateFS from 'mutate-fs' +import { normalizeWindowsPath as normPath } from '../dist/esm/normalize-windows-path.js' + +import { ReadEntry } from '../dist/esm/read-entry.js' // On Windows in particular, the "really deep folder path" file // often tends to cause problems, which don't indicate a failure // of this library, it's just what happens on Windows with super // long file paths. const isWindows = process.platform === 'win32' -const isLongFile = f => f.match(/r.e.a.l.l.y.-.d.e.e.p.-.f.o.l.d.e.r.-.p.a.t.h/) +const isLongFile = f => + f.match(/r.e.a.l.l.y.-.d.e.e.p.-.f.o.l.d.e.r.-.p.a.t.h/) t.teardown(_ => rimraf(unpackdir)) @@ -56,7 +59,8 @@ t.test('basic file unpack tests', t => { 'utf8.tar': { '🌟.txt': '🌟✧✩⭐︎✪✫✬✭✮⚝✯✰✵✶✷✸✹❂⭑⭒★☆✡☪✴︎✦✡️🔯✴️🌠\n', 'Ω.txt': 'Ω', - 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt': 'Ω', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt': + 'Ω', }, 'file.tar': { 'one-byte.txt': 'a', @@ -65,17 +69,26 @@ t.test('basic file unpack tests', t => { 'one-byte.txt': 'a', }, 'long-pax.tar': { - '120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', }, 'long-paths.tar': { - '100-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', - '120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', - '170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', - 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt': 'short\n', - 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', - 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', - 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', - 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt': 'Ω', + '100-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '120-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + '170-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt': + 'short\n', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt': + 'Ω', }, } @@ -199,8 +212,10 @@ t.test('links!', t => { t.test('async', t => { const unpack = new Unpack({ cwd: dir }) let finished = false - unpack.on('finish', _ => finished = true) - unpack.on('close', _ => t.ok(finished, 'emitted finish before close')) + unpack.on('finish', _ => (finished = true)) + unpack.on('close', _ => + t.ok(finished, 'emitted finish before close'), + ) unpack.on('close', _ => check(t)) unpack.end(data) }) @@ -220,8 +235,10 @@ t.test('links!', t => { t.test('async strip', t => { const unpack = new Unpack({ cwd: dir, strip: 1 }) let finished = false - unpack.on('finish', _ => finished = true) - unpack.on('close', _ => t.ok(finished, 'emitted finish before close')) + unpack.on('finish', _ => (finished = true)) + unpack.on('close', _ => + t.ok(finished, 'emitted finish before close'), + ) unpack.on('close', _ => checkForStrip(t)) unpack.end(stripData) }) @@ -235,8 +252,10 @@ t.test('links!', t => { t.test('async strip 3', t => { const unpack = new Unpack({ cwd: dir, strip: 3 }) let finished = false - unpack.on('finish', _ => finished = true) - unpack.on('close', _ => t.ok(finished, 'emitted finish before close')) + unpack.on('finish', _ => (finished = true)) + unpack.on('close', _ => + t.ok(finished, 'emitted finish before close'), + ) unpack.on('close', _ => checkForStrip3(t)) unpack.end(stripData) }) @@ -277,9 +296,10 @@ t.test('links without cleanup (exercise clobbering code)', t => { t.test('async', t => { const unpack = new Unpack({ cwd: dir }) let prefinished = false - unpack.on('prefinish', _ => prefinished = true) + unpack.on('prefinish', _ => (prefinished = true)) unpack.on('finish', _ => - t.ok(prefinished, 'emitted prefinish before finish')) + t.ok(prefinished, 'emitted prefinish before finish'), + ) unpack.on('close', _ => check(t)) unpack.end(data) }) @@ -321,9 +341,12 @@ t.test('nested dir dupe', t => { t.teardown(_ => rimraf(dir)) const expect = { 'd/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/a.txt': 'short\n', - 'd/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', - 'd/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', - 'd/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + 'd/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + 'd/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + 'd/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', 'd/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt': 'Ω', } @@ -347,274 +370,346 @@ t.test('nested dir dupe', t => { zip.end(data) }) -t.test('symlink in dir path', { - skip: isWindows && 'symlinks not fully supported', -}, t => { - const dir = path.resolve(unpackdir, 'symlink-junk') +t.test( + 'symlink in dir path', + { + skip: isWindows && 'symlinks not fully supported', + }, + t => { + const dir = path.resolve(unpackdir, 'symlink-junk') - t.teardown(_ => rimraf(dir)) - t.beforeEach(async () => { - await rimraf(dir) - await mkdirp(dir) - }) + t.teardown(_ => rimraf(dir)) + t.beforeEach(async () => { + await rimraf(dir) + await mkdirp(dir) + }) - const data = makeTar([ - { - path: 'd/i', - type: 'Directory', - }, - { - path: 'd/i/r/dir', - type: 'Directory', - mode: 0o751, - mtime: new Date('2011-03-27T22:16:31.000Z'), - }, - { - path: 'd/i/r/file', - type: 'File', - size: 1, - atime: new Date('1979-07-01T19:10:00.000Z'), - ctime: new Date('2011-03-27T22:16:31.000Z'), - }, - 'a', - { - path: 'd/i/r/link', - type: 'Link', - linkpath: 'd/i/r/file', - atime: new Date('1979-07-01T19:10:00.000Z'), - ctime: new Date('2011-03-27T22:16:31.000Z'), - mtime: new Date('2011-03-27T22:16:31.000Z'), - }, - { - path: 'd/i/r/symlink', - type: 'SymbolicLink', - linkpath: './dir', - atime: new Date('1979-07-01T19:10:00.000Z'), - ctime: new Date('2011-03-27T22:16:31.000Z'), - mtime: new Date('2011-03-27T22:16:31.000Z'), - }, - { - path: 'd/i/r/symlink/x', - type: 'File', - size: 0, - atime: new Date('1979-07-01T19:10:00.000Z'), - ctime: new Date('2011-03-27T22:16:31.000Z'), - mtime: new Date('2011-03-27T22:16:31.000Z'), - }, - '', - '', - ]) + const data = makeTar([ + { + path: 'd/i', + type: 'Directory', + }, + { + path: 'd/i/r/dir', + type: 'Directory', + mode: 0o751, + mtime: new Date('2011-03-27T22:16:31.000Z'), + }, + { + path: 'd/i/r/file', + type: 'File', + size: 1, + atime: new Date('1979-07-01T19:10:00.000Z'), + ctime: new Date('2011-03-27T22:16:31.000Z'), + }, + 'a', + { + path: 'd/i/r/link', + type: 'Link', + linkpath: 'd/i/r/file', + atime: new Date('1979-07-01T19:10:00.000Z'), + ctime: new Date('2011-03-27T22:16:31.000Z'), + mtime: new Date('2011-03-27T22:16:31.000Z'), + }, + { + path: 'd/i/r/symlink', + type: 'SymbolicLink', + linkpath: './dir', + atime: new Date('1979-07-01T19:10:00.000Z'), + ctime: new Date('2011-03-27T22:16:31.000Z'), + mtime: new Date('2011-03-27T22:16:31.000Z'), + }, + { + path: 'd/i/r/symlink/x', + type: 'File', + size: 0, + atime: new Date('1979-07-01T19:10:00.000Z'), + ctime: new Date('2011-03-27T22:16:31.000Z'), + mtime: new Date('2011-03-27T22:16:31.000Z'), + }, + '', + '', + ]) - t.test('no clobbering', t => { - const warnings = [] - const u = new Unpack({ - cwd: dir, - onwarn: (c, w, d) => warnings.push([c, w, d]), + t.test('no clobbering', t => { + const warnings = [] + const u = new Unpack({ + cwd: dir, + onwarn: (c, w, d) => warnings.push([c, w, d]), + }) + u.on('close', _ => { + t.equal( + fs.lstatSync(dir + '/d/i').mode & 0o7777, + isWindows ? 0o666 : 0o755, + ) + t.equal( + fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, + isWindows ? 0o666 : 0o751, + ) + t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') + if (!isWindows) { + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), + 'got symlink', + ) + t.throws(_ => fs.statSync(dir + '/d/i/r/symlink/x')) + } + t.equal(warnings[0][0], 'TAR_ENTRY_ERROR') + if (!isWindows) { + t.equal( + warnings[0][1], + 'TAR_SYMLINK_ERROR: Cannot extract through symbolic link', + ) + t.match(warnings[0][2], { + name: 'SymlinkError', + code: 'TAR_SYMLINK_ERROR', + tarCode: 'TAR_ENTRY_ERROR', + path: dir + '/d/i/r/symlink/', + symlink: dir + '/d/i/r/symlink', + }) + } + t.equal(warnings.length, 1) + t.end() + }) + u.end(data) }) - u.on('close', _ => { - t.equal(fs.lstatSync(dir + '/d/i').mode & 0o7777, isWindows ? 0o666 : 0o755) - t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, isWindows ? 0o666 : 0o751) + + t.test('no clobbering, sync', t => { + const warnings = [] + const u = new UnpackSync({ + cwd: dir, + onwarn: (c, w, d) => warnings.push([c, w, d]), + }) + u.end(data) + t.equal( + fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, + isWindows ? 0o666 : 0o751, + ) t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') if (!isWindows) { - t.ok(fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), 'got symlink') + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), + 'got symlink', + ) t.throws(_ => fs.statSync(dir + '/d/i/r/symlink/x')) } - t.equal(warnings[0][0], 'TAR_ENTRY_ERROR') - if (!isWindows) { - t.equal(warnings[0][1], 'Cannot extract through symbolic link') - t.match(warnings[0][2], { - name: 'SylinkError', - path: dir + '/d/i/r/symlink/', - symlink: dir + '/d/i/r/symlink', - }) - } t.equal(warnings.length, 1) + t.equal(warnings[0][0], 'TAR_ENTRY_ERROR') + t.equal( + warnings[0][1], + 'TAR_SYMLINK_ERROR: Cannot extract through symbolic link', + ) + t.match(warnings[0][2], { + name: 'SymlinkError', + path: dir + '/d/i/r/symlink/', + symlink: dir + '/d/i/r/symlink', + }) t.end() }) - u.end(data) - }) - t.test('no clobbering, sync', t => { - const warnings = [] - const u = new UnpackSync({ - cwd: dir, - onwarn: (c, w, d) => warnings.push([c, w, d]), - }) - u.end(data) - t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, isWindows ? 0o666 : 0o751) - t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') - if (!isWindows) { - t.ok(fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), 'got symlink') - t.throws(_ => fs.statSync(dir + '/d/i/r/symlink/x')) - } - t.equal(warnings.length, 1) - t.equal(warnings[0][0], 'TAR_ENTRY_ERROR') - t.equal(warnings[0][1], 'Cannot extract through symbolic link') - t.match(warnings[0][2], { - name: 'SylinkError', - path: dir + '/d/i/r/symlink/', - symlink: dir + '/d/i/r/symlink', + t.test('extract through symlink', t => { + const warnings = [] + const u = new Unpack({ + cwd: dir, + onwarn: (c, w, d) => warnings.push([c, w, d]), + preservePaths: true, + }) + u.on('close', _ => { + t.same(warnings, []) + t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, 0o751) + t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), + 'got symlink', + ) + t.ok( + fs.lstatSync(dir + '/d/i/r/dir/x').isFile(), + 'x thru link', + ) + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink/x').isFile(), + 'x thru link', + ) + t.end() + }) + u.end(data) }) - t.end() - }) - t.test('extract through symlink', t => { - const warnings = [] - const u = new Unpack({ - cwd: dir, - onwarn: (c, w, d) => warnings.push([c, w, d]), - preservePaths: true, - }) - u.on('close', _ => { + t.test('extract through symlink sync', t => { + const warnings = [] + const u = new UnpackSync({ + cwd: dir, + onwarn: (c, w, d) => warnings.push([c, w, d]), + preservePaths: true, + }) + u.end(data) t.same(warnings, []) t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, 0o751) t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), 'got symlink') + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), + 'got symlink', + ) t.ok(fs.lstatSync(dir + '/d/i/r/dir/x').isFile(), 'x thru link') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink/x').isFile(), 'x thru link') + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink/x').isFile(), + 'x thru link', + ) t.end() }) - u.end(data) - }) - t.test('extract through symlink sync', t => { - const warnings = [] - const u = new UnpackSync({ - cwd: dir, - onwarn: (c, w, d) => warnings.push([c, w, d]), - preservePaths: true, + t.test('clobber through symlink', t => { + const warnings = [] + const u = new Unpack({ + cwd: dir, + onwarn: (c, w, d) => warnings.push([c, w, d]), + unlink: true, + }) + u.on('close', _ => { + t.same(warnings, []) + t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, 0o751) + t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') + t.notOk( + fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), + 'no link', + ) + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink').isDirectory(), + 'sym is dir', + ) + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink/x').isFile(), + 'x thru link', + ) + t.end() + }) + u.end(data) }) - u.end(data) - t.same(warnings, []) - t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, 0o751) - t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), 'got symlink') - t.ok(fs.lstatSync(dir + '/d/i/r/dir/x').isFile(), 'x thru link') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink/x').isFile(), 'x thru link') - t.end() - }) - t.test('clobber through symlink', t => { - const warnings = [] - const u = new Unpack({ - cwd: dir, - onwarn: (c, w, d) => warnings.push([c, w, d]), - unlink: true, + t.test('clobber through symlink with busted unlink', t => { + const poop = new Error('poop') + // for some reason, resetting fs.unlink in the teardown was breaking + const reset = mutateFS.fail('unlink', poop) + const warnings = [] + const u = new Unpack({ + cwd: dir, + onwarn: (c, w, d) => warnings.push([c, w, d]), + unlink: true, + }) + u.on('close', _ => { + t.same(warnings, [['TAR_ENTRY_ERROR', 'poop', poop]]) + reset() + t.end() + }) + u.end(data) }) - u.on('close', _ => { - t.same(warnings, []) + + t.test('clobber through symlink sync', t => { + const warnings = [] + const u = new UnpackSync({ + cwd: dir, + onwarn: (c, w, d) => warnings.push([c, w, d]), + unlink: true, + }) + u.end(data) t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, 0o751) t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') - t.notOk(fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), 'no link') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink').isDirectory(), 'sym is dir') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink/x').isFile(), 'x thru link') + t.notOk( + fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), + 'no link', + ) + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink').isDirectory(), + 'sym is dir', + ) + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink/x').isFile(), + 'x thru link', + ) t.end() }) - u.end(data) - }) - t.test('clobber through symlink with busted unlink', t => { - const poop = new Error('poop') - // for some reason, resetting fs.unlink in the teardown was breaking - const reset = mutateFS.fail('unlink', poop) - const warnings = [] - const u = new Unpack({ - cwd: dir, - onwarn: (c, w, d) => warnings.push([c, w, d]), - unlink: true, - }) - u.on('close', _ => { - t.same(warnings, [['TAR_ENTRY_ERROR', 'poop', poop]]) - reset() - t.end() - }) - u.end(data) - }) - - t.test('clobber through symlink sync', t => { - const warnings = [] - const u = new UnpackSync({ - cwd: dir, - onwarn: (c, w, d) => warnings.push([c, w, d]), - unlink: true, + t.test('clobber dirs', t => { + mkdirp.sync(dir + '/d/i/r/dir') + mkdirp.sync(dir + '/d/i/r/file') + mkdirp.sync(dir + '/d/i/r/link') + mkdirp.sync(dir + '/d/i/r/symlink') + const warnings = [] + const u = new Unpack({ + cwd: dir, + onwarn: (c, w, d) => { + warnings.push([c, w, d]) + }, + }) + u.on('close', _ => { + t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, 0o751) + t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), + 'got symlink', + ) + t.throws(_ => fs.statSync(dir + '/d/i/r/symlink/x')) + t.equal(warnings.length, 1) + t.equal(warnings[0][0], 'TAR_ENTRY_ERROR') + t.equal( + warnings[0][1], + 'TAR_SYMLINK_ERROR: Cannot extract through symbolic link', + ) + t.match(warnings[0][2], { + name: 'SymlinkError', + path: dir + '/d/i/r/symlink/', + symlink: dir + '/d/i/r/symlink', + }) + t.end() + }) + u.end(data) }) - u.end(data) - t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, 0o751) - t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') - t.notOk(fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), 'no link') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink').isDirectory(), 'sym is dir') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink/x').isFile(), 'x thru link') - t.end() - }) - t.test('clobber dirs', t => { - mkdirp.sync(dir + '/d/i/r/dir') - mkdirp.sync(dir + '/d/i/r/file') - mkdirp.sync(dir + '/d/i/r/link') - mkdirp.sync(dir + '/d/i/r/symlink') - const warnings = [] - const u = new Unpack({ - cwd: dir, - onwarn: (c, w, d) => { - warnings.push([c, w, d]) - }, - }) - u.on('close', _ => { + t.test('clobber dirs sync', t => { + mkdirp.sync(dir + '/d/i/r/dir') + mkdirp.sync(dir + '/d/i/r/file') + mkdirp.sync(dir + '/d/i/r/link') + mkdirp.sync(dir + '/d/i/r/symlink') + const warnings = [] + const u = new UnpackSync({ + cwd: dir, + onwarn: (c, w, d) => { + warnings.push([c, w, d]) + }, + }) + u.end(data) t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, 0o751) t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), 'got symlink') + t.ok( + fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), + 'got symlink', + ) t.throws(_ => fs.statSync(dir + '/d/i/r/symlink/x')) t.equal(warnings.length, 1) t.equal(warnings[0][0], 'TAR_ENTRY_ERROR') - t.equal(warnings[0][1], 'Cannot extract through symbolic link') + t.equal( + warnings[0][1], + 'TAR_SYMLINK_ERROR: Cannot extract through symbolic link', + ) t.match(warnings[0][2], { - name: 'SylinkError', + name: 'SymlinkError', path: dir + '/d/i/r/symlink/', symlink: dir + '/d/i/r/symlink', }) t.end() }) - u.end(data) - }) - t.test('clobber dirs sync', t => { - mkdirp.sync(dir + '/d/i/r/dir') - mkdirp.sync(dir + '/d/i/r/file') - mkdirp.sync(dir + '/d/i/r/link') - mkdirp.sync(dir + '/d/i/r/symlink') - const warnings = [] - const u = new UnpackSync({ - cwd: dir, - onwarn: (c, w, d) => { - warnings.push([c, w, d]) - }, - }) - u.end(data) - t.equal(fs.lstatSync(dir + '/d/i/r/dir').mode & 0o7777, 0o751) - t.ok(fs.lstatSync(dir + '/d/i/r/file').isFile(), 'got file') - t.ok(fs.lstatSync(dir + '/d/i/r/symlink').isSymbolicLink(), 'got symlink') - t.throws(_ => fs.statSync(dir + '/d/i/r/symlink/x')) - t.equal(warnings.length, 1) - t.equal(warnings[0][0], 'TAR_ENTRY_ERROR') - t.equal(warnings[0][1], 'Cannot extract through symbolic link') - t.match(warnings[0][2], { - name: 'SylinkError', - path: dir + '/d/i/r/symlink/', - symlink: dir + '/d/i/r/symlink', - }) t.end() - }) - - t.end() -}) + }, +) t.test('unsupported entries', t => { const dir = path.resolve(unpackdir, 'unsupported-entries') mkdirp.sync(dir) t.teardown(_ => rimraf(dir)) - const unknown = new Header({ path: 'qux', type: 'File', size: 4 }) - unknown.type = 'Z' + const unknown = new Header({ path: 'qux', size: 4 }) unknown.encode() + unknown.block?.write('Z', 156) const data = makeTar([ { path: 'dev/random', @@ -639,15 +734,33 @@ t.test('unsupported entries', t => { t.test('basic, warns', t => { const warnings = [] - const u = new Unpack({ cwd: dir, onwarn: (c, w, d) => warnings.push([c, w, d]) }) + const u = new Unpack({ + cwd: dir, + onwarn: (c, w, d) => warnings.push([c, w, d]), + }) const c = 'TAR_ENTRY_UNSUPPORTED' const expect = [ - [c, 'unsupported entry type: CharacterDevice', { - entry: { path: 'dev/random' } }], - [c, 'unsupported entry type: BlockDevice', { - entry: { path: 'dev/hd0' } }], - [c, 'unsupported entry type: FIFO', { - entry: { path: 'dev/fifo0' } }], + [ + c, + 'unsupported entry type: CharacterDevice', + { + entry: { path: 'dev/random' }, + }, + ], + [ + c, + 'unsupported entry type: BlockDevice', + { + entry: { path: 'dev/hd0' }, + }, + ], + [ + c, + 'unsupported entry type: FIFO', + { + entry: { path: 'dev/fifo0' }, + }, + ], ] u.on('close', _ => { t.equal(fs.readdirSync(dir).length, 0) @@ -752,7 +865,9 @@ t.test('file in dir path', t => { t.plan(2) t.test('async', t => { - new Unpack({ cwd: dir, unlink: true }).on('close', _ => check(t)).end(data) + new Unpack({ cwd: dir, unlink: true }) + .on('close', _ => check(t)) + .end(data) }) t.test('sync', t => { @@ -782,11 +897,19 @@ t.test('set umask option', t => { new Unpack({ umask: 0o027, cwd: dir, - }).on('close', _ => { - t.equal(fs.statSync(dir + '/d/i/r').mode & 0o7777, isWindows ? 0o666 : 0o750) - t.equal(fs.statSync(dir + '/d/i/r/dir').mode & 0o7777, isWindows ? 0o666 : 0o751) - t.end() - }).end(data) + }) + .on('close', _ => { + t.equal( + fs.statSync(dir + '/d/i/r').mode & 0o7777, + isWindows ? 0o666 : 0o750, + ) + t.equal( + fs.statSync(dir + '/d/i/r/dir').mode & 0o7777, + isWindows ? 0o666 : 0o751, + ) + t.end() + }) + .end(data) }) t.test('absolute paths', t => { @@ -823,11 +946,16 @@ t.test('absolute paths', t => { t.test('warn and correct', t => { const check = t => { const r = normPath(root) - t.match(warnings, [[ - `stripping ${r}${r}${r}${r} from absolute path`, - { path: normPath(absolute), code: 'TAR_ENTRY_INFO' }, - ]]) - t.ok(fs.lstatSync(path.resolve(dir, relative)).isFile(), 'is file') + t.match(warnings, [ + [ + `stripping ${r}${r}${r}${r} from absolute path`, + { path: normPath(absolute), code: 'TAR_ENTRY_INFO' }, + ], + ]) + t.ok( + fs.lstatSync(path.resolve(dir, relative)).isFile(), + 'is file', + ) t.end() } @@ -837,15 +965,17 @@ t.test('absolute paths', t => { warnings.length = 0 new Unpack({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), - }).on('close', _ => check(t)).end(data) + onwarn: (_c, w, d) => warnings.push([w, d]), + }) + .on('close', _ => check(t)) + .end(data) }) t.test('sync', t => { warnings.length = 0 new UnpackSync({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), + onwarn: (_c, w, d) => warnings.push([w, d]), }).end(data) check(t) }) @@ -883,8 +1013,10 @@ t.test('absolute paths', t => { new Unpack({ preservePaths: true, cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), - }).on('close', _ => check(t)).end(data) + onwarn: (_c, w, d) => warnings.push([w, d]), + }) + .on('close', _ => check(t)) + .end(data) }) t.test('sync', t => { @@ -892,7 +1024,7 @@ t.test('absolute paths', t => { new UnpackSync({ preservePaths: true, cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), + onwarn: (_c, w, d) => warnings.push([w, d]), }).end(data) check(t) }) @@ -931,10 +1063,12 @@ t.test('.. paths', t => { t.test('warn and skip', t => { const check = t => { - t.match(warnings, [[ - 'path contains \'..\'', - { path: dotted, code: 'TAR_ENTRY_ERROR' }, - ]]) + t.match(warnings, [ + [ + "path contains '..'", + { path: dotted, code: 'TAR_ENTRY_ERROR' }, + ], + ]) t.throws(_ => fs.lstatSync(resolved)) t.end() } @@ -946,8 +1080,10 @@ t.test('.. paths', t => { new Unpack({ fmode: fmode, cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), - }).on('close', _ => check(t)).end(data) + onwarn: (_c, w, d) => warnings.push([w, d]), + }) + .on('close', _ => check(t)) + .end(data) }) t.test('sync', t => { @@ -955,7 +1091,7 @@ t.test('.. paths', t => { new UnpackSync({ fmode: fmode, cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), + onwarn: (_c, w, d) => warnings.push([w, d]), }).end(data) check(t) }) @@ -967,7 +1103,10 @@ t.test('.. paths', t => { const check = t => { t.same(warnings, []) t.ok(fs.lstatSync(resolved).isFile(), 'is file') - t.equal(fs.lstatSync(resolved).mode & 0o777, isWindows ? 0o666 : fmode) + t.equal( + fs.lstatSync(resolved).mode & 0o777, + isWindows ? 0o666 : fmode, + ) t.end() } @@ -979,8 +1118,10 @@ t.test('.. paths', t => { fmode: fmode, preservePaths: true, cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), - }).on('close', _ => check(t)).end(data) + onwarn: (_c, w, d) => warnings.push([w, d]), + }) + .on('close', _ => check(t)) + .end(data) }) t.test('sync', t => { @@ -989,7 +1130,7 @@ t.test('.. paths', t => { fmode: fmode, preservePaths: true, cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), + onwarn: (_c, w, d) => warnings.push([w, d]), }).end(data) check(t) }) @@ -1004,36 +1145,36 @@ t.test('fail all stats', t => { const poop = new Error('poop') poop.code = 'EPOOP' const dir = normPath(path.join(unpackdir, 'stat-fail')) - const { - stat, - fstat, - lstat, - statSync, - fstatSync, - lstatSync, - } = fs - const unmutate = () => Object.assign(fs, { - stat, - fstat, - lstat, - statSync, - fstatSync, - lstatSync, - }) + const { stat, fstat, lstat, statSync, fstatSync, lstatSync } = fs + const unmutate = () => + Object.assign(fs, { + stat, + fstat, + lstat, + statSync, + fstatSync, + lstatSync, + }) const mutate = () => { - fs.stat = fs.lstat = fs.fstat = (...args) => { - // don't fail statting the cwd, or we get different errors - if (normPath(args[0]) === dir) { - return lstat(dir, args.pop()) - } - process.nextTick(() => args.pop()(poop)) - } - fs.statSync = fs.lstatSync = fs.fstatSync = (...args) => { - if (normPath(args[0]) === dir) { - return lstatSync(dir) - } - throw poop - } + fs.stat = + fs.lstat = + fs.fstat = + (...args) => { + // don't fail statting the cwd, or we get different errors + if (normPath(args[0]) === dir) { + return lstat(dir, args.pop()) + } + process.nextTick(() => args.pop()(poop)) + } + fs.statSync = + fs.lstatSync = + fs.fstatSync = + (...args) => { + if (normPath(args[0]) === dir) { + return lstatSync(dir) + } + throw poop + } } const warnings = [] @@ -1105,8 +1246,10 @@ t.test('fail all stats', t => { ] new Unpack({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), - }).on('close', _ => check(t, expect)).end(data) + onwarn: (_c, w, d) => warnings.push([w, d]), + }) + .on('close', _ => check(t, expect)) + .end(data) }) t.test('sync', t => { @@ -1130,7 +1273,7 @@ t.test('fail all stats', t => { ] new UnpackSync({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), + onwarn: (_c, w, d) => warnings.push([w, d]), }).end(data) check(t, expect) }) @@ -1186,15 +1329,17 @@ t.test('fail symlink', t => { const expect = [['poop', poop]] new Unpack({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), - }).on('close', _ => check(t, expect)).end(data) + onwarn: (_c, w, d) => warnings.push([w, d]), + }) + .on('close', _ => check(t, expect)) + .end(data) }) t.test('sync', t => { const expect = [['poop', poop]] new UnpackSync({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), + onwarn: (_c, w, d) => warnings.push([w, d]), }).end(data) check(t, expect) }) @@ -1249,15 +1394,17 @@ t.test('fail chmod', t => { const expect = [['poop', poop]] new Unpack({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), - }).on('close', _ => check(t, expect)).end(data) + onwarn: (_c, w, d) => warnings.push([w, d]), + }) + .on('close', _ => check(t, expect)) + .end(data) }) t.test('sync', t => { const expect = [['poop', poop]] new UnpackSync({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), + onwarn: (_c, w, d) => warnings.push([w, d]), }).end(data) check(t, expect) }) @@ -1294,14 +1441,16 @@ t.test('fail mkdir', t => { '', ]) - const expect = [[ - 'ENOENT: no such file or directory', - { - code: 'ENOENT', - syscall: 'lstat', - path: normPath(path.resolve(dir, 'dir')), - }, - ]] + const expect = [ + [ + 'ENOENT: no such file or directory', + { + code: 'ENOENT', + syscall: 'lstat', + path: normPath(path.resolve(dir, 'dir')), + }, + ], + ] const check = t => { t.match(warnings, expect) @@ -1312,7 +1461,7 @@ t.test('fail mkdir', t => { t.test('sync', t => { new UnpackSync({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), + onwarn: (_c, w, d) => warnings.push([w, d]), }).end(data) check(t) }) @@ -1320,8 +1469,10 @@ t.test('fail mkdir', t => { t.test('async', t => { new Unpack({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), - }).on('close', _ => check(t)).end(data) + onwarn: (_c, w, d) => warnings.push([w, d]), + }) + .on('close', _ => check(t)) + .end(data) }) t.end() @@ -1368,14 +1519,16 @@ t.test('fail write', t => { t.test('async', t => { new Unpack({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), - }).on('close', _ => check(t)).end(data) + onwarn: (_c, w, d) => warnings.push([w, d]), + }) + .on('close', _ => check(t)) + .end(data) }) t.test('sync', t => { new UnpackSync({ cwd: dir, - onwarn: (c, w, d) => warnings.push([w, d]), + onwarn: (_c, w, d) => warnings.push([w, d]), }).end(data) check(t) }) @@ -1421,7 +1574,9 @@ t.test('skip existing', t => { new Unpack({ cwd: dir, keep: true, - }).on('close', _ => check(t)).end(data) + }) + .on('close', _ => check(t)) + .end(data) }) t.test('sync', t => { @@ -1473,7 +1628,9 @@ t.test('skip newer', t => { new Unpack({ cwd: dir, newer: true, - }).on('close', _ => check(t)).end(data) + }) + .on('close', _ => check(t)) + .end(data) }) t.test('sync', t => { @@ -1537,7 +1694,9 @@ t.test('no mtime', t => { new Unpack({ cwd: dir, noMtime: true, - }).on('close', _ => check(t)).end(data) + }) + .on('close', _ => check(t)) + .end(data) }) t.test('sync', t => { @@ -1563,7 +1722,8 @@ t.test('unpack big enough to pause/drain', t => { }) u.on('ignoredEntry', entry => - t.fail('should not get ignored entry: ' + entry.path)) + t.fail('should not get ignored entry: ' + entry.path), + ) u.on('close', _ => { t.pass('extraction finished') @@ -1584,7 +1744,9 @@ t.test('set owner', t => { const getgid = process.getgid process.getuid = _ => myUid process.getgid = _ => myGid - t.teardown(_ => (process.getuid = getuid, process.getgid = getgid)) + t.teardown( + _ => ((process.getuid = getuid), (process.getgid = getgid)), + ) // can't actually do this because it requires root, but we can // verify that chown gets called. @@ -1688,10 +1850,10 @@ t.test('set owner', t => { mkdirp.sync(dir) t.teardown(_ => rimraf(dir)) let warned = false - const u = new Unpack.Sync({ + const u = new UnpackSync({ cwd: dir, preserveOwner: true, - onwarn: (c, m, er) => { + onwarn: (_c, _m, er) => { if (!warned) { warned = true t.equal(er, poop) @@ -1709,7 +1871,7 @@ t.test('set owner', t => { const u = new Unpack({ cwd: dir, preserveOwner: true, - onwarn: (c, m, er) => { + onwarn: (_c, _m, er) => { if (!warned) { warned = true t.equal(er, poop) @@ -1732,10 +1894,13 @@ t.test('set owner', t => { const fchownSync = fs.fchownSync const lchownSync = fs.lchownSync let called = 0 - fs.fchown = fs.chown = fs.lchown = (path, owner, group, cb) => { - called++ - cb() - } + fs.fchown = + fs.chown = + fs.lchown = + (_path, _owner, _group, cb) => { + called++ + cb() + } fs.chownSync = fs.lchownSync = fs.fchownSync = _ => called++ t.teardown(_ => { @@ -1751,7 +1916,7 @@ t.test('set owner', t => { mkdirp.sync(dir) t.teardown(_ => rimraf(dir)) called = 0 - const u = new Unpack.Sync({ cwd: dir, preserveOwner: true }) + const u = new UnpackSync({ cwd: dir, preserveOwner: true }) u.end(data) t.ok(called >= 5, 'called chowns') t.end() @@ -1797,13 +1962,15 @@ t.test('set owner', t => { t.not(fileStat.gid, 813708013) const dirStat2 = fs.statSync(dir + '/foo/different-uid-nogid') t.not(dirStat2.uid, 2456124561) - const fileStat2 = fs.statSync(dir + '/foo/different-uid-nogid/bar') + const fileStat2 = fs.statSync( + dir + '/foo/different-uid-nogid/bar', + ) t.not(fileStat2.uid, 2456124561) t.end() } t.test('sync', t => { - const u = new Unpack.Sync({ cwd: dir, preserveOwner: false }) + const u = new UnpackSync({ cwd: dir, preserveOwner: false }) u.end(data) check(t) }) @@ -1842,13 +2009,16 @@ t.test('unpack when dir is not writable', t => { t.afterEach(() => rimraf(dir)) const check = t => { - t.equal(fs.statSync(dir + '/a').mode & 0o7777, isWindows ? 0o666 : 0o744) + t.equal( + fs.statSync(dir + '/a').mode & 0o7777, + isWindows ? 0o666 : 0o744, + ) t.equal(fs.readFileSync(dir + '/a/b', 'utf8'), 'a') t.end() } t.test('sync', t => { - const u = new Unpack.Sync({ cwd: dir, strict: true }) + const u = new UnpackSync({ cwd: dir, strict: true }) u.end(data) check(t) }) @@ -1898,7 +2068,7 @@ t.test('transmute chars on windows', t => { }) t.test('sync', t => { - const u = new Unpack.Sync({ + const u = new UnpackSync({ cwd: dir, win32: true, }) @@ -1972,7 +2142,7 @@ t.test('use explicit chmod when required by umask', t => { return t.test('sync', t => { mkdirp.sync(basedir) - const unpack = new Unpack.Sync({ cwd: basedir }) + const unpack = new UnpackSync({ cwd: basedir }) unpack.end(data) check(t) }) @@ -1981,7 +2151,7 @@ t.test('use explicit chmod when required by umask', t => { t.test('dont use explicit chmod if noChmod flag set', t => { process.umask(0o022) const { umask } = process - t.teardown(() => process.umask = umask) + t.teardown(() => (process.umask = umask)) process.umask = () => { throw new Error('should not call process.umask()') } @@ -2014,7 +2184,7 @@ t.test('dont use explicit chmod if noChmod flag set', t => { return t.test('sync', t => { mkdirp.sync(basedir) - const unpack = new Unpack.Sync({ cwd: basedir, noChmod: true }) + const unpack = new UnpackSync({ cwd: basedir, noChmod: true }) unpack.end(data) check(t) }) @@ -2046,18 +2216,24 @@ t.test('chown implicit dirs and also the entries', t => { let chowns = 0 let currentTest = null - fs.lchown = fs.fchown = fs.chown = (path, uid, gid, cb) => { - currentTest.equal(uid, 420, 'chown(' + path + ') uid') - currentTest.equal(gid, 666, 'chown(' + path + ') gid') - chowns++ - cb() - } + fs.lchown = + fs.fchown = + fs.chown = + (path, uid, gid, cb) => { + currentTest.equal(uid, 420, 'chown(' + path + ') uid') + currentTest.equal(gid, 666, 'chown(' + path + ') gid') + chowns++ + cb() + } - fs.lchownSync = fs.chownSync = fs.fchownSync = (path, uid, gid) => { - currentTest.equal(uid, 420, 'chownSync(' + path + ') uid') - currentTest.equal(gid, 666, 'chownSync(' + path + ') gid') - chowns++ - } + fs.lchownSync = + fs.chownSync = + fs.fchownSync = + (path, uid, gid) => { + currentTest.equal(uid, 420, 'chownSync(' + path + ') uid') + currentTest.equal(gid, 666, 'chownSync(' + path + ') gid') + chowns++ + } const data = makeTar([ { @@ -2091,29 +2267,49 @@ t.test('chown implicit dirs and also the entries', t => { } t.test('throws when setting uid/gid improperly', t => { - t.throws(_ => new Unpack({ uid: 420 }), - TypeError('cannot set owner without number uid and gid')) - t.throws(_ => new Unpack({ gid: 666 }), - TypeError('cannot set owner without number uid and gid')) - t.throws(_ => new Unpack({ uid: 1, gid: 2, preserveOwner: true }), - TypeError('cannot preserve owner in archive and also set owner explicitly')) + t.throws( + _ => new Unpack({ uid: 420 }), + TypeError('cannot set owner without number uid and gid'), + ) + t.throws( + _ => new Unpack({ gid: 666 }), + TypeError('cannot set owner without number uid and gid'), + ) + t.throws( + _ => new Unpack({ uid: 1, gid: 2, preserveOwner: true }), + TypeError( + 'cannot preserve owner in archive and also set owner explicitly', + ), + ) t.end() }) const tests = () => - t.test('async', t => { - currentTest = t - mkdirp.sync(basedir) - const unpack = new Unpack({ cwd: basedir, uid: 420, gid: 666 }) - unpack.on('close', _ => check(t)) - unpack.end(data) - }).then(t.test('sync', t => { - currentTest = t - mkdirp.sync(basedir) - const unpack = new Unpack.Sync({ cwd: basedir, uid: 420, gid: 666 }) - unpack.end(data) - check(t) - })) + t + .test('async', t => { + currentTest = t + mkdirp.sync(basedir) + const unpack = new Unpack({ + cwd: basedir, + uid: 420, + gid: 666, + }) + unpack.on('close', _ => check(t)) + unpack.end(data) + }) + .then( + t.test('sync', t => { + currentTest = t + mkdirp.sync(basedir) + const unpack = new UnpackSync({ + cwd: basedir, + uid: 420, + gid: 666, + }) + unpack.end(data) + check(t) + }), + ) tests() @@ -2158,64 +2354,72 @@ t.test('bad cwd setting', t => { fs.writeFileSync(basedir + '/file', 'xyz') - cases.forEach(c => t.test(c.type + ' ' + c.path, t => { - const data = makeTar([ - { - path: c.path, - mode: 0o775, - type: c.type, - size: 0, - uid: null, - gid: null, - }, - '', - '', - ]) - - t.test('cwd is a file', t => { - const cwd = basedir + '/file' - const opt = { cwd: cwd } + cases.forEach(c => + t.test(c.type + ' ' + c.path, t => { + const data = makeTar([ + { + path: c.path, + mode: 0o775, + type: c.type, + size: 0, + uid: null, + gid: null, + }, + '', + '', + ]) - t.throws(_ => new Unpack.Sync(opt).end(data), { - name: 'CwdError', - message: 'ENOTDIR: Cannot cd into \'' + normPath(cwd) + '\'', - path: normPath(cwd), - code: 'ENOTDIR', - }) + t.test('cwd is a file', t => { + const cwd = basedir + '/file' + const opt = { cwd: cwd } - new Unpack(opt).on('error', er => { - t.match(er, { + t.throws(_ => new UnpackSync(opt).end(data), { name: 'CwdError', - message: 'ENOTDIR: Cannot cd into \'' + normPath(cwd) + '\'', + message: "ENOTDIR: Cannot cd into '" + normPath(cwd) + "'", path: normPath(cwd), code: 'ENOTDIR', }) - t.end() - }).end(data) - }) - - return t.test('cwd is missing', t => { - const cwd = basedir + '/asdf/asdf/asdf' - const opt = { cwd: cwd } - t.throws(_ => new Unpack.Sync(opt).end(data), { - name: 'CwdError', - message: 'ENOENT: Cannot cd into \'' + normPath(cwd) + '\'', - path: normPath(cwd), - code: 'ENOENT', + new Unpack(opt) + .on('error', er => { + t.match(er, { + name: 'CwdError', + message: + "ENOTDIR: Cannot cd into '" + normPath(cwd) + "'", + path: normPath(cwd), + code: 'ENOTDIR', + }) + t.end() + }) + .end(data) }) - new Unpack(opt).on('error', er => { - t.match(er, { + return t.test('cwd is missing', t => { + const cwd = basedir + '/asdf/asdf/asdf' + const opt = { cwd: cwd } + + t.throws(_ => new UnpackSync(opt).end(data), { name: 'CwdError', - message: 'ENOENT: Cannot cd into \'' + normPath(cwd) + '\'', + message: "ENOENT: Cannot cd into '" + normPath(cwd) + "'", path: normPath(cwd), code: 'ENOENT', }) - t.end() - }).end(data) - }) - })) + + new Unpack(opt) + .on('error', er => { + t.match(er, { + name: 'CwdError', + message: + "ENOENT: Cannot cd into '" + normPath(cwd) + "'", + path: normPath(cwd), + code: 'ENOENT', + }) + t.end() + }) + .end(data) + }) + }), + ) t.end() }) @@ -2238,7 +2442,8 @@ t.test('transform', t => { 'utf8.tar': { '🌟.txt': '🌟✧✩⭐︎✪✫✬✭✮⚝✯✰✵✶✷✸✹❂⭑⭒★☆✡☪✴︎✦✡️🔯✴️🌠\n', 'Ω.txt': '[Ω]', - 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt': '[Ω]', + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt': + '[Ω]', }, } @@ -2256,8 +2461,12 @@ t.test('transform', t => { } class Bracer extends Minipass { - write (data) { - const d = data.toString().split('').map(c => '[' + c + ']').join('') + write(data) { + const d = data + .toString() + .split('') + .map(c => '[' + c + ']') + .join('') return super.write(d) } } @@ -2289,7 +2498,11 @@ t.test('transform', t => { t.test('async unpack', t => { t.plan(2) t.test('strict', t => { - const unpack = new Unpack({ cwd: dir, strict: true, transform: txFn }) + const unpack = new Unpack({ + cwd: dir, + strict: true, + transform: txFn, + }) fs.createReadStream(tf).pipe(unpack) eos(unpack, _ => check(t)) }) @@ -2303,7 +2516,11 @@ t.test('transform', t => { t.test('sync unpack', t => { t.plan(2) t.test('strict', t => { - const unpack = new UnpackSync({ cwd: dir, strict: true, transform: txFn }) + const unpack = new UnpackSync({ + cwd: dir, + strict: true, + transform: txFn, + }) unpack.end(fs.readFileSync(tf)) check(t) }) @@ -2335,7 +2552,11 @@ t.test('transform error', t => { t.test('sync unpack', t => { t.test('strict', t => { - const unpack = new UnpackSync({ cwd: dir, strict: true, transform: txFn }) + const unpack = new UnpackSync({ + cwd: dir, + strict: true, + transform: txFn, + }) const expect = 3 let actual = 0 unpack.on('error', er => { @@ -2350,7 +2571,7 @@ t.test('transform error', t => { const unpack = new UnpackSync({ cwd: dir, transform: txFn }) const expect = 3 let actual = 0 - unpack.on('warn', (code, msg, er) => { + unpack.on('warn', (_code, _msg, er) => { t.equal(er, poop) actual++ }) @@ -2363,7 +2584,11 @@ t.test('transform error', t => { t.test('async unpack', t => { // the last error is about the folder being deleted, just ignore that one t.test('strict', t => { - const unpack = new Unpack({ cwd: dir, strict: true, transform: txFn }) + const unpack = new Unpack({ + cwd: dir, + strict: true, + transform: txFn, + }) t.plan(3) t.teardown(() => { unpack.removeAllListeners('error') @@ -2376,7 +2601,7 @@ t.test('transform error', t => { const unpack = new Unpack({ cwd: dir, transform: txFn }) t.plan(3) t.teardown(() => unpack.removeAllListeners('warn')) - unpack.on('warn', (code, msg, er) => t.equal(er, poop)) + unpack.on('warn', (_code, _msg, er) => t.equal(er, poop)) unpack.end(tardata) }) t.end() @@ -2413,13 +2638,17 @@ t.test('futimes/fchown failures', t => { t.test('async unpack', t => { t.plan(2) t.test('strict', t => { - const unpack = new Unpack({ cwd: dir, strict: true, forceChown: fc }) - unpack.on('finish', t.end) + const unpack = new Unpack({ + cwd: dir, + strict: true, + forceChown: fc, + }) + unpack.on('finish', () => t.end()) unpack.end(tardata) }) t.test('loose', t => { const unpack = new Unpack({ cwd: dir, forceChown: fc }) - unpack.on('finish', t.end) + unpack.on('finish', () => t.end()) unpack.on('warn', t.fail) unpack.end(tardata) }) @@ -2427,12 +2656,16 @@ t.test('futimes/fchown failures', t => { t.test('sync unpack', t => { t.plan(2) t.test('strict', t => { - const unpack = new Unpack.Sync({ cwd: dir, strict: true, forceChown: fc }) + const unpack = new UnpackSync({ + cwd: dir, + strict: true, + forceChown: fc, + }) unpack.end(tardata) t.end() }) t.test('loose', t => { - const unpack = new Unpack.Sync({ cwd: dir, forceChown: fc }) + const unpack = new UnpackSync({ cwd: dir, forceChown: fc }) unpack.on('warn', t.fail) unpack.end(tardata) t.end() @@ -2451,7 +2684,11 @@ t.test('futimes/fchown failures', t => { t.test('async unpack', t => { t.plan(2) t.test('strict', t => { - const unpack = new Unpack({ cwd: dir, strict: true, forceChown: fc }) + const unpack = new Unpack({ + cwd: dir, + strict: true, + forceChown: fc, + }) t.plan(3) unpack.on('error', er => t.equal(er, poop)) unpack.end(tardata) @@ -2459,22 +2696,26 @@ t.test('futimes/fchown failures', t => { t.test('loose', t => { const unpack = new Unpack({ cwd: dir, forceChown: fc }) t.plan(3) - unpack.on('warn', (code, m, er) => t.equal(er, poop)) + unpack.on('warn', (_code, _m, er) => t.equal(er, poop)) unpack.end(tardata) }) }) t.test('sync unpack', t => { t.plan(2) t.test('strict', t => { - const unpack = new Unpack.Sync({ cwd: dir, strict: true, forceChown: fc }) + const unpack = new UnpackSync({ + cwd: dir, + strict: true, + forceChown: fc, + }) t.plan(3) unpack.on('error', er => t.equal(er, poop)) unpack.end(tardata) }) t.test('loose', t => { - const unpack = new Unpack.Sync({ cwd: dir, forceChown: fc }) + const unpack = new UnpackSync({ cwd: dir, forceChown: fc }) t.plan(3) - unpack.on('warn', (c, m, er) => t.equal(er, poop)) + unpack.on('warn', (_c, _m, er) => t.equal(er, poop)) unpack.end(tardata) }) }) @@ -2490,7 +2731,7 @@ t.test('onentry option is preserved', t => { t.teardown(() => rimraf(basedir)) let oecalls = 0 - const onentry = entry => oecalls++ + const onentry = _entry => oecalls++ const data = makeTar([ { path: 'd/i', @@ -2581,7 +2822,11 @@ t.test('do not reuse hardlinks, only nlink=1 files', t => { const check = t => { for (const f in checks) { - t.equal(fs.readFileSync(basedir + '/' + f, 'utf8'), checks[f], f) + t.equal( + fs.readFileSync(basedir + '/' + f, 'utf8'), + checks[f], + f, + ) t.equal(fs.statSync(basedir + '/' + f).nlink, 1, f) } t.end() @@ -2623,10 +2868,15 @@ t.test('trying to unpack a non-zlib gzip file should fail', t => { new Unpack(opts) .once('error', er => t.match(er, expect, 'async emits')) .end(dataGzip) - const skip = !/^v([0-9]|1[0-3])\./.test(process.version) ? false + const skip = !/^v([0-9]|1[0-3])\./.test(process.version) + ? false : 'node prior to v14 did not raise sync zlib errors properly' - t.throws(() => new UnpackSync(opts).end(dataGzip), - expect, 'sync throws', { skip }) + t.throws( + () => new UnpackSync(opts).end(dataGzip), + expect, + 'sync throws', + { skip }, + ) }) t.test('bad archive if no gzip', t => { @@ -2639,7 +2889,11 @@ t.test('trying to unpack a non-zlib gzip file should fail', t => { new Unpack(opts) .on('error', er => t.match(er, expect, 'async emits')) .end(data) - t.throws(() => new UnpackSync(opts).end(data), expect, 'sync throws') + t.throws( + () => new UnpackSync(opts).end(data), + expect, + 'sync throws', + ) }) t.end() @@ -2650,7 +2904,7 @@ t.test('handle errors on fs.close', t => { const { close, closeSync } = fs // have to actually close them, or else windows gets mad fs.close = (fd, cb) => close(fd, () => cb(poop)) - fs.closeSync = (fd) => { + fs.closeSync = fd => { closeSync(fd) throw poop } @@ -2676,65 +2930,77 @@ t.test('handle errors on fs.close', t => { new Unpack({ cwd: dir + '/async', strict: true }) .on('error', er => t.equal(er, poop, 'async')) .end(data) - t.throws(() => new UnpackSync({ - cwd: normPath(dir + '/sync'), strict: true, - }).end(data), poop, 'sync') + t.throws( + () => + new UnpackSync({ + cwd: normPath(dir + '/sync'), + strict: true, + }).end(data), + poop, + 'sync', + ) }) -t.test('drop entry from dirCache if no longer a directory', { - skip: isWindows && 'symlinks not fully supported', -}, t => { - const dir = path.resolve(unpackdir, 'dir-cache-error') - mkdirp.sync(dir + '/sync/y') - mkdirp.sync(dir + '/async/y') - const data = makeTar([ - { - path: 'x', - type: 'Directory', - }, - { - path: 'x', - type: 'SymbolicLink', - linkpath: './y', - }, - { - path: 'x/ginkoid', - type: 'File', - size: 'ginkoid'.length, - }, - 'ginkoid', - '', - '', - ]) - t.plan(2) - const WARNINGS = {} - const check = (t, path) => { - t.equal(fs.statSync(path + '/x').isDirectory(), true) - t.equal(fs.lstatSync(path + '/x').isSymbolicLink(), true) - t.equal(fs.statSync(path + '/y').isDirectory(), true) - t.strictSame(fs.readdirSync(path + '/y'), []) - t.throws(() => fs.readFileSync(path + '/x/ginkoid'), { code: 'ENOENT' }) - t.strictSame(WARNINGS[path], [ - 'TAR_ENTRY_ERROR', - 'Cannot extract through symbolic link', +t.test( + 'drop entry from dirCache if no longer a directory', + { + skip: isWindows && 'symlinks not fully supported', + }, + t => { + const dir = path.resolve(unpackdir, 'dir-cache-error') + mkdirp.sync(dir + '/sync/y') + mkdirp.sync(dir + '/async/y') + const data = makeTar([ + { + path: 'x', + type: 'Directory', + }, + { + path: 'x', + type: 'SymbolicLink', + linkpath: './y', + }, + { + path: 'x/ginkoid', + type: 'File', + size: 'ginkoid'.length, + }, + 'ginkoid', + '', + '', ]) - t.end() - } - t.test('async', t => { - const path = dir + '/async' - new Unpack({ cwd: path }) - .on('warn', (code, msg) => WARNINGS[path] = [code, msg]) - .on('end', () => check(t, path)) - .end(data) - }) - t.test('sync', t => { - const path = dir + '/sync' - new UnpackSync({ cwd: path }) - .on('warn', (code, msg) => WARNINGS[path] = [code, msg]) - .end(data) - check(t, path) - }) -}) + t.plan(2) + const WARNINGS = {} + const check = (t, path) => { + t.equal(fs.statSync(path + '/x').isDirectory(), true) + t.equal(fs.lstatSync(path + '/x').isSymbolicLink(), true) + t.equal(fs.statSync(path + '/y').isDirectory(), true) + t.strictSame(fs.readdirSync(path + '/y'), []) + t.throws(() => fs.readFileSync(path + '/x/ginkoid'), { + code: 'ENOENT', + }) + t.strictSame(WARNINGS[path], [ + 'TAR_ENTRY_ERROR', + 'TAR_SYMLINK_ERROR: Cannot extract through symbolic link', + ]) + t.end() + } + t.test('async', t => { + const path = dir + '/async' + new Unpack({ cwd: path }) + .on('warn', (code, msg) => (WARNINGS[path] = [code, msg])) + .on('end', () => check(t, path)) + .end(data) + }) + t.test('sync', t => { + const path = dir + '/sync' + new UnpackSync({ cwd: path }) + .on('warn', (code, msg) => (WARNINGS[path] = [code, msg])) + .end(data) + check(t, path) + }) + }, +) t.test('using strip option when top level file exists', t => { const dir = path.resolve(unpackdir, 'strip-with-top-file') @@ -2792,7 +3058,8 @@ t.test('using strip option when top level file exists', t => { t.test('handle EPERMs when creating symlinks', t => { // https://github.com/npm/node-tar/issues/265 - const msg = 'You do not have sufficient privilege to perform this operation.' + const msg = + 'You do not have sufficient privilege to perform this operation.' const er = Object.assign(new Error(msg), { code: 'EPERM', }) @@ -2838,11 +3105,15 @@ t.test('handle EPERMs when creating symlinks', t => { mkdirp.sync(`${dir}/async`) const check = path => { - t.match(WARNINGS, [ - ['TAR_ENTRY_ERROR', msg], - ['TAR_ENTRY_ERROR', msg], - ['TAR_ENTRY_ERROR', msg], - ], 'got expected warnings') + t.match( + WARNINGS, + [ + ['TAR_ENTRY_ERROR', msg], + ['TAR_ENTRY_ERROR', msg], + ['TAR_ENTRY_ERROR', msg], + ], + 'got expected warnings', + ) t.equal(WARNINGS.length, 3) WARNINGS.length = 0 t.equal(fs.readFileSync(`${path}/x/y`, 'utf8'), 'hello, world') @@ -2855,13 +3126,13 @@ t.test('handle EPERMs when creating symlinks', t => { const WARNINGS = [] const u = new Unpack({ cwd: `${dir}/async`, - onwarn: (code, msg, er) => WARNINGS.push([code, msg]), + onwarn: (code, msg, _er) => WARNINGS.push([code, msg]), }) u.on('end', () => { check(`${dir}/async`) const u = new UnpackSync({ cwd: `${dir}/sync`, - onwarn: (code, msg, er) => WARNINGS.push([code, msg]), + onwarn: (code, msg, _er) => WARNINGS.push([code, msg]), }) u.end(data) check(`${dir}/sync`) @@ -2888,8 +3159,8 @@ t.test('close fd when error writing', t => { t.teardown(mutateFS.fail('write', new Error('nope'))) const CLOSES = [] const OPENS = {} - const { open } = require('fs') - t.teardown(() => fs.open = open) + const { open } = fs + t.teardown(() => (fs.open = open)) fs.open = (...args) => { const cb = args.pop() args.push((er, fd) => { @@ -2898,10 +3169,12 @@ t.test('close fd when error writing', t => { }) return open.call(fs, ...args) } - t.teardown(mutateFS.mutateArgs('close', ([fd]) => { - CLOSES.push(fd) - return [fd] - })) + t.teardown( + mutateFS.mutateArgs('close', ([fd]) => { + CLOSES.push(fd) + return [fd] + }), + ) const WARNINGS = [] const dir = path.resolve(unpackdir, 'close-on-write-error') mkdirp.sync(dir) @@ -2941,8 +3214,8 @@ t.test('close fd when error setting mtime', t => { t.teardown(mutateFS.fail('utimes', new Error('nooooope'))) const CLOSES = [] const OPENS = {} - const { open } = require('fs') - t.teardown(() => fs.open = open) + const { open } = fs + t.teardown(() => (fs.open = open)) fs.open = (...args) => { const cb = args.pop() args.push((er, fd) => { @@ -2951,10 +3224,12 @@ t.test('close fd when error setting mtime', t => { }) return open.call(fs, ...args) } - t.teardown(mutateFS.mutateArgs('close', ([fd]) => { - CLOSES.push(fd) - return [fd] - })) + t.teardown( + mutateFS.mutateArgs('close', ([fd]) => { + CLOSES.push(fd) + return [fd] + }), + ) const WARNINGS = [] const dir = path.resolve(unpackdir, 'close-on-futimes-error') mkdirp.sync(dir) @@ -2987,7 +3262,10 @@ t.test('do not hang on large files that fail to open()', t => { '', ]) t.teardown(mutateFS.fail('open', new Error('nope'))) - const dir = path.resolve(unpackdir, 'no-hang-for-large-file-failures') + const dir = path.resolve( + unpackdir, + 'no-hang-for-large-file-failures', + ) mkdirp.sync(dir) const WARNINGS = [] const unpack = new Unpack({ @@ -2998,11 +3276,11 @@ t.test('do not hang on large files that fail to open()', t => { t.strictSame(WARNINGS, [['TAR_ENTRY_ERROR', 'nope']]) t.end() }) - unpack.write(data.slice(0, 2048)) + unpack.write(data.subarray(0, 2048)) setTimeout(() => { - unpack.write(data.slice(2048, 4096)) + unpack.write(data.subarray(2048, 4096)) setTimeout(() => { - unpack.write(data.slice(4096)) + unpack.write(data.subarray(4096)) setTimeout(() => { unpack.end() }) @@ -3010,165 +3288,178 @@ t.test('do not hang on large files that fail to open()', t => { }) }) -t.test('dirCache pruning unicode normalized collisions', { - skip: isWindows && 'symlinks not fully supported', -}, t => { - const data = makeTar([ - { - type: 'Directory', - path: 'foo', - }, - { - type: 'File', - path: 'foo/bar', - size: 1, - }, - 'x', - { - type: 'Directory', - // café - path: Buffer.from([0x63, 0x61, 0x66, 0xc3, 0xa9]).toString(), - }, - { - type: 'SymbolicLink', - // cafe with a ` - path: Buffer.from([0x63, 0x61, 0x66, 0x65, 0xcc, 0x81]).toString(), - linkpath: 'foo', - }, - { - type: 'Directory', - path: 'foo', - }, - { - type: 'File', - path: Buffer.from([0x63, 0x61, 0x66, 0xc3, 0xa9]).toString() + '/bar', - size: 1, - }, - 'y', - '', - '', - ]) - - const check = (path, dirCache, t) => { - path = path.replace(/\\/g, '/') - t.strictSame([...dirCache.entries()][0], [`${path}/foo`, true]) - t.equal(fs.readFileSync(path + '/foo/bar', 'utf8'), 'x') - t.end() - } - - t.test('sync', t => { - const path = t.testdir() - const dirCache = new Map() - new UnpackSync({ cwd: path, dirCache }).end(data) - check(path, dirCache, t) - }) - t.test('async', t => { - const path = t.testdir() - const dirCache = new Map() - new Unpack({ cwd: path, dirCache }) - .on('close', () => check(path, dirCache, t)) - .end(data) - }) +t.test( + 'dirCache pruning unicode normalized collisions', + { + skip: isWindows && 'symlinks not fully supported', + }, + t => { + const data = makeTar([ + { + type: 'Directory', + path: 'foo', + }, + { + type: 'File', + path: 'foo/bar', + size: 1, + }, + 'x', + { + type: 'Directory', + // café + path: Buffer.from([0x63, 0x61, 0x66, 0xc3, 0xa9]).toString(), + }, + { + type: 'SymbolicLink', + // cafe with a ` + path: Buffer.from([ + 0x63, 0x61, 0x66, 0x65, 0xcc, 0x81, + ]).toString(), + linkpath: 'foo', + }, + { + type: 'Directory', + path: 'foo', + }, + { + type: 'File', + path: + Buffer.from([0x63, 0x61, 0x66, 0xc3, 0xa9]).toString() + + '/bar', + size: 1, + }, + 'y', + '', + '', + ]) - t.end() -}) + const check = (path, dirCache, t) => { + path = path.replace(/\\/g, '/') + t.strictSame([...dirCache.entries()][0], [`${path}/foo`, true]) + t.equal(fs.readFileSync(path + '/foo/bar', 'utf8'), 'x') + t.end() + } -t.test('dircache prune all on windows when symlink encountered', t => { - if (process.platform !== 'win32') { - process.env.TESTING_TAR_FAKE_PLATFORM = 'win32' - t.teardown(() => { - delete process.env.TESTING_TAR_FAKE_PLATFORM + t.test('sync', t => { + const path = t.testdir() + const dirCache = new Map() + new UnpackSync({ cwd: path, dirCache }).end(data) + check(path, dirCache, t) + }) + t.test('async', t => { + const path = t.testdir() + const dirCache = new Map() + new Unpack({ cwd: path, dirCache }) + .on('close', () => check(path, dirCache, t)) + .end(data) }) - } - const symlinks = [] - const Unpack = t.mock('../lib/unpack.js', { - fs: { - ...fs, - symlink: (target, dest, cb) => { - symlinks.push(['async', target, dest]) - process.nextTick(cb) - }, - symlinkSync: (target, dest) => symlinks.push(['sync', target, dest]), - }, - }) - const UnpackSync = Unpack.Sync - const data = makeTar([ - { - type: 'Directory', - path: 'foo', - }, - { - type: 'File', - path: 'foo/bar', - size: 1, - }, - 'x', - { - type: 'Directory', - // café - path: Buffer.from([0x63, 0x61, 0x66, 0xc3, 0xa9]).toString(), - }, - { - type: 'SymbolicLink', - // cafe with a ` - path: Buffer.from([0x63, 0x61, 0x66, 0x65, 0xcc, 0x81]).toString(), - linkpath: 'safe/actually/but/cannot/be/too/careful', - }, - { - type: 'File', - path: 'bar/baz', - size: 1, - }, - 'z', - '', - '', - ]) + t.end() + }, +) + +t.test( + 'dircache prune all on windows when symlink encountered', + async t => { + if (process.platform !== 'win32') { + process.env.TESTING_TAR_FAKE_PLATFORM = 'win32' + t.teardown(() => { + delete process.env.TESTING_TAR_FAKE_PLATFORM + }) + } + const symlinks = [] + const { Unpack } = await t.mockImport('../dist/esm/unpack.js', { + fs: { + ...fs, + symlink: (target, dest, cb) => { + symlinks.push(['async', target, dest]) + process.nextTick(cb) + }, + symlinkSync: (target, dest) => + symlinks.push(['sync', target, dest]), + }, + }) - const check = (path, dirCache, t) => { - // symlink blew away all dirCache entries before it - path = path.replace(/\\/g, '/') - t.strictSame([...dirCache.entries()], [ - [`${path}/bar`, true], + const data = makeTar([ + { + type: 'Directory', + path: 'foo', + }, + { + type: 'File', + path: 'foo/bar', + size: 1, + }, + 'x', + { + type: 'Directory', + // café + path: Buffer.from([0x63, 0x61, 0x66, 0xc3, 0xa9]).toString(), + }, + { + type: 'SymbolicLink', + // cafe with a ` + path: Buffer.from([ + 0x63, 0x61, 0x66, 0x65, 0xcc, 0x81, + ]).toString(), + linkpath: 'safe/actually/but/cannot/be/too/careful', + }, + { + type: 'File', + path: 'bar/baz', + size: 1, + }, + 'z', + '', + '', ]) - t.equal(fs.readFileSync(`${path}/foo/bar`, 'utf8'), 'x') - t.equal(fs.readFileSync(`${path}/bar/baz`, 'utf8'), 'z') - t.end() - } - t.test('sync', t => { - const path = t.testdir() - const dirCache = new Map() - new UnpackSync({ cwd: path, dirCache }).end(data) - check(path, dirCache, t) - }) + const check = (path, dirCache, t) => { + // symlink blew away all dirCache entries before it + path = path.replace(/\\/g, '/') + t.strictSame([...dirCache.entries()], [[`${path}/bar`, true]]) + t.equal(fs.readFileSync(`${path}/foo/bar`, 'utf8'), 'x') + t.equal(fs.readFileSync(`${path}/bar/baz`, 'utf8'), 'z') + t.end() + } - t.test('async', t => { - const path = t.testdir() - const dirCache = new Map() - new Unpack({ cwd: path, dirCache }) - .on('close', () => check(path, dirCache, t)) - .end(data) - }) + t.test('sync', t => { + const path = t.testdir() + const dirCache = new Map() + new UnpackSync({ cwd: path, dirCache }).end(data) + check(path, dirCache, t) + }) - t.end() -}) + t.test('async', t => { + const path = t.testdir() + const dirCache = new Map() + new Unpack({ cwd: path, dirCache }) + .on('close', () => check(path, dirCache, t)) + .end(data) + }) -t.test('recognize C:.. as a dot path part', t => { + t.end() + }, +) + +t.test('recognize C:.. as a dot path part', async t => { if (process.platform !== 'win32') { process.env.TESTING_TAR_FAKE_PLATFORM = 'win32' t.teardown(() => { delete process.env.TESTING_TAR_FAKE_PLATFORM }) } - const Unpack = t.mock('../lib/unpack.js', { - path: { - ...path.win32, - win32: path.win32, - posix: path.posix, + const { Unpack, UnpackSync } = await t.mockImport( + '../dist/esm/unpack.js', + { + path: { + ...path.win32, + win32: path.win32, + posix: path.posix, + }, }, - }) - const UnpackSync = Unpack.Sync + ) const data = makeTar([ { @@ -3202,7 +3493,12 @@ t.test('recognize C:.. as a dot path part', t => { 'C:../x/y/z', 'C:../x/y/z', ], - ['TAR_ENTRY_ERROR', "path contains '..'", 'x:../y/z', 'x:../y/z'], + [ + 'TAR_ENTRY_ERROR', + "path contains '..'", + 'x:../y/z', + 'x:../y/z', + ], [ 'TAR_ENTRY_INFO', 'stripping Y: from absolute path', @@ -3218,7 +3514,8 @@ t.test('recognize C:.. as a dot path part', t => { const path = t.testdir() new Unpack({ cwd: path, - onwarn: (c, w, { entry, path }) => warnings.push([c, w, path, entry.path]), + onwarn: (c, w, { entry, path }) => + warnings.push([c, w, path, entry.path]), }) .on('close', () => check(path, warnings, t)) .end(data) @@ -3229,7 +3526,8 @@ t.test('recognize C:.. as a dot path part', t => { const path = t.testdir() new UnpackSync({ cwd: path, - onwarn: (c, w, { entry, path }) => warnings.push([c, w, path, entry.path]), + onwarn: (c, w, { entry, path }) => + warnings.push([c, w, path, entry.path]), }).end(data) check(path, warnings, t) }) @@ -3246,15 +3544,16 @@ t.test('excessively deep subfolder nesting', async t => { const check = (t, maxDepth = 1024) => { t.match(warnings, [ - ['TAR_ENTRY_ERROR', + [ + 'TAR_ENTRY_ERROR', 'path excessively deep', { entry: ReadEntry, path: /^\.(\/a){1024,}\/foo.txt$/, depth: 222372, maxDepth, - } - ] + }, + ], ]) warnings.length = 0 t.end() @@ -3264,15 +3563,17 @@ t.test('excessively deep subfolder nesting', async t => { const cwd = t.testdir() new Unpack({ cwd, - onwarn - }).on('end', () => check(t)).end(data) + onwarn, + }) + .on('end', () => check(t)) + .end(data) }) t.test('sync', t => { const cwd = t.testdir() new UnpackSync({ cwd, - onwarn + onwarn, }).end(data) check(t) }) @@ -3283,7 +3584,9 @@ t.test('excessively deep subfolder nesting', async t => { cwd, onwarn, maxDepth: 64, - }).on('end', () => check(t, 64)).end(data) + }) + .on('end', () => check(t, 64)) + .end(data) }) t.test('sync set md', t => { diff --git a/test/update.js b/test/update.js index 7034a165..9fb57b6f 100644 --- a/test/update.js +++ b/test/update.js @@ -1,24 +1,27 @@ -'use strict' -const t = require('tap') -const u = require('../lib/update.js') -const path = require('path') -const fs = require('fs') -const mutateFS = require('mutate-fs') - -const { resolve } = require('path') +import t from 'tap' +import { update as u } from '../dist/esm/update.js' + +import path, {dirname} from 'path' +import fs from 'fs' +import mutateFS from 'mutate-fs' + +import { resolve } from 'path' +import {fileURLToPath} from 'url' +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const fixtures = path.resolve(__dirname, 'fixtures') const tars = path.resolve(fixtures, 'tars') -const zlib = require('zlib') +import zlib from 'zlib' +import { spawn } from 'child_process' -const spawn = require('child_process').spawn const data = fs.readFileSync(tars + '/body-byte-counts.tar') -const dataNoNulls = data.slice(0, data.length - 1024) +const dataNoNulls = data.subarray(0, data.length - 1024) const fixtureDef = { 'body-byte-counts.tar': data, 'no-null-eof.tar': dataNoNulls, - 'truncated-head.tar': Buffer.concat([dataNoNulls, data.slice(0, 500)]), - 'truncated-body.tar': Buffer.concat([dataNoNulls, data.slice(0, 700)]), + 'truncated-head.tar': Buffer.concat([dataNoNulls, data.subarray(0, 500)]), + 'truncated-body.tar': Buffer.concat([dataNoNulls, data.subarray(0, 700)]), 'zero.tar': Buffer.from(''), 'empty.tar': Buffer.alloc(512), 'compressed.tgz': zlib.gzipSync(data), diff --git a/test/warn-mixin.js b/test/warn-method.js similarity index 81% rename from test/warn-mixin.js rename to test/warn-method.js index 36350e47..4d040f42 100644 --- a/test/warn-mixin.js +++ b/test/warn-method.js @@ -1,8 +1,13 @@ -const t = require('tap') -const EE = require('events').EventEmitter -const warner = require('../lib/warn-mixin.js') +import t from 'tap' +import EE from 'events' +import { warnMethod } from '../dist/esm/warn-method.js' + +class Warner extends EE { + warn(code, message, data = {}) { + return warnMethod(this, code, message, data) + } +} -const Warner = warner(EE) const w = new Warner() diff --git a/test/winchars.js b/test/winchars.js index 120c581d..b1ffe12c 100644 --- a/test/winchars.js +++ b/test/winchars.js @@ -1,6 +1,5 @@ -'use strict' -const t = require('tap') -const wc = require('../lib/winchars.js') +import t from 'tap' +import * as wc from '../dist/esm/winchars.js' t.equal(wc.encode('<>'), '\uf03c\uf03e', 'encode') t.equal(wc.decode(wc.encode('<>')), '<>', 'decode') diff --git a/test/write-entry.js b/test/write-entry.js index b72e53a1..27bd364c 100644 --- a/test/write-entry.js +++ b/test/write-entry.js @@ -1,9 +1,27 @@ -'use strict' -const t = require('tap') -const mkdirp = require('mkdirp') +import t from 'tap' +import { mkdirp } from 'mkdirp' +import fs from 'fs' +import { ReadEntry } from '../dist/esm/read-entry.js' +import { makeTar } from './fixtures/make-tar.js' +import { + WriteEntry, + WriteEntrySync, + WriteEntryTar, +} from '../dist/esm/write-entry.js' +import path, { dirname } from 'path' +import { Header } from '../dist/esm/header.js' +import mutateFS from 'mutate-fs' +import { Parser } from '../dist/esm/parse.js' +import { rimraf } from 'rimraf' +import { normalizeWindowsPath as normPath } from '../dist/esm/normalize-windows-path.js' +import { fileURLToPath } from 'url' + +const { default: chmodr } = await import('chmodr') + +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) // make our tests verify that windows link targets get turned into / paths -const fs = require('fs') const { readlink, readlinkSync } = fs fs.readlink = (path, cb) => { readlink(path, (er, path) => { @@ -16,20 +34,10 @@ fs.readlink = (path, cb) => { } fs.readlinkSync = path => readlinkSync(path).replace(/\//g, '\\') -const ReadEntry = require('../lib/read-entry.js') -const makeTar = require('./make-tar.js') -const WriteEntry = require('../lib/write-entry.js') -const path = require('path') const fixtures = path.resolve(__dirname, 'fixtures') const files = path.resolve(fixtures, 'files') -const Header = require('../lib/header.js') -const mutateFS = require('mutate-fs') process.env.USER = 'isaacs' -const chmodr = require('chmodr') -const Parser = require('../lib/parse.js') -const rimraf = require('rimraf') const isWindows = process.platform === 'win32' -const normPath = require('../lib/normalize-windows-path.js') t.test('set up', t => { const one = fs.statSync(files + '/hardlink-1') @@ -49,7 +57,8 @@ t.test('100 byte filename', t => { t.plan(2) const runTest = t => { - const f = '100-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' + const f = + '100-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' const ws = new WriteEntry(f, { cwd: files, linkCache: linkCache, @@ -75,7 +84,7 @@ t.test('100 byte filename', t => { }, }) - const wss = new WriteEntry.Sync(f, { + const wss = new WriteEntrySync(f, { cwd: files, linkCache: linkCache, statCache: statCache, @@ -83,8 +92,10 @@ t.test('100 byte filename', t => { linkCache = ws.linkCache statCache = ws.statCache - t.equal(out.slice(512).toString('hex'), - wss.read().slice(512).toString('hex')) + t.equal( + out.slice(512).toString('hex'), + wss.read().subarray(512).toString('hex'), + ) t.equal(out.length, 1024) t.equal(out.slice(0, 100).toString(), f) @@ -102,23 +113,25 @@ t.test('100 byte filename', t => { devmin: 0, }) - t.equal(out.slice(512).toString('hex'), + t.equal( + out.slice(512).toString('hex'), '6363636363636363636363636363636363636363636363636363636363636363' + - '6363636363636363636363636363636363636363636363636363636363636363' + - '6363636363636363636363636363636363636363636363636363636363636363' + - '6363636300000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000') + '6363636363636363636363636363636363636363636363636363636363636363' + + '6363636363636363636363636363636363636363636363636363636363636363' + + '6363636300000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000', + ) t.end() }) @@ -151,7 +164,7 @@ t.test('directory', t => { }) t.equal(out.length, 512) - const wss = new WriteEntry.Sync('dir', { cwd: files }) + const wss = new WriteEntrySync('dir', { cwd: files }) t.equal(wss.read().length, 512) t.match(wss.header, { cksumValid: true, @@ -193,34 +206,38 @@ t.test('empty path for cwd', t => { }) }) -t.test('symlink', { - skip: isWindows && 'symlinks not fully supported', -}, t => { - const ws = new WriteEntry('symlink', { cwd: files }) - let out = [] - ws.on('data', c => out.push(c)) - const header = { - cksumValid: true, - needPax: false, - path: 'symlink', - size: 0, - linkpath: 'hardlink-2', - uname: 'isaacs', - gname: null, - devmaj: 0, - devmin: 0, - } +t.test( + 'symlink', + { + skip: isWindows && 'symlinks not fully supported', + }, + t => { + const ws = new WriteEntry('symlink', { cwd: files }) + let out = [] + ws.on('data', c => out.push(c)) + const header = { + cksumValid: true, + needPax: false, + path: 'symlink', + size: 0, + linkpath: 'hardlink-2', + uname: 'isaacs', + gname: null, + devmaj: 0, + devmin: 0, + } - const wss = new WriteEntry.Sync('symlink', { cwd: files }) - t.match(wss.header, header) + const wss = new WriteEntrySync('symlink', { cwd: files }) + t.match(wss.header, header) - ws.on('end', _ => { - out = Buffer.concat(out) - t.equal(out.length, 512) - t.match(ws.header, header) - t.end() - }) -}) + ws.on('end', _ => { + out = Buffer.concat(out) + t.equal(out.length, 512) + t.match(ws.header, header) + t.end() + }) + }, +) t.test('zero-byte file', t => { const ws = new WriteEntry('files/zero-byte.txt', { cwd: fixtures }) @@ -253,7 +270,8 @@ t.test('zero-byte file, but close fails', t => { const ws = new WriteEntry('files/1024-bytes.txt', { cwd: fixtures }) ws.on('end', _ => - t.fail('should not get an end, because the close fails')) + t.fail('should not get an end, because the close fails'), + ) ws.on('error', er => { t.match(er, { message: 'poop' }) @@ -263,7 +281,7 @@ t.test('zero-byte file, but close fails', t => { }) t.test('hardlinks', t => { - const wss = new WriteEntry.Sync('hardlink-1', { + const wss = new WriteEntrySync('hardlink-1', { cwd: files, }) @@ -298,7 +316,9 @@ t.test('hardlinks far away', t => { const h1 = 'hardlink-1' const f = path.resolve(files, h1) const stat = fs.statSync(f) - const linkCache = new Map([[stat.dev + ':' + stat.ino, '/a/b/c/d/e']]) + const linkCache = new Map([ + [stat.dev + ':' + stat.ino, '/a/b/c/d/e'], + ]) const ws = new WriteEntry('files/hardlink-2', { cwd: fixtures, @@ -327,7 +347,8 @@ t.test('hardlinks far away', t => { }) t.test('really deep path', t => { - const f = 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' + const f = + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' const ws = new WriteEntry(f, { cwd: files }) let out = [] ws.on('data', c => out.push(c)) @@ -352,7 +373,8 @@ t.test('really deep path', t => { }) t.test('no pax', t => { - const f = 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' + const f = + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' const ws = new WriteEntry(f, { cwd: files, noPax: true }) let out = [] ws.on('data', c => out.push(c)) @@ -381,7 +403,7 @@ t.test('nonexistent file', t => { const ws = new WriteEntry('does not exist', { cwd: files }) ws.on('error', er => { t.match(er, { - message: 'ENOENT: no such file or directory, lstat \'' + f + '\'', + message: "ENOENT: no such file or directory, lstat '" + f + "'", code: 'ENOENT', path: f, syscall: 'lstat', @@ -395,7 +417,7 @@ t.test('absolute path', t => { const { root } = path.parse(absolute) const f = root + root + root + absolute const warn = normPath(isWindows ? root : root + root + root + root) - t.test('preservePaths=false strict=false', t => { + t.test('preservePaths=false strict=false warn='+warn, t => { const warnings = [] // on windows, c:\c:\c:\... is a valid path, so just use the // single-root absolute version of it. @@ -408,11 +430,13 @@ t.test('absolute path', t => { ws.on('end', _ => { out = Buffer.concat(out) t.equal(out.length, 1024) - t.match(warnings, [[ - 'TAR_ENTRY_INFO', - `stripping ${warn} from absolute path`, - { path: normPath(isWindows ? absolute : f) }, - ]]) + t.match(warnings, [ + [ + 'TAR_ENTRY_INFO', + `stripping ${warn} from absolute path`, + { path: normPath(isWindows ? absolute : f) }, + ], + ]) t.match(ws.header, { cksumValid: true, @@ -467,22 +491,25 @@ t.test('absolute path', t => { }) t.test('preservePaths=false strict=true', t => { - t.throws(_ => { - new WriteEntry(isWindows ? absolute : f, { - strict: true, - cwd: files, - }) - }, { - message: /stripping .* from absolute path/, - path: normPath(isWindows ? absolute : f), - }) + t.throws( + _ => { + new WriteEntry(isWindows ? absolute : f, { + strict: true, + cwd: files, + }) + }, + { + message: /stripping .* from absolute path/, + path: normPath(isWindows ? absolute : f), + }, + ) t.end() }) t.end() }) -t.throws(_ => new WriteEntry(null), new TypeError('path is required')) +t.throws(() => new WriteEntry(null), TypeError) t.test('no user environ, sets uname to empty string', t => { delete process.env.USER @@ -508,31 +535,35 @@ t.test('no user environ, sets uname to empty string', t => { }) }) -t.test('an unsuppored type', { - skip: isWindows && '/dev/random on windows', -}, t => { - const ws = new WriteEntry('/dev/random', { preservePaths: true }) - ws.on('data', c => { - throw new Error('should not get data from random') - }) - ws.on('stat', stat => { - t.match(stat, { - dev: Number, - mode: 0o020666, - nlink: 1, - rdev: Number, - blksize: Number, - ino: Number, - size: 0, - blocks: 0, +t.test( + 'an unsuppored type', + { + skip: isWindows && '/dev/random on windows', + }, + t => { + const ws = new WriteEntry('/dev/random', { preservePaths: true }) + ws.on('data', (_chunk) => { + throw new Error('should not get data from random') }) - t.ok(stat.isCharacterDevice(), 'random is a character device') - }) - ws.on('end', _ => { - t.match(ws, { type: 'Unsupported', path: '/dev/random' }) - t.end() - }) -}) + ws.on('stat', stat => { + t.match(stat, { + dev: Number, + mode: 0o020666, + nlink: 1, + rdev: Number, + blksize: Number, + ino: Number, + size: 0, + blocks: 0, + }) + t.ok(stat.isCharacterDevice(), 'random is a character device') + }) + ws.on('end', _ => { + t.match(ws, { type: 'Unsupported', path: '/dev/random' }) + t.end() + }) + }, +) t.test('readlink fail', t => { const expect = { @@ -542,23 +573,31 @@ t.test('readlink fail', t => { // pretend everything is a symbolic link, then read something that isn't t.teardown(mutateFS.statType('SymbolicLink')) t.throws(_ => { - return new WriteEntry.Sync('write-entry.js', { cwd: __dirname }) + return new WriteEntrySync('write-entry.js', { cwd: __dirname }) }, expect) - new WriteEntry('write-entry.js', { cwd: __dirname }).on('error', er => { - t.match(er, expect) - t.equal(normPath(er.path), normPath(__filename)) - t.end() - }) + new WriteEntry('write-entry.js', { cwd: __dirname }).on( + 'error', + er => { + t.match(er, expect) + t.equal(normPath(er.path), normPath(__filename)) + t.end() + }, + ) }) t.test('open fail', t => { t.teardown(mutateFS.fail('open', new Error('pwn'))) - t.throws(_ => new WriteEntry.Sync('write-entry.js', { cwd: __dirname }), - { message: 'pwn' }) - new WriteEntry('write-entry.js', { cwd: __dirname }).on('error', er => { - t.match(er, { message: 'pwn' }) - t.end() - }) + t.throws( + _ => new WriteEntrySync('write-entry.js', { cwd: __dirname }), + { message: 'pwn' }, + ) + new WriteEntry('write-entry.js', { cwd: __dirname }).on( + 'error', + er => { + t.match(er, { message: 'pwn' }) + t.end() + }, + ) }) t.test('read fail', t => { @@ -568,16 +607,22 @@ t.test('read fail', t => { syscall: 'read', } // pretend everything is a file, then read something that isn't - t.teardown(mutateFS.statMutate((er, st) => { - if (er) { - return [er, st] - } - st.isFile = () => true - st.size = 123 - })) - t.throws(_ => new WriteEntry.Sync('fixtures', { - cwd: __dirname, - }), expect) + t.teardown( + mutateFS.statMutate((er, st) => { + if (er) { + return [er, st] + } + st.isFile = () => true + st.size = 123 + }), + ) + t.throws( + _ => + new WriteEntrySync('fixtures', { + cwd: __dirname, + }), + expect, + ) new WriteEntry('fixtures', { cwd: __dirname }).on('error', er => { t.match(er, expect) t.end() @@ -585,27 +630,34 @@ t.test('read fail', t => { }) t.test('read invalid EOF', t => { - t.teardown(mutateFS.mutate('read', (er, br) => [er, 0])) + t.teardown(mutateFS.mutate('read', (er, _bytesRead) => [er, 0])) const expect = { message: 'encountered unexpected EOF', path: normPath(__filename), syscall: 'read', code: 'EOF', } - t.throws(_ => new WriteEntry.Sync('write-entry.js', { cwd: __dirname }), - expect) - new WriteEntry('write-entry.js', { cwd: __dirname }).on('error', er => { - t.match(er, expect) - t.end() - }) + t.throws( + _ => new WriteEntrySync('write-entry.js', { cwd: __dirname }), + expect, + ) + new WriteEntry('write-entry.js', { cwd: __dirname }).on( + 'error', + er => { + t.match(er, expect) + t.end() + }, + ) }) t.test('read overflow expectation', t => { - t.teardown(mutateFS.statMutate((er, st) => { - if (st) { - st.size = 3 - } - })) + t.teardown( + mutateFS.statMutate((_er, st) => { + if (st) { + st.size = 3 + } + }), + ) const f = '512-bytes.txt' const expect = { message: 'did not encounter expected EOF', @@ -614,17 +666,23 @@ t.test('read overflow expectation', t => { code: 'EOF', } t.plan(2) - t.throws(_ => new WriteEntry.Sync(f, { cwd: files, maxReadSize: 2 }), expect) - new WriteEntry(f, { cwd: files, maxReadSize: 2 }).on('error', er => { - t.match(er, expect) - }).resume() + t.throws( + _ => new WriteEntrySync(f, { cwd: files, maxReadSize: 2 }), + expect, + ) + new WriteEntry(f, { cwd: files, maxReadSize: 2 }) + .on('error', er => { + t.match(er, expect) + }) + .resume() }) t.test('short reads', t => { t.teardown(mutateFS.zenoRead()) const cases = { '1024-bytes.txt': new Array(1024).join('x') + '\n', - '100-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': new Array(101).join('c'), + '100-byte-filename-cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc': + new Array(101).join('c'), } const maxReadSize = [null, 1024, 100, 111] @@ -642,12 +700,21 @@ t.test('short reads', t => { ws.on('data', c => out.push(c)) ws.on('end', _ => { out = Buffer.concat(out) - t.equal(out.length, 512 * Math.ceil(1 + contents.length / 512)) - t.equal(out.slice(512).toString().replace(/\0.*$/, ''), contents) - const wss = new WriteEntry.Sync(filename, { cwd: files }) + t.equal( + out.length, + 512 * Math.ceil(1 + contents.length / 512), + ) + t.equal( + out.slice(512).toString().replace(/\0.*$/, ''), + contents, + ) + const wss = new WriteEntrySync(filename, { cwd: files }) const syncOut = wss.read() t.equal(syncOut.length, out.length) - t.equal(syncOut.slice(512).toString(), out.slice(512).toString()) + t.equal( + syncOut.subarray(512).toString(), + out.slice(512).toString(), + ) t.end() }) }) @@ -658,53 +725,67 @@ t.test('short reads', t => { t.end() }) -t.test('win32 path conversion', { - skip: isWindows && 'no need to test on windows', -}, t => { - const ws = new WriteEntry('long-path\\r', { - cwd: files, - win32: true, - }) - t.equal(ws.path, 'long-path/r') - t.end() -}) - -t.test('win32 <|>? in paths', { - skip: isWindows && 'do not create annoying junk on windows systems', -}, t => { - const file = path.resolve(fixtures, '<|>?.txt') - const uglyName = Buffer.from('ef80bcef81bcef80beef80bf2e747874', 'hex').toString() - const ugly = path.resolve(fixtures, uglyName) - t.teardown(_ => { - rimraf.sync(file) - rimraf.sync(ugly) - }) +t.test( + 'win32 path conversion', + { + skip: isWindows && 'no need to test on windows', + }, + t => { + const ws = new WriteEntry('long-path\\r', { + cwd: files, + win32: true, + }) + t.equal(ws.path, 'long-path/r') + t.end() + }, +) + +t.test( + 'win32 <|>? in paths', + { + skip: + isWindows && 'do not create annoying junk on windows systems', + }, + t => { + const file = path.resolve(fixtures, '<|>?.txt') + const uglyName = Buffer.from( + 'ef80bcef81bcef80beef80bf2e747874', + 'hex', + ).toString() + const ugly = path.resolve(fixtures, uglyName) + t.teardown(_ => { + rimraf.sync(file) + rimraf.sync(ugly) + }) - fs.writeFileSync(ugly, '<|>?') + fs.writeFileSync(ugly, '<|>?') - const wc = new WriteEntry(uglyName, { - cwd: fixtures, - win32: true, - }) + const wc = new WriteEntry(uglyName, { + cwd: fixtures, + win32: true, + }) - const out = [] - wc.on('data', c => out.push(c)) - wc.on('end', _ => { - const data = Buffer.concat(out).toString() - t.equal(data.slice(0, 4), '<|>?') - t.end() - }) + const out = [] + wc.on('data', c => out.push(c)) + wc.on('end', _ => { + const data = Buffer.concat(out).toString() + t.equal(data.slice(0, 4), '<|>?') + t.end() + }) - t.equal(wc.path, '<|>?.txt') - t.equal(wc.absolute, ugly) -}) + t.equal(wc.path, '<|>?.txt') + t.equal(wc.absolute, ugly) + }, +) t.test('uid doesnt match, dont set uname', t => { - t.teardown(mutateFS.statMutate((er, st) => { - if (st) { - st.uid -= 1 - } - })) + t.teardown( + mutateFS.statMutate((_er, st) => { + if (st) { + st.uid -= 1 + } + }), + ) const ws = new WriteEntry('long-path/r', { cwd: files, }) @@ -721,17 +802,17 @@ t.test('override absolute to some other file', t => { ws.on('end', _ => { const data = Buffer.concat(out) t.equal(data.length, 1024) - t.match(data.slice(512).toString(), /^a\0{511}$/) + t.match(data.subarray(512).toString(), /^a\0{511}$/) t.match(ws, { path: 'blerg', header: { size: 1 }, }) - const wss = new WriteEntry.Sync('blerg', { + const wss = new WriteEntrySync('blerg', { absolute: files + '/one-byte.txt', }) const sdata = wss.read() t.equal(sdata.length, 1024) - t.match(sdata.slice(512).toString(), /^a\0{511}$/) + t.match(sdata.subarray(512).toString(), /^a\0{511}$/) t.match(wss, { path: 'blerg', header: { size: 1 }, @@ -741,7 +822,8 @@ t.test('override absolute to some other file', t => { }) t.test('portable entries, nothing platform-specific', t => { - const om = 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt' + const om = + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt' const ws = new WriteEntry(om, { cwd: files, portable: true, @@ -775,7 +857,7 @@ t.test('portable entries, nothing platform-specific', t => { } const ps = new Parser() - const wss = new WriteEntry.Sync(om, { + const wss = new WriteEntrySync(om, { cwd: files, portable: true, }) @@ -795,7 +877,8 @@ t.test('portable entries, nothing platform-specific', t => { }) t.test('no mtime', t => { - const om = 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt' + const om = + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt' const ws = new WriteEntry(om, { cwd: files, noMtime: true, @@ -832,7 +915,7 @@ t.test('no mtime', t => { } const ps = new Parser() - const wss = new WriteEntry.Sync(om, { + const wss = new WriteEntrySync(om, { cwd: files, portable: true, noMtime: true, @@ -853,7 +936,8 @@ t.test('no mtime', t => { }) t.test('force mtime', t => { - const om = 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt' + const om = + 'long-path/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/Ω.txt' const date = new Date('1979-07-01T19:10:00.000Z') const ws = new WriteEntry(om, { cwd: files, @@ -891,7 +975,7 @@ t.test('force mtime', t => { } const ps = new Parser() - const wss = new WriteEntry.Sync(om, { + const wss = new WriteEntrySync(om, { cwd: files, portable: true, mtime: new Date('1979-07-01T19:10:00.000Z'), @@ -930,7 +1014,7 @@ t.test('portable dir entries, no mtime', t => { } const ps = new Parser() - const wss = new WriteEntry.Sync(dir, { + const wss = new WriteEntrySync(dir, { cwd: files, portable: true, }) @@ -985,19 +1069,19 @@ t.test('write entry from read entry', t => { t.test('basic file', t => { const fileEntry = new ReadEntry(new Header(data)) - const wetFile = new WriteEntry.Tar(fileEntry) + const wetFile = new WriteEntryTar(fileEntry) const out = [] let wetFileEnded = false wetFile.on('data', c => out.push(c)) - wetFile.on('end', _ => wetFileEnded = true) - fileEntry.write(data.slice(512, 550)) - fileEntry.write(data.slice(550, 1000)) - fileEntry.end(data.slice(1000, 1024)) + wetFile.on('end', _ => (wetFileEnded = true)) + fileEntry.write(data.subarray(512, 550)) + fileEntry.write(data.subarray(550, 1000)) + fileEntry.end(data.subarray(1000, 1024)) t.equal(wetFileEnded, true) const result = Buffer.concat(out) t.equal(result.length, 1024) t.equal(result.toString().replace(/\0.*$/, ''), '$') - const body = result.slice(512).toString().replace(/\0*$/, '') + const body = result.subarray(512).toString().replace(/\0*$/, '') t.equal(body, '$$$$$$$$$$') t.end() }) @@ -1019,11 +1103,11 @@ t.test('write entry from read entry', t => { '', ]) const fileEntry = new ReadEntry(new Header(data)) - const wetFile = new WriteEntry.Tar(fileEntry, { portable: true }) + const wetFile = new WriteEntryTar(fileEntry, { portable: true }) const out = [] let wetFileEnded = false wetFile.on('data', c => out.push(c)) - wetFile.on('end', _ => wetFileEnded = true) + wetFile.on('end', _ => (wetFileEnded = true)) fileEntry.end() t.equal(wetFileEnded, true) const result = Buffer.concat(out) @@ -1034,19 +1118,19 @@ t.test('write entry from read entry', t => { t.test('with pax header', t => { const fileEntryPax = new ReadEntry(new Header(data)) fileEntryPax.path = new Array(200).join('$') - const wetPax = new WriteEntry.Tar(fileEntryPax) + const wetPax = new WriteEntryTar(fileEntryPax) let wetPaxEnded = false const out = [] wetPax.on('data', c => out.push(c)) - wetPax.on('end', _ => wetPaxEnded = true) - fileEntryPax.write(data.slice(512, 550)) - fileEntryPax.write(data.slice(550, 1000)) - fileEntryPax.end(data.slice(1000, 1024)) + wetPax.on('end', _ => (wetPaxEnded = true)) + fileEntryPax.write(data.subarray(512, 550)) + fileEntryPax.write(data.subarray(550, 1000)) + fileEntryPax.end(data.subarray(1000, 1024)) t.equal(wetPaxEnded, true) const result = Buffer.concat(out) t.equal(result.length, 2048) - t.match(result.slice(1024, 1124).toString(), /^\$+\0?$/) - const body = result.slice(1536).toString().replace(/\0*$/, '') + t.match(result.subarray(1024, 1124).toString(), /^\$+\0?$/) + const body = result.subarray(1536).toString().replace(/\0*$/, '') t.match(new Header(result), { type: 'ExtendedHeader' }) t.equal(body, '$$$$$$$$$$') t.end() @@ -1055,26 +1139,28 @@ t.test('write entry from read entry', t => { t.test('pax and portable', t => { const fileEntryPax = new ReadEntry(new Header(data)) fileEntryPax.path = new Array(200).join('$') - const wetPax = new WriteEntry.Tar(fileEntryPax, { portable: true }) + const wetPax = new WriteEntryTar(fileEntryPax, { + portable: true, + }) let wetPaxEnded = false const out = [] wetPax.on('data', c => out.push(c)) - wetPax.on('end', _ => wetPaxEnded = true) - fileEntryPax.write(data.slice(512, 550)) - fileEntryPax.write(data.slice(550, 1000)) - fileEntryPax.end(data.slice(1000, 1024)) + wetPax.on('end', _ => (wetPaxEnded = true)) + fileEntryPax.write(data.subarray(512, 550)) + fileEntryPax.write(data.subarray(550, 1000)) + fileEntryPax.end(data.subarray(1000, 1024)) t.equal(wetPaxEnded, true) const result = Buffer.concat(out) t.equal(result.length, 2048) - t.match(result.slice(1024, 1124).toString(), /^\$+\0?$/) + t.match(result.subarray(1024, 1124).toString(), /^\$+\0?$/) t.match(new Header(result), { type: 'ExtendedHeader' }) - t.match(new Header(result.slice(1024)), { + t.match(new Header(result.subarray(1024)), { ctime: null, atime: null, uname: '', gname: '', }) - const body = result.slice(1536).toString().replace(/\0*$/, '') + const body = result.subarray(1536).toString().replace(/\0*$/, '') t.equal(body, '$$$$$$$$$$') t.end() }) @@ -1082,30 +1168,30 @@ t.test('write entry from read entry', t => { t.test('pax, portable, and noMtime', t => { const fileEntryPax = new ReadEntry(new Header(data)) fileEntryPax.path = new Array(200).join('$') - const wetPax = new WriteEntry.Tar(fileEntryPax, { + const wetPax = new WriteEntryTar(fileEntryPax, { noMtime: true, portable: true, }) let wetPaxEnded = false const out = [] wetPax.on('data', c => out.push(c)) - wetPax.on('end', _ => wetPaxEnded = true) - fileEntryPax.write(data.slice(512, 550)) - fileEntryPax.write(data.slice(550, 1000)) - fileEntryPax.end(data.slice(1000, 1024)) + wetPax.on('end', _ => (wetPaxEnded = true)) + fileEntryPax.write(data.subarray(512, 550)) + fileEntryPax.write(data.subarray(550, 1000)) + fileEntryPax.end(data.subarray(1000, 1024)) t.equal(wetPaxEnded, true) const result = Buffer.concat(out) t.equal(result.length, 2048) - t.match(result.slice(1024, 1124).toString(), /^\$+\0?$/) + t.match(result.subarray(1024, 1124).toString(), /^\$+\0?$/) t.match(new Header(result), { type: 'ExtendedHeader' }) - t.match(new Header(result.slice(1024)), { + t.match(new Header(result.subarray(1024)), { mtime: null, ctime: null, atime: null, uname: '', gname: '', }) - const body = result.slice(1536).toString().replace(/\0*$/, '') + const body = result.subarray(1536).toString().replace(/\0*$/, '') t.equal(body, '$$$$$$$$$$') t.end() }) @@ -1116,18 +1202,22 @@ t.test('write entry from read entry', t => { t.test('warn', t => { const warnings = [] - new WriteEntry.Tar(fileEntry, { + new WriteEntryTar(fileEntry, { onwarn: (code, msg, data) => warnings.push(code, msg, data), }) - t.match(warnings, ['TAR_ENTRY_INFO', 'stripping / from absolute path', { - path: '/a/b/c', - }]) + t.match(warnings, [ + 'TAR_ENTRY_INFO', + 'stripping / from absolute path', + { + path: '/a/b/c', + }, + ]) t.end() }) t.test('preserve', t => { const warnings = [] - new WriteEntry.Tar(fileEntry, { + new WriteEntryTar(fileEntry, { onwarn: (code, msg, data) => warnings.push(code, msg, data), preservePaths: true, }) @@ -1136,41 +1226,48 @@ t.test('write entry from read entry', t => { }) t.test('throw', t => { - t.throws(_ => new WriteEntry.Tar(fileEntry, { - strict: true, - })) + t.throws( + _ => + new WriteEntryTar(fileEntry, { + strict: true, + }), + ) t.end() }) t.end() }) t.test('no block remain', t => { - const readEntry = new ReadEntry(new Header({ - size: 512, - type: 'File', - path: 'x', - })) - const wet = new WriteEntry.Tar(readEntry) + const readEntry = new ReadEntry( + new Header({ + size: 512, + type: 'File', + path: 'x', + }), + ) + const wet = new WriteEntryTar(readEntry) const out = [] wet.on('data', c => out.push(c)) let wetEnded = false - wet.on('end', _ => wetEnded = true) + wet.on('end', _ => (wetEnded = true)) t.equal(wetEnded, false) readEntry.end(Buffer.from(new Array(513).join('@'))) t.equal(wetEnded, true) const res = Buffer.concat(out) t.equal(res.length, 1024) - t.match(res.slice(512).toString(), /^@+$/) + t.match(res.subarray(512).toString(), /^@+$/) t.end() }) t.test('write more than appropriate', t => { - const readEntry = new ReadEntry(new Header({ - path: 'x', - type: 'File', - size: '1', - })) - const wet = new WriteEntry.Tar(readEntry) + const readEntry = new ReadEntry( + new Header({ + path: 'x', + type: 'File', + size: '1', + }), + ) + const wet = new WriteEntryTar(readEntry) t.throws(_ => wet.write(Buffer.from(new Array(1024).join('x')))) t.end() }) @@ -1212,7 +1309,9 @@ t.test('prefix and hard links', t => { path: 'PaxHeader/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', type: 'ExtendedHeader', }, - new RegExp('^266 path=out.x.' + long + '[\\w\\W]*linkpath=out.x.target'), + new RegExp( + '^266 path=out.x.' + long + '[\\w\\W]*linkpath=out.x.target', + ), { path: 'out/x/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', type: 'Link', @@ -1251,11 +1350,11 @@ t.test('prefix and hard links', t => { const data = Buffer.concat(out) expect.forEach((e, i) => { if (typeof e === 'string') { - t.equal(data.slice(i * 512, i * 512 + e.length).toString(), e) + t.equal(data.subarray(i * 512, i * 512 + e.length).toString(), e) } else if (e instanceof RegExp) { - t.match(data.slice(i * 512, (i + 1) * 512).toString(), e) + t.match(data.subarray(i * 512, (i + 1) * 512).toString(), e) } else { - t.match(new Header(data.slice(i * 512, (i + 1) * 512)), e) + t.match(new Header(data.subarray(i * 512, (i + 1) * 512)), e) } }) } @@ -1271,11 +1370,12 @@ t.test('prefix and hard links', t => { statCache, } const out = [] - const entry = (path) => new Promise(resolve => { - const p = new Class(path, opt) - p.on('end', resolve) - p.on('data', d => out.push(d)) - }) + const entry = path => + new Promise(resolve => { + const p = new Class(path, opt) + p.on('end', resolve) + p.on('data', d => out.push(d)) + }) await entry(path) if (path === '.') { @@ -1299,8 +1399,8 @@ t.test('prefix and hard links', t => { }) t.test('sync', t => { - t.test('.', t => runTest(t, '.', WriteEntry.Sync)) - return t.test('./', t => runTest(t, './', WriteEntry.Sync)) + t.test('.', t => runTest(t, '.', WriteEntrySync)) + return t.test('./', t => runTest(t, './', WriteEntrySync)) }) t.end() @@ -1328,7 +1428,9 @@ t.test('prefix and hard links from tar entries', t => { path: 'PaxHeader/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', type: 'ExtendedHeader', }, - new RegExp('^266 path=out.x.' + long + '[\\w\\W]*linkpath=out.x.target'), + new RegExp( + '^266 path=out.x.' + long + '[\\w\\W]*linkpath=out.x.target', + ), { path: 'out/x/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', type: 'Link', @@ -1425,16 +1527,16 @@ t.test('prefix and hard links from tar entries', t => { const data = Buffer.concat(out) expect.forEach((e, i) => { if (typeof e === 'string') { - t.equal(data.slice(i * 512, i * 512 + e.length).toString(), e) + t.equal(data.subarray(i * 512, i * 512 + e.length).toString(), e) } else if (e instanceof RegExp) { - t.match(data.slice(i * 512, (i + 1) * 512).toString(), e) + t.match(data.subarray(i * 512, (i + 1) * 512).toString(), e) } else { - t.match(new Header(data.slice(i * 512, (i + 1) * 512)), e) + t.match(new Header(data.subarray(i * 512, (i + 1) * 512)), e) } }) } - const runTest = async (t, path) => { + const runTest = async (t, _path) => { const linkCache = new Map() const statCache = new Map() const opt = { @@ -1447,7 +1549,7 @@ t.test('prefix and hard links from tar entries', t => { const parser = new Parser({ strict: true, onentry: readEntry => { - const p = new WriteEntry.Tar(readEntry, opt) + const p = new WriteEntryTar(readEntry, opt) p.on('data', d => out.push(d)) }, }) @@ -1520,9 +1622,9 @@ t.test('hard links and no prefix', t => { const data = Buffer.concat(out) expect.forEach((e, i) => { if (typeof e === 'string') { - t.equal(data.slice(i * 512, i * 512 + e.length).toString(), e) + t.equal(data.subarray(i * 512, i * 512 + e.length).toString(), e) } else { - t.match(new Header(data.slice(i * 512, (i + 1) * 512)), e) + t.match(new Header(data.subarray(i * 512, (i + 1) * 512)), e) } }) } @@ -1536,11 +1638,12 @@ t.test('hard links and no prefix', t => { statCache, } const out = [] - const entry = (path) => new Promise(resolve => { - const p = new Class(path, opt) - p.on('end', resolve) - p.on('data', d => out.push(d)) - }) + const entry = path => + new Promise(resolve => { + const p = new Class(path, opt) + p.on('end', resolve) + p.on('data', d => out.push(d)) + }) await entry(path) if (path === '.') { @@ -1563,8 +1666,8 @@ t.test('hard links and no prefix', t => { }) t.test('sync', t => { - t.test('.', t => runTest(t, '.', WriteEntry.Sync)) - return t.test('./', t => runTest(t, './', WriteEntry.Sync)) + t.test('.', t => runTest(t, '.', WriteEntrySync)) + return t.test('./', t => runTest(t, './', WriteEntrySync)) }) t.end() @@ -1665,16 +1768,16 @@ t.test('hard links from tar entries and no prefix', t => { const data = Buffer.concat(out) expect.forEach((e, i) => { if (typeof e === 'string') { - t.equal(data.slice(i * 512, i * 512 + e.length).toString(), e) + t.equal(data.subarray(i * 512, i * 512 + e.length).toString(), e) } else if (e instanceof RegExp) { - t.match(data.slice(i * 512, (i + 1) * 512).toString(), e) + t.match(data.subarray(i * 512, (i + 1) * 512).toString(), e) } else { - t.match(new Header(data.slice(i * 512, (i + 1) * 512)), e) + t.match(new Header(data.subarray(i * 512, (i + 1) * 512)), e) } }) } - const runTest = async (t, path) => { + const runTest = async (t, _path) => { const linkCache = new Map() const statCache = new Map() const opt = { @@ -1685,7 +1788,7 @@ t.test('hard links from tar entries and no prefix', t => { const out = [] const parser = new Parser({ onentry: readEntry => { - const p = new WriteEntry.Tar(readEntry, opt) + const p = new WriteEntryTar(readEntry, opt) p.on('data', d => out.push(d)) }, })