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

url: fix off-by-one error in loop handling dots #8420

Closed
wants to merge 1 commit into from

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Sep 6, 2016

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

url

Description of change

Fixes an error where a loop, used to traverse an array of length n, ran n + 1 times instead of n.

@nodejs-github-bot nodejs-github-bot added the url Issues and PRs related to the legacy built-in url module. label Sep 6, 2016
Fixes an error where a loop, used to traverse an array of length `n`,
ran `n + 1` times instead of `n`.

PR-URL: nodejs#8420
@lpinca
Copy link
Member Author

lpinca commented Sep 6, 2016

@evanlucas
Copy link
Contributor

/cc @mscdex ?

@mscdex
Copy link
Contributor

mscdex commented Sep 6, 2016

This needs a test.

@lpinca
Copy link
Member Author

lpinca commented Sep 6, 2016

Hmm any suggestion? How do you test that an internal loop runs the correct amount of times. Right now it works because the first iteration is basically a noop.

@mscdex
Copy link
Contributor

mscdex commented Sep 6, 2016

I assumed that with the use of "error" in the PR description/title that you already had some kind of input that triggered an actual incorrect output? Or did you just find this by perusing the source code or ?

@lpinca
Copy link
Member Author

lpinca commented Sep 6, 2016

The latter. I wanted to see the algorithm behind url.resolve() and I noticed that minor "issue".
I agree, the use of "error" in the commit message is a bit misleading but in a certain sense it is still an error and I couldn't find better words to describe the change.

@mscdex
Copy link
Contributor

mscdex commented Sep 6, 2016

Interesting, this has actually been this way since 2011 (af15b4e).

This change LGTM though.

@jasnell
Copy link
Member

jasnell commented Sep 7, 2016

LGTM given that CI is green-ish (other than the unfortunately expected arm failures)

@jasnell
Copy link
Member

jasnell commented Sep 9, 2016

Another CI, just to be safe: https://ci.nodejs.org/job/node-test-pull-request/3987/

@thefourtheye
Copy link
Contributor

LGTM

jasnell pushed a commit that referenced this pull request Sep 12, 2016
Fixes an error where a loop, used to traverse an array of length `n`,
ran `n + 1` times instead of `n`.

PR-URL: #8420
Reviewed-By: Brian White <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@jasnell
Copy link
Member

jasnell commented Sep 12, 2016

Landed in 63493e1

@jasnell jasnell closed this Sep 12, 2016
@lpinca lpinca deleted the fix/off-by-one-error branch September 12, 2016 06:05
Fishrock123 pushed a commit that referenced this pull request Sep 14, 2016
Fixes an error where a loop, used to traverse an array of length `n`,
ran `n + 1` times instead of `n`.

PR-URL: #8420
Reviewed-By: Brian White <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this pull request Sep 30, 2016
Fixes an error where a loop, used to traverse an array of length `n`,
ran `n + 1` times instead of `n`.

PR-URL: #8420
Reviewed-By: Brian White <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this pull request Oct 10, 2016
Fixes an error where a loop, used to traverse an array of length `n`,
ran `n + 1` times instead of `n`.

PR-URL: #8420
Reviewed-By: Brian White <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
rvagg pushed a commit that referenced this pull request Oct 18, 2016
Fixes an error where a loop, used to traverse an array of length `n`,
ran `n + 1` times instead of `n`.

PR-URL: #8420
Reviewed-By: Brian White <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this pull request Oct 26, 2016
Fixes an error where a loop, used to traverse an array of length `n`,
ran `n + 1` times instead of `n`.

PR-URL: #8420
Reviewed-By: Brian White <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Oct 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
url Issues and PRs related to the legacy built-in url module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants