Reverts a55ae72b23e6cdd6c540dac896a361060c56dd17 / @evanlucas / as this only masks part of the problem and ends up with an incorrect list of entries anyway.
Adds a line in collect() that makes it properly respect state so the ignore list gets to be properly built before fstream starts reading entries.
Explained in commit message:
Without watching if a stream is already paused before calling pause(),
collect() can conflict with other users of the stream who may be
managing state, resulting in a premature collect().
This manifests in the fstream-npm and node-tar combination where
fstream-npm manages state in readBundledLinks() at the same time
collect() is processing the stream. collect() ends up running before
fstream-npm has properly set up the correct list of entries according
to the ignore rules. When collect() gets to run before this is complete,
fstream starts performing _read() operations on a non-filtered list,
keeping track of entry index, then after it starts, fstream-npm inserts
a new list of entries and the entry index is incorrect and can skip
files.
collect()
that makes it properly respect state so the ignore list gets to be properly built before fstream starts reading entries.Explained in commit message:
Without watching if a stream is already paused before calling pause(), collect() can conflict with other users of the stream who may be managing state, resulting in a premature collect(). This manifests in the fstream-npm and node-tar combination where fstream-npm manages state in readBundledLinks() at the same time collect() is processing the stream. collect() ends up running before fstream-npm has properly set up the correct list of entries according to the ignore rules. When collect() gets to run before this is complete, fstream starts performing _read() operations on a non-filtered list, keeping track of entry index, then after it starts, fstream-npm inserts a new list of entries and the entry index is incorrect and can skip files.