Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: make ReadStream throw TypeError on NaN #19775

Closed
wants to merge 1 commit into from

Conversation

ryzokuken
Copy link
Contributor

@ryzokuken ryzokuken commented Apr 3, 2018

Make ReadStream (and thus createReadStream) throw a TypeError signalling
towards an invalid argument type when either options.start or
options.end (or obviously, both) are set to NaN.
Also add regression tests for the same.

Fixes: #19715

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

/cc @lpinca @BridgeAR @addaleax @anliting

Make ReadStream (and thus createReadStream) throw a TypeError signalling
towards an invalid argument type when either options.start or
options.end (or obviously, both) are set to NaN.
Also add regression tests for the same.

Fixes: nodejs#19715
@nodejs-github-bot nodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Apr 3, 2018
@ryzokuken
Copy link
Contributor Author

@addaleax @anliting please take a look at this, I think this gets all the basics covered.

@addaleax addaleax added lts-watch-v6.x author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Apr 3, 2018
@addaleax
Copy link
Member

addaleax commented Apr 3, 2018

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for bearing with us :)

@ryzokuken
Copy link
Contributor Author

The failure seems unrelated.

@ryzokuken
Copy link
Contributor Author

@addaleax is this a flaky test? I think it seems completely unrelated.

@lpinca
Copy link
Member

lpinca commented Apr 3, 2018

@ryzokuken yes it is unrelated.

@ryzokuken
Copy link
Contributor Author

@lpinca if that's the case, please land this whenever you deem fit.

Thanks.

@anliting
Copy link

anliting commented Apr 3, 2018

@ryzokuken

LGTM.

Thank you for being patient. Good bug fix.

@ryzokuken
Copy link
Contributor Author

https://ci.nodejs.org/job/node-test-commit-linux-containered/nodes=ubuntu1604_sharedlibs_fips20_x64/3377/

shows that build was successful. Why does GitHub still show it as "pending" though?

@ryzokuken
Copy link
Contributor Author

Can we land this now?

@addaleax
Copy link
Member

addaleax commented Apr 4, 2018

@ryzokuken We have a policy that we typically wait 48 hours for PRs to land, and 72 hours over weekends, so that everybody who wants to has a chance to look at it.

@ryzokuken
Copy link
Contributor Author

Oh, sorry. I already know about the policy. I thought that because this is just a continuation of #19732, it didn't need to be up for 48 hours by itself.

Cool, let's wait for a day or two then.

@addaleax
Copy link
Member

addaleax commented Apr 4, 2018

@ryzokuken I don’t think we need to hurry on this

Also, this is adding an error throw with the intention of landing it on LTS releases, which is something that people might feel uncomfortable with (I don’t in this case)

@ryzokuken
Copy link
Contributor Author

@addaleax I understand. Thanks for being patient with me 😅

@Trott
Copy link
Member

Trott commented Apr 6, 2018

Re-running sole CI failed task node-test-commit-plinux: https://ci.nodejs.org/job/node-test-commit-plinux/16650/

@lpinca
Copy link
Member

lpinca commented Apr 6, 2018

Landed in 38a6929.

lpinca pushed a commit that referenced this pull request Apr 6, 2018
Make ReadStream (and thus createReadStream) throw a TypeError signalling
towards an invalid argument type when either options.start or
options.end (or obviously, both) are set to NaN.
Also add regression tests for the same.

PR-URL: #19775
Fixes: #19715
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@lpinca lpinca closed this Apr 6, 2018
@targos targos removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 6, 2018
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request May 1, 2018
Make ReadStream (and thus createReadStream) throw a TypeError signalling
towards an invalid argument type when either options.start or
options.end (or obviously, both) are set to NaN.
Also add regression tests for the same.

PR-URL: nodejs#19775
Fixes: nodejs#19715
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fs.createReadStream doesn't throw with options={start:NaN,end:NaN}