Commit Graph

14897 Commits (66df5d147f65cc1a36098987e2d6131c5403c0fc)

Author SHA1 Message Date
delvedor 66df5d147f test: cleanup test-os.js
Moved from var to const.
Moved from .equal to .strictEqual.
Added more checks about the type of the returned values.

PR-URL: https://github.com/nodejs/node/pull/8606
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-21 03:50:54 +03:00
Ilkka Myller db5a8791fa https: fix memory leak with https.request()
If calling `https.request()` with `options.headers.host` defined
and `options.servername` undefined, `https.Agent.createSocket` mutates
connection `options` after `https.Agent.addRequest` has created empty
socket pool array with mismatching connection name. This results in two
socket pool arrays being created and only the last one gets eventually
deleted by `removeSocket` - causing a memory leak.

This commit fixes the leak by making sure that `addRequest` does the
same modifications to `options` object as the `createSocket`.

`createSocket` is intentionally left unmodified to prevent userland
regressions.

Test case included.

PR-URL: https://github.com/nodejs/node/pull/8647
Fixes: https://github.com/nodejs/node/issues/6687
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-21 03:22:15 +03:00
Aleksey Kozyatinskiy c5ce7f4d9e doc: add ak239 to collaborators
PR-URL: https://github.com/nodejs/node/pull/8676
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-09-20 17:07:56 -07:00
cjihrig b176d30a69 dns: handle array holes in setServers()
This commit adds better handling of exceptional array formats
passed to dns.setServers(). Prior to this commit, the input
array was validated using map(), which preserves holes, allowing
them to be passed to c-ares, crashing Node. This commit replaces
map() with forEach(), which skips holes.

Fixes: https://github.com/nodejs/node/issues/8538
PR-URL: https://github.com/nodejs/node/pull/8567
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-20 19:56:13 -04:00
Adri Van Houdt d4bf5cac43 process: changed var to const in internal/process/promises
PR-URL: https://github.com/nodejs/node/pull/8620
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-20 16:55:28 -07:00
Fikret Burak Gazioglu 0bfd103480 test: refactor test-dgram-bind-shared-ports.js
Refactored the code to latest standards, where all var is
changed to const, functions are changed to arrow functions
and assert.equal chaned to assert.strictEqual

PR-URL: https://github.com/nodejs/node/pull/8582
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-21 02:52:59 +03:00
cjihrig d7994db70c src: handle thrown errors in CopyProperties()
This commit prevents thrown JavaScript exceptions from crashing
the process in node_contextify's CopyProperties() function.

Fixes: https://github.com/nodejs/node/issues/8537
PR-URL: https://github.com/nodejs/node/pull/8649
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-09-20 19:46:01 -04:00
Dany Shaanan d469321946 tools: add eslint rule prefer-assert-methods
PR-URL: https://github.com/nodejs/node/pull/8622
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
2016-09-20 16:35:39 -07:00
Jonathan Prince 66dbd9c9c1 test: update test-child-process-recv-handle
change var to const/let where appropriate
use strictEqual instead of equal
call toString on buffers in strictEqual asserts
use common.mustCall on callbacks containing asserts

PR-URL: https://github.com/nodejs/node/pull/8648
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-09-20 15:38:02 -07:00
Wietse Venema 57a5136e96 test: improve test-child-process-stdout-flush
Changed vars to const / let, functions to arrow functions and a
mustCall where appropriate.

PR-URL: https://github.com/nodejs/node/pull/8581
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
2016-09-20 15:28:09 -07:00
Tarjei Husøy 2b5acda7a2
zlib: tighten up dictionary tests
Uses const where possible, removes inaccurate comments, prefers
strictEqual where possible, ensures functions with assertions are called
and enures the inflater has correct encoding set.

PR-URL: https://github.com/nodejs/node/pull/8512
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-20 23:05:35 +02:00
Tarjei Husøy c775514e56
zlib: fix raw inflate with custom dictionary
Moves inflateSetDictionary right after inflateInit2 when mode is
INFLATERAW, since without the wrapper in appears zlib won't return
Z_NEED_DICT as it would otherwise, and will thus attempt inflating
without the dictionary, leading to an error.

Fixes: https://github.com/nodejs/node/issues/8507
PR-URL: https://github.com/nodejs/node/pull/8512
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-20 23:05:35 +02:00
Yevgen Safronov 4019c321d4 test: cleanup test-child-process-exec-env.js
Replace equal with strictEqual, use const instead of var and
improve test with use of assert.notStrictEqual

PR-URL: https://github.com/nodejs/node/pull/8600
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-21 00:00:56 +03:00
Thomas van Lankveld 80620d8665 test: cleanup test-tls-connect-given-socket.js
Changed vars to consts and lets, assert.equals to
assert.strictEquals and added common.mustCall around callbacks.
Switched to arrow functions.

PR-URL: https://github.com/nodejs/node/pull/8616
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 23:35:07 +03:00
Adri Van Houdt 1c81dd8d83 test: cleanup test-child-process-buffering.js
PR-URL: https://github.com/nodejs/node/pull/8578
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 23:05:42 +03:00
Eugene Ostroukhov efe4d19240 inspector: report default context
Fixes: https://github.com/nodejs/node/issues/8426
PR-URL: https://github.com/nodejs/node/pull/8502
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
2016-09-20 11:57:30 -07:00
matt-in-a-hat 57b7e85a59 test: update test-cluster-disconnect-unshared-udp
Changed var to const

PR-URL: https://github.com/nodejs/node/pull/8599
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 21:21:52 +03:00
lrlna daa0f9087a test: changing equal to strictEqual in path
PR-URL: https://github.com/nodejs/node/pull/8628
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-20 11:16:29 -07:00
Danny Guo 99ab686cd3 doc: clarify fs.utimes() arguments
Make it clear that atime and mtime should be in seconds.

PR-URL: https://github.com/nodejs/node/pull/8651
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 11:11:01 -07:00
Adri Van Houdt 41a66bc73a lib: changed var to const in bootstrap_node.js
PR-URL: https://github.com/nodejs/node/pull/8588
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-09-20 11:01:52 -07:00
Pavol Otcenas 3ffa6a884c test: modernize js and tighten equality checking
Changed var --> const and let.
Changed assert.notEqual --> assert.notStrictEqual
Fixed comment spelling

PR-URL: https://github.com/nodejs/node/pull/8618
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-20 10:58:55 -07:00
scott stern 00dd33ce8c test: refactor parallel/test-tcp-wrap-listen
PR-URL: https://github.com/nodejs/node/pull/8640
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-20 10:47:36 -07:00
Rich Trott f785b3662b tools: make argument alignment linting more strict
A few nits in recent PR comments suggest that we can have slightly more
strict linting for argument alignment in multiline function calls. This
enables the existing linting requirements to apply when one or more of
the arguments themselves are function calls. Previously, that situation
had been excluded from linting.

Refs: https://github.com/nodejs/node/pull/8628#issuecomment-247797311
PR-URL: https://github.com/nodejs/node/pull/8642
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-09-20 10:22:23 -07:00
Rich Trott 4316f4df31 test,lib: align arguments in multiline calls
An upcoming custom lint rule will provide slightly more strict
enforcement of argument alignment for multiline function calls. Adjust
existing code to conform.

PR-URL: https://github.com/nodejs/node/pull/8642
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-09-20 10:22:23 -07:00
Eugene Ostroukhov bc1ebd67d8 inspector: zero out structure members
Ctor has to be added as memset to 0 is no longer an option, since
the structure now has std::vector member.

Attempt at fixing nodejs/node#8155 (so far I was not able to repro it)

PR-URL: https://github.com/nodejs/node/pull/8536
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
2016-09-20 10:20:06 -07:00
Bryan English be07458b11 util: don't init Debug if it's not needed yet
Because any call to util.inspect() with an object results in
inspectPromise() being called, Debug was being initialized even when
it's not needed. Instead, the initialization is placed after the
isPromise check.

PR-URL: https://github.com/nodejs/node/pull/8452
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-09-20 10:04:26 -07:00
Paul Kiddie fffb9a386a
src: use MaybeStackBuffer on DoSend/Writev
instead of creating own buffer, use MaybeStackBuffer on DoSend to
take advantage of its destructor to free up memory, so buffer
never leaks memory - even if code in DoSend throws.

Use MaybeStackBuffer in Writev to take advantage of destructor
on MaybeStackBuffer to clear itself up, rather than Writev managing
resources itself.

PR-URL: https://github.com/nodejs/node/pull/8626
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-09-20 18:59:10 +02:00
Jason Ginchereau c1e47ed8c8 path: fix path.relative UNC path result
When the result of a path.relative() is an absolute UNC path, it should
include the leading backslashes.

Fixes: https://github.com/nodejs/node/issues/8444
PR-URL: https://github.com/nodejs/node/pull/8523
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2016-09-20 09:56:50 -07:00
Rachel 0f7fffb329 test: cleanup cluster-disconnect-unshared-tcp test
Replaced var with const

PR-URL: https://github.com/nodejs/node/pull/8598
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2016-09-20 19:11:56 +03:00
Ishan Aditya 7a46554dcf test: var variables to const in zlib
Changes in test-zlib-from-string is because var->const
pushed us over the max char limit per line.

PR-URL: https://github.com/nodejs/node/pull/8627
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-09-20 10:54:56 -04:00
Pavol Otcenas d59074c1cb
test: modernize JS and tighten equality checking
Changed var --> const and let.
Changed assert.equal !== --> assert.notStrictEqual
Correctly aligned argument

PR-URL: https://github.com/nodejs/node/pull/8580
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-09-20 16:22:44 +02:00
Сковорода Никита Андреевич fe69d0d0a4 tools: clean up icu/README.md formatting
1. Normalize headings.
 2. Specify language in all code blocks.

PR-URL: https://github.com/nodejs/node/pull/8660
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-09-20 15:30:12 +03:00
Dany Shaanan 5f29947230
util: simplify SIMD setup
PR-URL: https://github.com/nodejs/node/pull/8579
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 14:11:31 +02:00
Anna Henningsen 9391cb0fde
build: run `npm install` for doc builds in tarball
Run `npm install` before building the documentation from release
tarballs. The doctool currently depends on `js-yaml`, which
is imported from the `tools/eslint` subtree; however, release
tarballs don’t contain that directory.

Running `npm install` is clearly not a beautiful solution,
but it works.

Fixes: https://github.com/nodejs/node/issues/7872
PR-URL: https://github.com/nodejs/node/pull/8413
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-20 13:58:06 +02:00
Alessandro Metta 2eb3fa14f8 test: cleanup test-intl.js
Improved variables to be all const.
Enforced assert.strictEqual across all tests.
Modified haveIntl tests to check for int.
Fixed alignment.

PR-URL: https://github.com/nodejs/node/pull/8641
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 13:56:25 +03:00
Pavol Otcenas 13e110da72 test: cleanup test-child-process-disconnect.js
Changed var --> const and let
Changed assert.equal --> assert.strictEqual

PR-URL: https://github.com/nodejs/node/pull/8602
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 13:28:04 +03:00
Sébastien Barbieri 5f4bc59800 test: replace var by const test-tls-zero-clear-in
PR-URL: https://github.com/nodejs/node/pull/8621
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 13:17:15 +03:00
Michaël Zasso ebbd5cb0df test: improve coverage of the util module
Add tests for untested branches and statements.
Change assert.equal to assert.strictEqual for consistency.

PR-URL: https://github.com/nodejs/node/pull/8633
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-09-20 09:41:34 +02:00
Rich Trott 7c3ab1d935 doc: add link to help repo in README
Include link to Node.js help repo (for end user questions on how to use
Node.js) in the README.

PR-URL: https://github.com/nodejs/node/pull/8570
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2016-09-19 23:12:42 -07:00
Tobias Kahse 48142bcf4f test: refactored test-crypto-random.js
Replaced `var` by `const` for constant variables, enforced
strict equality check, and replaced custom callback execution
check by `common.mustCall`.

PR-URL: https://github.com/nodejs/node/pull/8632
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 02:14:16 +03:00
Yevgen Safronov 9fb59dfa39 test: cleanup test-c-ares.js
Replace equal with strictEqual, use const instead of var
Replace throw error with assert.ifError

PR-URL: https://github.com/nodejs/node/pull/8577
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 02:04:40 +03:00
Dennis Schwartz 366495d4e2 test: improve child_process tests
Replaced var keyword with const and let in the tests for child process
stdin and stdio.

PR-URL: https://github.com/nodejs/node/pull/8617
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-19 23:33:56 +03:00
Eugene Ostroukhov 626a07df5b inspector: restore 9229 as a default port
Some tools are now relying on 9229 to be node.js "inspector" port (I
see Chrome extensions, some online blog posts, etc.) Also, having same
default port values for old and new protocols may lead to some
confusion, e.g. when tools are trying to autodiscover debuggable Node
instances.

This is a partial revert of 9f1f7e2. This commit preserves the fix for
issue #8201 bringing back the behavior that the old and new protocols
run on different ports.run on different ports.

PR-URL: https://github.com/nodejs/node/pull/8550
Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
2016-09-19 13:17:33 -07:00
Eugene Ostroukhov b4a249f66b inspector: introduce a smoke test
This test executes a simple debug session over the inspector protocol.

PR-URL: https://github.com/nodejs/node/pull/8429
Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
2016-09-19 12:40:16 -07:00
Anna Henningsen c5545f2c63
fs: fix handling of `uv_stat_t` fields
`FChown` and `Chown` test that the `uid` and `gid` parameters
they receive are unsigned integers, but `Stat()` and `FStat()`
would return the corresponding fields of `uv_stat_t` as signed
integers. Applications which pass those these values directly
to `Chown` may fail
(e.g. for `nobody` on OS X, who has an `uid` of `-2`, see e.g.
https://github.com/nodejs/node-v0.x-archive/issues/5890).

This patch changes the `Integer::New()` call for `uid` and `gid`
to `Integer::NewFromUnsigned()`.

All other fields are kept as they are, for performance, but
strictly speaking the respective sizes of those
fields aren’t specified, either.

Ref: https://github.com/npm/npm/issues/13918
PR-URL: https://github.com/nodejs/node/pull/8515
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

undo accidental change to other fields of uv_fs_stat
2016-09-19 14:50:57 +02:00
Ltrlg 4e76bffc0c doc: fix broken link in timers doc
PR-URL: https://github.com/nodejs/node/pull/8562
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
2016-09-19 12:37:47 +02:00
Michaël Zasso 8699ecd340 test: improve coverage of the buffer module
Add tests for untested branches and statements.
Also convert some lines to const.

PR-URL: https://github.com/nodejs/node/pull/8552
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2016-09-19 09:15:41 +02:00
Michaël Zasso 05886cbab1 buffer: remove unnecessary argument check
In Buffer.prototype.compare, the first check makes sure that target is
an instance of Buffer. The value cannot be falsy after that so we can
safely get its length.

PR-URL: https://github.com/nodejs/node/pull/8552
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2016-09-19 09:14:00 +02:00
Rich Trott 4c76881383 doc: update exercise portion of onboarding doc
PR-URL: https://github.com/nodejs/node/pull/8559
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-18 21:38:49 -07:00
Mike Ralphson 30701a72c0 tls: add 'new' keyword for Array constructor call
PR-URL: https://github.com/nodejs/node/pull/8514
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-18 14:25:57 +02:00