nil evaluation error
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 499
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Description
I founded that after decoding of 0xc0 byte (nil) from msgpack stream msgpack5 decides that stream is finished and then produces error.
I tried to replace text below from function tryDecode of decoder.js
case 0xc0:
return buildDecodeResult(null, 1)
with
case 0xc0:
return buildDecodeResult(undefined, 1)
This correction fixed error.
However mapping msgpack nil to "undefined" don't looks as best solution.
I tried to fix error another way so, that 0xc0 (nil) maps to null but it's not easy.
Null evaluation as end of stream is hardcoded in readable-stream.
function readableAddChunk of _stream_readable.js has following code:
...
if (chunk === null) {
state.reading = false;
onEofChunk(stream, state);
}
...
Any ideas how to fix this error?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect tryDecode in decoder.js alongside readableAddChunk in _stream_readable.js. Reproduce decoding a 0xc0 byte in a msgpack stream and verify that nil is returned as null without being treated as end of stream; the issue provides no test file to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100