Skip to content

Revert "fs: ensure readFile[Sync] reads from the beginning"

This reverts commit 4444e731.

Looks like #9699 was landed without a CI Run. It breaks three tests in my Mac OS.

/usr/local/opt/python/bin/python2.7 tools/test.py --mode=release -J \
    addons doctool inspector known_issues message pseudo-tty parallel sequential
=== release test-fs-readfile-pipe ===
Path: parallel/test-fs-readfile-pipe
assert.js:381
assert.ifError = function ifError(err) { if (err) throw err; };
                                                  ^

Error: Command failed: cat "/Users/thefourtheye/git/node/test/parallel/test-fs-readfile-pipe.js" | "/Users/thefourtheye/git/node/out/Release/node" "/Users/thefourtheye/git/node/test/parallel/test-fs-readfile-pipe.js" child
assert.js:381
assert.ifError = function ifError(err) { if (err) throw err; };
                                                  ^

Error: ESPIPE: invalid seek, read

    at ChildProcess.exithandler (child_process.js:212:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:192:7)
    at maybeClose (internal/child_process.js:886:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:189:7)
    at Pipe._handle.close [as _onclose] (net.js:501:12)
Command: out/Release/node /Users/thefourtheye/git/node/test/parallel/test-fs-readfile-pipe.js
=== release test-fs-readfile-pipe-large ===
Path: parallel/test-fs-readfile-pipe-large
assert.js:381
assert.ifError = function ifError(err) { if (err) throw err; };
                                                  ^

Error: Command failed: cat /Users/thefourtheye/git/node/test/tmp.3/readfile_pipe_large_test.txt | "/Users/thefourtheye/git/node/out/Release/node" "/Users/thefourtheye/git/node/test/parallel/test-fs-readfile-pipe-large.js" child
assert.js:381
assert.ifError = function ifError(err) { if (err) throw err; };
                                                  ^

Error: ESPIPE: invalid seek, read
cat: stdout: Broken pipe

    at ChildProcess.exithandler (child_process.js:212:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:192:7)
    at maybeClose (internal/child_process.js:886:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:189:7)
    at Pipe._handle.close [as _onclose] (net.js:501:12)
Command: out/Release/node /Users/thefourtheye/git/node/test/parallel/test-fs-readfile-pipe-large.js
=== release test-fs-readfilesync-pipe-large ===
Path: parallel/test-fs-readfilesync-pipe-large
assert.js:381
assert.ifError = function ifError(err) { if (err) throw err; };
                                                  ^

Error: Command failed: cat /Users/thefourtheye/git/node/test/tmp.5/readfilesync_pipe_large_test.txt | "/Users/thefourtheye/git/node/out/Release/node" "/Users/thefourtheye/git/node/test/parallel/test-fs-readfilesync-pipe-large.js" child
fs.js:581
  return binding.read(fd, buffer, offset, length, position);
                 ^

Error: ESPIPE: invalid seek, read
    at Object.fs.readSync (fs.js:581:18)
    at tryReadSync (fs.js:454:20)
    at Object.fs.readFileSync (fs.js:491:19)
    at Object.<anonymous> (/Users/thefourtheye/git/node/test/parallel/test-fs-readfilesync-pipe-large.js:16:27)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
cat: stdout: Broken pipe

    at ChildProcess.exithandler (child_process.js:212:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:192:7)
    at maybeClose (internal/child_process.js:886:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:189:7)
    at Pipe._handle.close [as _onclose] (net.js:501:12)
Command: out/Release/node /Users/thefourtheye/git/node/test/parallel/test-fs-readfilesync-pipe-large.js
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

fs


cc @seishun

Merge request reports

Loading