GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: test buffer behavior when zeroFill undefined by Trott · Pull Request #11706 · nodejs/node

Conversation

@Trott

@Trott Trott commented Mar 6, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

When ArrayBufferAllocator has an undefined zeroFill property,
Buffer.allocUnsafe() should zero fill.

Refs: 27e84ddd4e1#commitcomment-19182129

The || [0] (discussed in the Refs: above) is the only piece of code in buffer.js not covered by tests. Ideally, this test would probably be a C++ addon test, but until someone writes that test, this will at least confirm that the intended behavior is correct.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test buffer

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Trott Trott added buffer Issues and PRs related to the buffer subsystem. test Issues and PRs related to Node.js core tests and test infrastructure. labels Mar 6, 2017
@Trott
Trott force-pushed the buffer-addon branch from 5b53f4a to 09a5eb8 Compare March 6, 2017 03:35
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to Node.js core tests and test infrastructure. label Mar 6, 2017
@Trott
test: test buffer behavior when zeroFill undefined
531dba7
When ArrayBufferAllocator has an undefined zeroFill property,
Buffer.allocUnsafe() should zero fill.

Refs: nodejs@27e84ddd4e1#commitcomment-19182129
@Trott
Trott force-pushed the buffer-addon branch from 09a5eb8 to 531dba7 Compare March 6, 2017 03:36
@bnoordhuis

bnoordhuis commented Mar 6, 2017

Copy link
Copy Markdown
Member

I don't know. This is brittle both in how it monkey-patches the bindings and how it expects buffers to contain random garbage. If in an individual run the buffers all come from freshly mmap-ed memory (not inconceivable with a loop like that) the test will fail.

You could ameliorate it somewhat by filling the buffer with non-zero data so that it's not all zeroes when its memory is reused for another buffer but that's still no guarantee.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Mar 6, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

This is brittle

Yes, indeed. Best what can be said for it is that it's probably better than no test at all (our current situation).

Would happily close this in favor of a C++ addon that did the testing instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax approved these changes Mar 6, 2017
View reviewed changes

@addaleax addaleax left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Code LGTM, and I don’t think it hurts to have this

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test/parallel/test-buffer-bindingobj-no-zerofill.js
// `process.binding('buffer').setupBufferJS` be monkey-patched before this runs.
const monkeyPatchedBuffer = require('../../lib/buffer');

// On unpatched buffer. allocUnsafe() should not zero fill memory. It's always

@addaleax addaleax Mar 6, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

typo: , after buffer?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Trott reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
fhinkel
fhinkel approved these changes Mar 9, 2017
View reviewed changes
@fhinkel

fhinkel commented Mar 9, 2017

Copy link
Copy Markdown
Contributor

Thanks, landed with fixed typo in 9ee58c0.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fhinkel fhinkel closed this Mar 9, 2017
fhinkel pushed a commit that referenced this pull request Mar 9, 2017
@Trott @fhinkel
test: test buffer behavior when zeroFill undefined
9ee58c0
When ArrayBufferAllocator has an undefined zeroFill property,
Buffer.allocUnsafe() should zero fill.

Refs: 27e84ddd4e1#commitcomment-19182129

PR-URL: #11706
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
@Trott

Trott commented Mar 9, 2017

Copy link
Copy Markdown
Member Author

(Looks like this may have landed without a CI run. :-O )

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

italoacasas pushed a commit to italoacasas/node that referenced this pull request Mar 13, 2017
@Trott Italo A. Casas
test: test buffer behavior when zeroFill undefined
1af0fa4
When ArrayBufferAllocator has an undefined zeroFill property,
Buffer.allocUnsafe() should zero fill.

Refs: nodejs@27e84ddd4e1#commitcomment-19182129

PR-URL: nodejs#11706
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
@italoacasas italoacasas mentioned this pull request Mar 13, 2017
7.7.3 Release Proposal #11831
Merged
jungx098 pushed a commit to jungx098/node that referenced this pull request Mar 21, 2017
@Trott @jungx098
test: test buffer behavior when zeroFill undefined
1dfa279
When ArrayBufferAllocator has an undefined zeroFill property,
Buffer.allocUnsafe() should zero fill.

Refs: nodejs@27e84ddd4e1#commitcomment-19182129

PR-URL: nodejs#11706
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
Qantas94Heavy added a commit to Qantas94Heavy/node that referenced this pull request Apr 9, 2017
@Qantas94Heavy
test: fix allocUnsafe uninitialized buffer check
5700fc8
Fixes parallel/test-buffer-bindingobj-no-zerofill to properly check
that buffers created with `Buffer.allocUnsafe()` are not zero-filled.

The test introduced in nodejs#11706 passes even if the buffer has been
zero-filled and fails if none of the buffer values are zero.

Signed-off-by: Karl Cheng <[email protected]>
Refs: nodejs#11706
@Qantas94Heavy Qantas94Heavy mentioned this pull request Apr 9, 2017
test: fix allocUnsafe uninitialized buffer check #12290
Closed
2 tasks done
jasnell pushed a commit that referenced this pull request Apr 11, 2017
@Qantas94Heavy @jasnell
test: fix allocUnsafe uninitialized buffer check
eb49d59
Fixes parallel/test-buffer-bindingobj-no-zerofill to properly check
that buffers created with `Buffer.allocUnsafe()` are not zero-filled.

The test introduced in #11706 passes even if the buffer has been
zero-filled and fails if none of the buffer values are zero.

Refs: #11706
PR-URL: #12290
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins added the backport-requested-v6.x label Apr 17, 2017
@MylesBorins

MylesBorins commented Apr 17, 2017

Copy link
Copy Markdown
Contributor

looks like this has failures. Please manually backport (and include #12290 )

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott added dont-land-on-v4.x and removed backport-requested-v6.x labels Apr 18, 2017
@Trott

Trott commented Apr 18, 2017

Copy link
Copy Markdown
Member Author

This depends on #7082 which is labeled dont-land-on-v6.x. Labeling this the same (and #12290 as well).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

evanlucas pushed a commit that referenced this pull request Apr 25, 2017
@Qantas94Heavy @evanlucas
test: fix allocUnsafe uninitialized buffer check
8ee62cd
Fixes parallel/test-buffer-bindingobj-no-zerofill to properly check
that buffers created with `Buffer.allocUnsafe()` are not zero-filled.

The test introduced in #11706 passes even if the buffer has been
zero-filled and fails if none of the buffer values are zero.

Refs: #11706
PR-URL: #12290
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: James M Snell <[email protected]>
evanlucas pushed a commit that referenced this pull request May 1, 2017
@Qantas94Heavy @evanlucas
test: fix allocUnsafe uninitialized buffer check
e63607b
Fixes parallel/test-buffer-bindingobj-no-zerofill to properly check
that buffers created with `Buffer.allocUnsafe()` are not zero-filled.

The test introduced in #11706 passes even if the buffer has been
zero-filled and fails if none of the buffer values are zero.

Refs: #11706
PR-URL: #12290
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: James M Snell <[email protected]>
evanlucas pushed a commit that referenced this pull request May 2, 2017
@Qantas94Heavy @evanlucas
test: fix allocUnsafe uninitialized buffer check
1ab998f
Fixes parallel/test-buffer-bindingobj-no-zerofill to properly check
that buffers created with `Buffer.allocUnsafe()` are not zero-filled.

The test introduced in #11706 passes even if the buffer has been
zero-filled and fails if none of the buffer values are zero.

Refs: #11706
PR-URL: #12290
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@Trott Trott mentioned this pull request Aug 18, 2018
buffer: move process.binding('buffer') to internalBinding #22370
Closed
3 tasks done
@starkwang starkwang mentioned this pull request Aug 27, 2018
Replace test-buffer-bindingobj-no-zerofill.js by an addon test #22547
Closed
@Trott
Trott deleted the buffer-addon branch January 13, 2022 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@addaleax addaleax addaleax approved these changes
+1 more reviewer
@fhinkel fhinkel fhinkel approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

buffer Issues and PRs related to the buffer subsystem. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@Trott @bnoordhuis @fhinkel @MylesBorins @addaleax @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.