Skip to content

tar-stream regression in 13 with pipeline #32954

Closed
@mafintosh

Description

@mafintosh
  • Version: 13.13.0
  • Platform: Mac
  • Subsystem: stream

What steps will reproduce the bug?

stream.pipeline no longer compatible with tar-stream (around 500k GitHub dependents) for tar files with more than one file.

Attached is a test case.

echo hello > hello.txt
echo world > world.txt
tar c hello.txt world.txt > test.tar
const tar = require('tar-stream')
const fs = require('fs')
const path = require('path')
const pipeline = require('stream').pipeline

fs.createReadStream('test.tar')
  .pipe(tar.extract())
  .on('entry', function (header, stream, done) {
    console.log(header.name) // in 13 this will only unpack one file due to
                                                 // pipeline calling destroy on the substream
                                                 // causing the entire extract stream to be destroyed
                                                 // and silently fail.
    pipeline(stream, fs.createWriteStream(path.join('/tmp', header.name)), done)
  })

This seems to be related to changes that force autoDestroy behaviour on existing streams when using pipeline, added in #31940

Seems to be the same regression fixed for HTTP in #32197

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions