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

operator || #40699

Closed
essential-existence opened this issue Nov 2, 2021 · 2 comments
Closed

operator || #40699

essential-existence opened this issue Nov 2, 2021 · 2 comments
Labels
fs Issues and PRs related to the fs subsystem / file system.

Comments

@essential-existence
Copy link

essential-existence commented Nov 2, 2021

position = bufferOrOptions.position || null;

If the value is "0", it is converted to "null", which causes the low-level read position of the file to be taken into account. I suggest:
position = bufferOrOptions.position ?? null;.

Operator || - this evil!

@tniessen tniessen added the fs Issues and PRs related to the fs subsystem / file system. label Nov 2, 2021
@Trott Trott added the invalid Issues and PRs that are invalid. label Nov 2, 2021
@Trott Trott closed this as completed Nov 2, 2021
@Trott Trott reopened this Nov 2, 2021
@Trott Trott removed the invalid Issues and PRs that are invalid. label Nov 2, 2021
@mihilmy
Copy link
Contributor

mihilmy commented Nov 3, 2021

Duplicate of #40715
I have some more details with repros in #40715

@essential-existence
Copy link
Author

Duplicate of #40715 I have some more details with repros in #40715

I am glad that you soon noticed this error too.

@Trott Trott closed this as completed in 2037ee8 Nov 12, 2021
targos pushed a commit that referenced this issue Nov 21, 2021
When the file read position is moved passing zero is
not respected and `null` is used instead. PR fixes the
issues by using nullish coalescing which will return
the rhs only when the lhs is `null` or `undefined`;
respecting the zero.

Fixes: #40715

PR-URL: #40716
Fixes: #40699
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
richardlau pushed a commit that referenced this issue Jan 25, 2022
When the file read position is moved passing zero is
not respected and `null` is used instead. PR fixes the
issues by using nullish coalescing which will return
the rhs only when the lhs is `null` or `undefined`;
respecting the zero.

Fixes: #40715

PR-URL: #40716
Fixes: #40699
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
danielleadams pushed a commit that referenced this issue Jan 30, 2022
When the file read position is moved passing zero is
not respected and `null` is used instead. PR fixes the
issues by using nullish coalescing which will return
the rhs only when the lhs is `null` or `undefined`;
respecting the zero.

Fixes: #40715

PR-URL: #40716
Fixes: #40699
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
danielleadams pushed a commit that referenced this issue Feb 1, 2022
When the file read position is moved passing zero is
not respected and `null` is used instead. PR fixes the
issues by using nullish coalescing which will return
the rhs only when the lhs is `null` or `undefined`;
respecting the zero.

Fixes: #40715

PR-URL: #40716
Fixes: #40699
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
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 a pull request may close this issue.

4 participants