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.ftruncate cannot truncate to lengths > 2GB #20844

Closed
animetosho opened this issue May 20, 2018 · 2 comments
Closed

fs.ftruncate cannot truncate to lengths > 2GB #20844

animetosho opened this issue May 20, 2018 · 2 comments
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system.

Comments

@animetosho
Copy link

  • Version: 10.x
  • Platform: all
  • Subsystem: fs

fs.ftruncate, in Node 10, attempts to do some length checking, which I don't recall being present in earlier versions of Node (v6 I think?). As somewhat alluded to in the comment there, this breaks any attempt to truncate (or allocate, in my particular case) a file to more than 2GB.

@mscdex
Copy link
Contributor

mscdex commented May 20, 2018

/cc @BridgeAR

@BridgeAR BridgeAR added confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system. labels May 20, 2018
cjihrig added a commit to cjihrig/node that referenced this issue May 26, 2018
This allows validation of integers that are not int32 or uint32.

PR-URL: nodejs#20851
Fixes: nodejs#20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
cjihrig added a commit to cjihrig/node that referenced this issue May 26, 2018
This commit adds validation to the length parameter of
fs.truncate(). Prior to this commit, passing a non-number would
trigger a CHECK() in the binding layer.

PR-URL: nodejs#20851
Fixes: nodejs#20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
cjihrig added a commit to cjihrig/node that referenced this issue May 26, 2018
The length used by ftruncate() is 64 bits in the binding layer.
This commit removes the 32 bit restriction in the JS layer.

PR-URL: nodejs#20851
Fixes: nodejs#20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@animetosho
Copy link
Author

Thank you!

targos pushed a commit that referenced this issue Jun 6, 2018
This allows validation of integers that are not int32 or uint32.

PR-URL: #20851
Fixes: #20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

Backport-PR-URL: #21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
targos pushed a commit that referenced this issue Jun 6, 2018
This commit adds validation to the length parameter of
fs.truncate(). Prior to this commit, passing a non-number would
trigger a CHECK() in the binding layer.

Backport-PR-URL: #21171
PR-URL: #20851
Fixes: #20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

Backport-PR-URL: #21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
targos pushed a commit that referenced this issue Jun 6, 2018
The length used by ftruncate() is 64 bits in the binding layer.
This commit removes the 32 bit restriction in the JS layer.

Backport-PR-URL: #21171
PR-URL: #20851
Fixes: #20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

Backport-PR-URL: #21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
targos pushed a commit that referenced this issue Jun 7, 2018
The length used by ftruncate() is 64 bits in the binding layer.
This commit removes the 32 bit restriction in the JS layer.

Backport-PR-URL: #21171
PR-URL: #20851
Fixes: #20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

Backport-PR-URL: #21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
targos pushed a commit that referenced this issue Jun 13, 2018
This allows validation of integers that are not int32 or uint32.

PR-URL: #20851
Fixes: #20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

Backport-PR-URL: #21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
targos pushed a commit that referenced this issue Jun 13, 2018
This commit adds validation to the length parameter of
fs.truncate(). Prior to this commit, passing a non-number would
trigger a CHECK() in the binding layer.

Backport-PR-URL: #21171
PR-URL: #20851
Fixes: #20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

Backport-PR-URL: #21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
targos pushed a commit that referenced this issue Jun 13, 2018
The length used by ftruncate() is 64 bits in the binding layer.
This commit removes the 32 bit restriction in the JS layer.

Backport-PR-URL: #21171
PR-URL: #20851
Fixes: #20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

Backport-PR-URL: #21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

3 participants