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

buffer: allow .write() offset to be at buffer end #8154

Closed
wants to merge 2 commits into from

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Aug 18, 2016

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

buffer

Description of change

Do not throw if the offset passed to buf.write() points to the end of the buffer.

Fixes: #8127

CI: https://ci.nodejs.org/job/node-test-commit/4633/

Do not throw if the offset passed to `buf.write()` points
to the end of the buffer.

Fixes: nodejs#8127
@addaleax addaleax added the buffer Issues and PRs related to the buffer subsystem. label Aug 18, 2016
@jasnell
Copy link
Member

jasnell commented Aug 18, 2016

Given that this removes a throw, we need to decide if it's semver-major or not. I think it's likely safe as a patch.

The change itself LGTM if CI is green

@addaleax
Copy link
Member Author

This came up as an unintended regression in v6.4.0, so yeah, definitely +1 for considering this a semver-patch one.

@Trott
Copy link
Member

Trott commented Aug 18, 2016

Windows fanned test builds were having Jenkins problems. Re-running CI: https://ci.nodejs.org/job/node-test-pull-request/3721/

@@ -358,6 +358,9 @@ writeTest.write('e', 3, 'ascii');
writeTest.write('j', 4, 'ascii');
assert.equal(writeTest.toString(), 'nodejs');

// Does not throw (see https://github.com/nodejs/node/issues/8127).
Buffer.alloc(1).write('', 1, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you put this in an assert.doesNotThrow()?

Copy link
Member Author

Choose a reason for hiding this comment

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

@cjihrig Done!

@cjihrig
Copy link
Contributor

cjihrig commented Aug 18, 2016

LGTM

@ChALkeR
Copy link
Member

ChALkeR commented Aug 18, 2016

This is definitely a semver-patch, because it reverts a breaking change that was accidentally introduce in a semver-minor version.

@jasnell
Copy link
Member

jasnell commented Aug 18, 2016

Still LGTM. Just to be unnecessarily-extra-cautious, should probably do one more CI run following the new commit but I'm good with it landing either way.

@addaleax
Copy link
Member Author

CI: https://ci.nodejs.org/job/node-test-commit/4646/ … because running again on the latest changes is probably just the right amount of cautious ;)

@targos
Copy link
Member

targos commented Aug 22, 2016

LGTM

jasnell pushed a commit that referenced this pull request Aug 22, 2016
Do not throw if the offset passed to `buf.write()` points
to the end of the buffer.

Fixes: #8127
PR-URL: #8154
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
@jasnell
Copy link
Member

jasnell commented Aug 22, 2016

Landed in 3242b27!

@jasnell jasnell closed this Aug 22, 2016
@addaleax addaleax deleted the fix-buffer-write-zero-offset branch August 24, 2016 01:22
evanlucas pushed a commit that referenced this pull request Aug 24, 2016
Do not throw if the offset passed to `buf.write()` points
to the end of the buffer.

Fixes: #8127
PR-URL: #8154
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
evanlucas added a commit that referenced this pull request Aug 24, 2016
Notable changes:

* **buffer**: Fix regression introduced in v6.4.0 that prevented .write() at buffer end (Anna Henningsen) #8154
* **inspector**:
  * fix inspector hang while disconnecting (Aleksei Koziatinskii) #8021
  * add support for uncaught exception (Aleksei Koziatinskii) #8043
* **meta**: add @joshgav to collaborators (Josh Gavant) #8146
* **repl**: Fix saving editor mode text in `.save` (Prince J Wesley) #8145
* ***Revert*** "**repl,util**: insert carriage returns in output" (Evan Lucas) #8143
evanlucas added a commit that referenced this pull request Aug 26, 2016
Notable changes:

* **buffer**: Fix regression introduced in v6.4.0 that prevented .write() at buffer end (Anna Henningsen) #8154
* **deps**: update V8 to 5.1.281.75 (Ali Ijaz Sheikh) #8054
* **inspector**:
  * fix inspector hang while disconnecting (Aleksei Koziatinskii) #8021
  * add support for uncaught exception (Aleksei Koziatinskii) #8043
* **repl**: Fix saving editor mode text in `.save` (Prince J Wesley) #8145
* ***Revert*** "**repl,util**: insert carriage returns in output" (Evan Lucas) #8143

PR-URL: #8253
evanlucas added a commit that referenced this pull request Aug 26, 2016
Notable changes:

* **buffer**: Fix regression introduced in v6.4.0 that prevented .write() at buffer end (Anna Henningsen) #8154
* **deps**: update V8 to 5.1.281.75 (Ali Ijaz Sheikh) #8054
* **inspector**:
  * fix inspector hang while disconnecting (Aleksei Koziatinskii) #8021
  * add support for uncaught exception (Aleksei Koziatinskii) #8043
* **repl**: Fix saving editor mode text in `.save` (Prince J Wesley) #8145
* ***Revert*** "**repl,util**: insert carriage returns in output" (Evan Lucas) #8143

PR-URL: #8253
arthurschreiber added a commit to tediousjs/tedious that referenced this pull request Aug 26, 2016
Node.js 6.4.0 was shipped with a bug in it's Buffer implementation that causes the tedious test cases to fail. See #431, nodejs/node#8127 and nodejs/node#8154.
evanlucas added a commit that referenced this pull request Aug 26, 2016
Notable changes:

* **buffer**: Fix regression introduced in v6.4.0 that prevented .write() at buffer end (Anna Henningsen) #8154
* **deps**: update V8 to 5.1.281.75 (Ali Ijaz Sheikh) #8054
* **inspector**:
  * fix inspector hang while disconnecting (Aleksei Koziatinskii) #8021
  * add support for uncaught exception (Aleksei Koziatinskii) #8043
* **repl**: Fix saving editor mode text in `.save` (Prince J Wesley) #8145
* ***Revert*** "**repl,util**: insert carriage returns in output" (Evan Lucas) #8143

PR-URL: #8253
tvrprasad pushed a commit to tvrprasad/tedious that referenced this pull request Sep 11, 2016
Node.js 6.4.0 was shipped with a bug in it's Buffer implementation that causes the tedious test cases to fail. See tediousjs#431, nodejs/node#8127 and nodejs/node#8154.
@MylesBorins
Copy link
Contributor

@addaleax should this be backported?

@addaleax
Copy link
Member Author

It depends on/fixes a problem with #7494, so, probably not… although I can’t quite see why that one landed as semver-minor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants