Bugs fixed:
* v0.12 and later: in-object properties not printing correctly.
* 64-bit: not printing external strings correctly (offset was hardcoded
for 32-bit). This would happen with "::jsstack -vn0" because the
script "node.js" wasn't printed correctly, at least with 0.10 core
files.
* 64-bit: printing JS source (via "::jsstack -v") emits errors and shows
the wrong code.
* Several build warnings.
* Two-byte strings are unnecessarily truncated.
* Could print friendlier note when given obviously bogus function token
positions.
New features:
* ::jsstack prints much cleaner output by default.
* ::jsprint keys are now quoted.
* ::jsstack -v includes "this" value for each function on the stack.
* ::jsstack -v includes more details about each argument (constructor
names for each object).
* new commands: ::jsconstructor, ::jsfunctions, ::jssource, ::nodebuffer
and ::v8internal.
* ::findjsobjects and ::jsprint hidden flags for developers to measure
and improve test coverage.
* internal jsobj_properties() function is much better documented.
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Currently, JSON.stringify() is used to create error messages
on failed assertions. This causes an error when stringifying
objects with circular references. This commit switches out
JSON.stringify() for util.inspect(), which can handle
circular references.
PR: #8734
PR-URL: https://github.com/joyent/node/pull/8734
Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
This reverts commit d312b6d15c.
d312b6d15c introduced some confusion in
the existing API of url.format and url.parse.
The way the 'path' property overrides other properties in url.format's
input is too confusing for existing users compared to the issues it
fixes.
Fixes such as https://github.com/joyent/node/pull/9081 have been
proposed, but they do not make the API less confusing.
Instead, this change just reverts the original breaking change so that
it gives us more time after v0.12.0 is released to come up with a better
API for url.format, url.parse and other related APIs in the v0.13
development branch.
Fixes#9070.
Conflicts:
doc/api/url.markdown
PR: #9109
PR-URL: https://github.com/joyent/node/pull/9109
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Fix regression introduced in 6120472036
that broke parsing of some ssh: urls.
An example url is ssh://git@github.com:npm/npm.git
Fixes#9072.
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit restricts socket timeouts non-negative, finite
numbers. Any other value throws a TypeError or RangeError.
This prevents subtle bugs that can happen due to type
coercion.
Fixes: https://github.com/joyent/node/issues/8618
PR-URL: https://github.com/joyent/node/pull/8884
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Make this test less prone to race conditions by using synchronous
interprocess communication instead of a timer to determine when the
child process is ready to receive messages from its parent.
Also, remove a superfluous timer since the tests suite already makes
tests time out after a while.
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
In order to preserve the potential for a flush method being added to the
streams API, rename flush to flushHeaders which is much more clear about
the behavior of this method.
PR: #9048
PR-URL: https://github.com/joyent/node/pull/9048
Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
On non-windows supported platforms, fs.access(readOnlyFile, W_OK, ...)
is expected to fail, but always succeeds if node runs as the super user,
which is often the case for tests running on our continuous integration
platform.
This change makes the test try to change its process user id to nobody
on non-windows platforms so that the above mentioned test can pass and
still perform the actual desired test. If changing the process user id
to a nobody is not possible, then the test checks that
fs.access(readOnlyFile, W_OK, ...) actually succeeds.
Fixes#9033.
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
unref one superfluous timer (as the test suite already has a global
timeout), and improve the state machine to iterate the messages more
reliably.
Ultimately make the test complete more quickly.
Signed-off-by: Julien Gilli <julien.gilli@joyent.com>
In general path functions don't change the case of a path. Making an
exception for windows drive letters violates the principle of least
surprise.
Changing the drive letter case has caused a lot of issues, including
joyent/node#7031, joyent/node#7806 and lots of bikeshedding about
whether uppercase is the right case or lowercase.
This effectively reverts joyent/node@a05f973
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
The tests suite available in test/external/ssl-options was originally
written for security fixes made in the v0.10 branch. In this branch, the
client's default ciphers list is compatible with SSLv2.
After merging this change from v0.10 to v0.12, this tests suite was
broken because commits 5d2aef17ee and
f4c8020d10 make SSL/TLS clients use a
default ciphers list that is not compatible with the SSLv2 protocol.
This change fixes two issues:
1) The cipher list that was setup for a given test was not passed
properly to the client.
2) When either or both of clients/servers were using SSLv2, tests were
expected to succeed when at least the server end was using SSLv2
compatible ciphers. Now, tests are expected to succeed only if
SSLv2 compatible ciphers are used on both ends.
Fixes#9020.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
A recent merge of v0.10 to v0.12
(0c7f6ca830) upgraded OpenSSL to version
1.0.1j. In v0.10, this required test-crypto-stream.js to be fixed with
commit 707cc25011. Basically, instead of
returning the proper error, Err_get_error() would return 0 and the test
for the error message needed to be updated in test-crypto-stream.js.
However, in the v0.12 branch, crypto error messages are handled a bit
differently since commit 26a1b712ec
landed. Instead of returning the default OpenSSL error message, it makes
the decipher stream return a default message specific to Node.js.
This commit updates test-crypto-stream.js to test the error object
against the proper default error message.
Fixes#9019.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Workers that are already disconnected but not yet exited should not be
disconnected, trying to do so raises exceptions.
Signed-off-by: Julien Gilli <julien.gilli@joyent.com>
Backport 10703774f0 from the v0.12 branch.
Currently, the test-child-process-spawn-typeerror.js is
calling execFile() on a JavaScript source file, which is
causing failures on Windows. This commit switches to calling
spawn() on an actual executable.
Fixes#8930.
Signed-off-by: Julien Gilli <julien.gilli@joyent.com>
child_process.spawn's argument parsing is stricter in v0.12 than in
v0.10. Changes in tests merged from v0.10 that relied on the less-strict
argument parsing would fail. This change updates the test so that it
makes sure that the stricter argument parsing fails as expected.
This change also fixes a small typo introduced during the conflicts
resolution of said merge.
fs.exists() and fs.existsSync() do not follow the typical error first
callback convention. access() and accessSync() are added as alternatives
in this commit.
PR-URL: https://github.com/joyent/node/pull/8714
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Currently, the test-child-process-spawn-typeerror.js is
calling execFile() on a JavaScript source file, which is
causing failures on Windows. This commit switches to calling
spawn() on an actual executable.
Reviewed-by: Sam Roberts <sam@strongloop.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
Some tests that rely on some environment variables being passed to child
processes would fail because they reset the child processes'
environement instead of appending to it. This would break on test
environments where some custom environment variables are needed to make
node work properly.
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Socket.prototype.connect() sometimes throws on bad inputs
after an asynchronous operation. This commit makes the input
validation synchronous. This commit also removes some hard
coded IP addresses.
PR-URL: https://github.com/joyent/node/pull/8180
Fixes: https://github.com/joyent/node/issues/8140
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Make "--with-intl=none" the default and add "intl-none" option to
vcbuild.bat.
If icu data is missing print a warning unless either --download=all or
--download=icu is set. If set then automatically download, verify (MD5)
and unpack the ICU data if not already available.
There's a "list" of URLs being used, but right now only the first is
picked up. The logic works something like this:
* If there is no directory deps/icu,
* If no zip file (currently icu4c-54_1-src.zip),
* Download zip file (icu-project.org -> sf.net)
* Verify the MD5 sum of the zipfile
* If bad, print error and exit
* Unpack the zipfile into deps/icu
* If deps/icu now exists, use it, else fail with help text
Add the configuration option "--with-icu-source=..."
Usage:
* --with-icu-source=/path/to/my/other/icu
* --with-icu-source=/path/to/icu54.zip
* --with-icu-source=/path/to/icu54.tgz
* --with-icu-source=http://example.com/icu54.tar.bz2
Add the configuration option "--with-icu-locals=...". Allows choosing
which locales are used in the "small-icu" case.
Example:
configure --with-intl=small-icu --with-icu-locales=tlh,grc,nl
(Also note that as of this writing, neither Klingon nor Ancient Greek
are in upstream CLDR data. Serving suggestion only.)
Don't use hard coded ../../out paths on windows. This was suggested by
@misterdjules as it causes test failures. With this fix, "out" is no
longer created on windows and the following can run properly:
python tools/test.py simple
Reduce space by about 1MB with ICU 54 (over without this patch). Also
trims a few other source files, but only conditional on the exact ICU
version used. This is to future-proof - a file that is unneeded now may
be needed in future ICUs.
Also:
* Update distclean to remove icu related files
* Refactor some code into tools/configure.d/nodedownload.py
* Update docs
* Add test
PR-URL: https://github.com/joyent/node/pull/8719
Fixes: https://github.com/joyent/node/issues/7676#issuecomment-64704230
[trev.norris@gmail.com small change to test's whitespace and logic]
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Commit 934bfe23a1 had introduced a
regression where node would crash trying to access a null unref timer if
a given unref timer's callback would remove other unref timers set to
fire in the future.
More generally, it makes the unrefTimeout function more solid by not
mutating the unrefList while traversing it.
Fixes#8897.
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This change fixes a regression introduced by commit
0d051238be, which contained a typo that
would cause every unrefd interval to fire only once.
Fixes#8900.
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
In cases where many small writes are made to a stream
lacking _writev, the array data structure backing the
WriteReq buffer would greatly increase GC pressure.
Specifically, in the fs.WriteStream case, the
clearBuffer routine would only clear a single WriteReq
from the buffer before exiting, but would cause the
entire backing array to be GC'd. Switching to [].shift
lessened pressure, but still the bulk of the time was
spent in memcpy.
This replaces that structure with a linked list-backed
queue so that adding and removing from the queue is O(1).
In the _writev case, collecting the buffer requires an
O(N) loop over the buffer, but that was already being
performed to collect callbacks, so slowdown should be
neglible.
PR-URL: https://github.com/joyent/node/pull/8826
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
A block of asserts were duplicated in
test/simple/test-child-process-spawn-typeerror.js. This commit
removes the duplicated asserts.
Fixes: https://github.com/joyent/node/pull/8454
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Before this change, _unrefActive would keep the unrefList sorted when
adding a new timer.
Because _unrefActive is called extremely frequently, this linear scan
(O(n) at worse) would make _unrefActive show high in the list of
contributors when profiling CPU usage.
This commit changes _unrefActive so that it doesn't try to keep the
unrefList sorted. The insertion thus happens in constant time.
However, when a timer expires, unrefTimeout has to go through the whole
unrefList because it's not ordered anymore.
It is usually not large enough to have a significant impact on
performance because:
- Most of the time, the timers will be removed before unrefTimeout is
called because their users (sockets mainly) cancel them when an I/O
operation takes place.
- If they're not, it means that some I/O took a long time to happen, and
the initiator of subsequents I/O operations that would add more timers
has to wait for them to complete.
With this change, _unrefActive does not show as a significant
contributor in CPU profiling reports anymore.
Fixes#8160.
PR-URL: #8751
Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
Instead of simply creating a new v8::Object to contain the connection
information, instantiate a new instance of a FunctionTemplate. This will
allow future improvements for debugging and performance probes.
Additionally, the "provider" argument in the ReqWrap constructor is no
longer optional.
PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
Async Listener was the name of the user-facing JS API, and is being
completely removed. Instead low level hooks directly into the mechanism
that AL used will be introduced in a future commit.
PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
The parse() function splits a path and returns an object
with the different elements. The format() function is the
reverse of this and adds an objects corresponding path
elements to make up a string. Fixes#6976.
Fixes: https://github.com/joyent/node/issues/6976
PR-URL: https://github.com/joyent/node/pull/8750
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
Add path.posix and path.win32 which have the specific methods like
resolve and normalize so you can specifically normalize or resolve
based on the target platform.
PR-URL: https://github.com/joyent/node/pull/5661
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
Do not abort the process if an error is thrown from within a domain, an
error handler is setup for the domain and --abort-on-uncaught-exception
was passed on the command line.
However, if an error is thrown from within the top-level domain's error
handler and --abort-on-uncaught-exception was passed on the command
line, make the process abort.
Fixes: https://github.com/joyent/node/issues/8631
Fixes: https://github.com/joyent/node/issues/8630
PR-URL: https://github.com/joyent/node/pull/8666
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Optional fork args should be type-checked with same behaviour as the
equivalent argument to spawn.
PR-URL: https://github.com/joyent/node/pull/8454
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
execFile and spawn have same API signature with respect to optional arg
array and optional options object, they should have same behaviour with
respect to argument validation.
PR-URL: https://github.com/joyent/node/pull/8454
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
The test wasn't checking directly that an assertion was thrown. Instead,
it was checking that spawn did not sucessfully spawn a non-existent
command.
However, the command chosen, dir, exists in GNU coreutils, so it exists
on Linux (though not on BSD derived OS X). The test as written passed on
Linux, even with the TypeError it is supposed to be checking for deleted
from spawn(). It would also pass on Windows if a ls.exe existed.
The approach is unnecessarily obscure, assert.throw() is for asserting
code throws, using it is more clear and works regardless of what
commands do or do not exist.
PR-URL: https://github.com/joyent/node/pull/8454
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Not allowing string was a change from v0.10 behaviour, commented on in
joyent/node#7991. Allow them again, but still check that argument is
numberish. Also, simplify the fragile and non-portable test code
introduced in 832ec1cd50 that required fixups 2a415358ee, and
ef3c4ed3d.
PR-URL: https://github.com/joyent/node/pull/8531
Reviewed-by: Trevor Norris <trev.norris@gmail.com>