Skip to content

Commit

Permalink
Merge tag 'v1.6.4' into next
Browse files Browse the repository at this point in the history
Conflicts:
	src/node_version.h
  • Loading branch information
bnoordhuis committed Apr 11, 2015
2 parents bcb4192 + f3e9da3 commit d6ab370
Show file tree
Hide file tree
Showing 682 changed files with 69,672 additions and 4,700 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ deps/icu*.zip
deps/icu*.tgz
deps/icu-tmp
./node_modules
android-toolchain/
.svn/

# generated by gyp on Windows
Expand Down
13 changes: 11 additions & 2 deletions BSDmakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
all:
@echo "I need GNU make. Please run \`gmake\` instead."
# pmake might add -J (private)
FLAGS=${.MAKEFLAGS:C/\-J ([0-9]+,?)+//W}

all: .DEFAULT
.DEFAULT:
@which gmake > /dev/null 2>&1 ||\
(echo "GMake is required for io.js to build.\
Install and try again" && exit 1)
@gmake ${.FLAGS} ${.TARGETS}

.PHONY: test
77 changes: 77 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,82 @@
# io.js ChangeLog

## 2015-04-06, Version 1.6.4, @Fishrock123

### Notable changes

* **npm**: upgrade npm to 2.7.5. See [npm CHANGELOG.md](https://github.com/npm/npm/blob/master/CHANGELOG.md#v275-2015-03-26) for details. Includes two important security fixes. Summary:
* [`300834e`](https://github.com/npm/npm/commit/300834e91a4e2a95fb7fb59c309e7c3fc91d2312)
`[email protected]`: Normalize symbolic links that point to targets outside the
extraction root. This prevents packages containing symbolic links from
overwriting targets outside the expected paths for a package. Thanks to [Tim
Cuthbertson](http://gfxmonk.net/) and the team at [Lift
Security](https://liftsecurity.io/) for working with the npm team to identify
this issue. ([@othiym23](https://github.com/othiym23))
* [`0dc6875`](https://github.com/npm/npm/commit/0dc68757cffd5397c280bc71365d106523a5a052)
`[email protected]`: Package versions can be no more than 256 characters long.
This prevents a situation in which parsing the version number can use
exponentially more time and memory to parse, leading to a potential denial of
service. Thanks to Adam Baldwin at Lift Security for bringing this to our
attention. ([@isaacs](https://github.com/isaacs))
* [`eab6184`](https://github.com/npm/npm/commit/eab618425c51e3aa4416da28dcd8ca4ba63aec41)
[#7766](https://github.com/npm/npm/issues/7766) One last tweak to ensure that
GitHub shortcuts work with private repositories.
([@iarna](https://github.com/iarna))
* [`a840a13`](https://github.com/npm/npm/commit/a840a13bbf0330157536381ea8e58d0bd93b4c05)
[#7746](https://github.com/npm/npm/issues/7746) Only fix up git URL paths when
there are paths to fix up. ([@othiym23](https://github.com/othiym23))
* **openssl**: preliminary work has been done for an upcoming upgrade to OpenSSL 1.0.2a [#1325](https://github.com/iojs/io.js/pull/1325) (Shigeki Ohtsu). See [#589](https://github.com/iojs/io.js/issues/589) for additional details.
* **timers**: a minor memory leak when timers are unreferenced was fixed, alongside some related timers issues [#1330](https://github.com/iojs/io.js/pull/1330) (Fedor Indutny). This appears to have fixed the remaining leak reported in [#1075](https://github.com/iojs/io.js/issues/1075).
* **android**: it is now possible to compile io.js for Android and related devices [#1307](https://github.com/iojs/io.js/pull/1307) (Giovanny Andres Gongora Granada).

### Known issues

* Some problems with unreferenced timers running during `beforeExit` are still to be resolved. See [#1264](https://github.com/iojs/io.js/issues/1264).
* Surrogate pair in REPL can freeze terminal [#690](https://github.com/iojs/io.js/issues/690)
* Not possible to build io.js as a static library [#686](https://github.com/iojs/io.js/issues/686)
* `process.send()` is not synchronous as the docs suggest, a regression introduced in 1.0.2, see [#760](https://github.com/iojs/io.js/issues/760) and fix in [#774](https://github.com/iojs/io.js/issues/774)
* Calling `dns.setServers()` while a DNS query is in progress can cause the process to crash on a failed assertion [#894](https://github.com/iojs/io.js/issues/894)

### Commits

* [[`3a69b7689b`](https://github.com/io.js/io.js/commit/3a69b7689b)] - **benchmark**: add rsa/aes-gcm performance test (Shigeki Ohtsu) [iojs/io.js#1325](https://github.com/iojs/io.js/pull/1325)
* [[`1c709f3aa9`](https://github.com/io.js/io.js/commit/1c709f3aa9)] - **benchmark**: add/remove hash algorithm (Shigeki Ohtsu) [iojs/io.js#1325](https://github.com/iojs/io.js/pull/1325)
* [[`a081c7c522`](https://github.com/io.js/io.js/commit/a081c7c522)] - **benchmark**: fix chunky client benchmark execution (Brian White) [iojs/io.js#1257](https://github.com/iojs/io.js/pull/1257)
* [[`65d4d25f52`](https://github.com/io.js/io.js/commit/65d4d25f52)] - **build**: default to armv7+vfpv3 for android (Giovanny Andres Gongora Granada) [iojs/io.js#1307](https://github.com/iojs/io.js/pull/1307)
* [[`6a134f7d70`](https://github.com/io.js/io.js/commit/6a134f7d70)] - **build**: avoid passing private flags from pmake (Johan Bergström) [iojs/io.js#1334](https://github.com/iojs/io.js/pull/1334)
* [[`5094a0fde3`](https://github.com/io.js/io.js/commit/5094a0fde3)] - **build**: Pass BSDmakefile args to gmake (Johan Bergström) [iojs/io.js#1298](https://github.com/iojs/io.js/pull/1298)
* [[`f782824d48`](https://github.com/io.js/io.js/commit/f782824d48)] - **deps**: refactor openssl.gyp (Shigeki Ohtsu) [iojs/io.js#1325](https://github.com/iojs/io.js/pull/1325)
* [[`21f4fb6215`](https://github.com/io.js/io.js/commit/21f4fb6215)] - **deps**: update gyp to e1c8fcf7 (Shigeki Ohtsu) [iojs/io.js#1325](https://github.com/iojs/io.js/pull/1325)
* [[`dac903f9b6`](https://github.com/io.js/io.js/commit/dac903f9b6)] - **deps**: make node-gyp work with io.js (cjihrig) [iojs/io.js#990](https://github.com/iojs/io.js/pull/990)
* [[`5eb983e0b3`](https://github.com/io.js/io.js/commit/5eb983e0b3)] - **deps**: upgrade npm to 2.7.5 (Forrest L Norvell) [iojs/io.js#1337](https://github.com/iojs/io.js/pull/1337)
* [[`008078862e`](https://github.com/io.js/io.js/commit/008078862e)] - **deps**: check in gtest, add util unit test (Ben Noordhuis) [iojs/io.js#1199](https://github.com/iojs/io.js/pull/1199)
* [[`48d69cf1bb`](https://github.com/io.js/io.js/commit/48d69cf1bb)] - ***Revert*** "**doc**: fix typo in CHANGELOG.md" (Giovanny Andres Gongora Granada) [iojs/io.js#1349](https://github.com/iojs/io.js/pull/1349)
* [[`679596c848`](https://github.com/io.js/io.js/commit/679596c848)] - **doc**: add Docker WG (Peter Petrov) [iojs/io.js#1134](https://github.com/iojs/io.js/pull/1134)
* [[`d8578bad25`](https://github.com/io.js/io.js/commit/d8578bad25)] - **doc**: fix minor typos in COLLABORATOR_GUIDE.md (Kelsey) [iojs/io.js#1320](https://github.com/iojs/io.js/pull/1320)
* [[`bde2b3e397`](https://github.com/io.js/io.js/commit/bde2b3e397)] - **doc**: fix typo in CHANGELOG.md (Giovanny Andres Gongora Granada) [iojs/io.js#1342](https://github.com/iojs/io.js/pull/1342)
* [[`8c6c376a94`](https://github.com/io.js/io.js/commit/8c6c376a94)] - **doc**: add GPG fingerprint for Fishrock123 (Jeremiah Senkpiel) [iojs/io.js#1324](https://github.com/iojs/io.js/pull/1324)
* [[`ccbea18960`](https://github.com/io.js/io.js/commit/ccbea18960)] - **doc**: better formatting for collaborator GPG keys (Jeremiah Senkpiel) [iojs/io.js#1324](https://github.com/iojs/io.js/pull/1324)
* [[`87053e8aee`](https://github.com/io.js/io.js/commit/87053e8aee)] - **doc**: add back quote to boolean variable 'true' (Kohei TAKATA) [iojs/io.js#1338](https://github.com/iojs/io.js/pull/1338)
* [[`634e9629a0`](https://github.com/io.js/io.js/commit/634e9629a0)] - **doc**: add TC meeting minutes 2015-03-04 (Rod Vagg) [iojs/io.js#1123](https://github.com/iojs/io.js/pull/1123)
* [[`245ba1d658`](https://github.com/io.js/io.js/commit/245ba1d658)] - **doc**: fix util.isObject documentation (Jeremiah Senkpiel) [iojs/io.js#1295](https://github.com/iojs/io.js/pull/1295)
* [[`ad937752ee`](https://github.com/io.js/io.js/commit/ad937752ee)] - **doc,src**: remove references to --max-stack-size (Aria Stewart) [iojs/io.js#1327](https://github.com/iojs/io.js/pull/1327)
* [[`15f058f609`](https://github.com/io.js/io.js/commit/15f058f609)] - **gyp**: fix build with python 2.6 (Fedor Indutny) [iojs/io.js#1325](https://github.com/iojs/io.js/pull/1325)
* [[`4dc6ae2181`](https://github.com/io.js/io.js/commit/4dc6ae2181)] - **lib**: remove unused variables (Brian White) [iojs/io.js#1290](https://github.com/iojs/io.js/pull/1290)
* [[`b6e22c4bd5`](https://github.com/io.js/io.js/commit/b6e22c4bd5)] - **src**: setup cluster workers before preloading (Ali Ijaz Sheikh) [iojs/io.js#1314](https://github.com/iojs/io.js/pull/1314)
* [[`4a801c211c`](https://github.com/io.js/io.js/commit/4a801c211c)] - **src**: drop homegrown thread pool, use libplatform (Ben Noordhuis) [iojs/io.js#1329](https://github.com/iojs/io.js/pull/1329)
* [[`f1e5a13516`](https://github.com/io.js/io.js/commit/f1e5a13516)] - **src**: wrap MIN definition in infdef (Johan Bergström) [iojs/io.js#1322](https://github.com/iojs/io.js/pull/1322)
* [[`6f72d87c27`](https://github.com/io.js/io.js/commit/6f72d87c27)] - **test**: add test for a unref'ed timer leak (Fedor Indutny) [iojs/io.js#1330](https://github.com/iojs/io.js/pull/1330)
* [[`416499c872`](https://github.com/io.js/io.js/commit/416499c872)] - **timers**: remove redundant code (Fedor Indutny) [iojs/io.js#1330](https://github.com/iojs/io.js/pull/1330)
* [[`d22b2a934a`](https://github.com/io.js/io.js/commit/d22b2a934a)] - **timers**: do not restart the interval after close (Fedor Indutny) [iojs/io.js#1330](https://github.com/iojs/io.js/pull/1330)
* [[`cca5efb086`](https://github.com/io.js/io.js/commit/cca5efb086)] - **timers**: don't close interval timers when unrefd (Julien Gilli)
* [[`0e061975d7`](https://github.com/io.js/io.js/commit/0e061975d7)] - **timers**: fix unref() memory leak (Trevor Norris) [iojs/io.js#1330](https://github.com/iojs/io.js/pull/1330)
* [[`ec7fbf2bb2`](https://github.com/io.js/io.js/commit/ec7fbf2bb2)] - **tools**: fix install source path for openssl headers (Oguz Bastemur) [iojs/io.js#1354](https://github.com/iojs/io.js/pull/1354)
* [[`644ece1f67`](https://github.com/io.js/io.js/commit/644ece1f67)] - **tools**: remove gyp test directory (Shigeki Ohtsu) [iojs/io.js#1350](https://github.com/iojs/io.js/pull/1350)
* [[`eb459c8151`](https://github.com/io.js/io.js/commit/eb459c8151)] - **tools**: fix gyp to work on MacOSX without XCode (Shigeki Ohtsu) [iojs/io.js#1325](https://github.com/iojs/io.js/pull/1325)
* [[`1e94057c05`](https://github.com/io.js/io.js/commit/1e94057c05)] - **url**: fix resolving from non-file to file URLs. (Jeffrey Jagoda) [iojs/io.js#1277](https://github.com/iojs/io.js/pull/1277)
* [[`382bd9d2e0`](https://github.com/io.js/io.js/commit/382bd9d2e0)] - **v8**: back-port openbsd/amd64 build fix (Ben Noordhuis) [iojs/io.js#1318](https://github.com/iojs/io.js/pull/1318)
* [[`efadffe861`](https://github.com/io.js/io.js/commit/efadffe861)] - **win,node-gyp**: optionally allow node.exe/iojs.exe to be renamed (Bert Belder) [iojs/io.js#1266](https://github.com/iojs/io.js/pull/1266)

## 2015-03-31, Version 1.6.3, @rvagg

### Notable changes
Expand Down
6 changes: 3 additions & 3 deletions COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ necessary.

## Accepting Modifications

All modifications to the the io.js code and documentation should be
All modifications to the io.js code and documentation should be
performed via GitHub pull requests, including modifications by
Collaborators and TC members.

Expand Down Expand Up @@ -89,7 +89,7 @@ information regarding the change process:
other Collaborators who have reviewed the change.
- A `PR-URL:` line that references the full GitHub URL of the original
pull request being merged so it's easy to trace a commit back to the
conversation that lead up to that change.
conversation that led up to that change.
- A `Fixes: X` line, where _X_ is either includes the full GitHub URL
for an issue, and/or the hash and commit message if the commit fixes
a bug in a previous commit. Multiple `Fixes:` lines may be added if
Expand Down Expand Up @@ -211,4 +211,4 @@ Time to push it:

```text
$ git push origin v1.x
```
```
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ distclean:

check: test

test: all
cctest: all
@out/$(BUILDTYPE)/$@

test: | cctest # Depends on 'all'.
$(PYTHON) tools/test.py --mode=release message parallel sequential -J
$(MAKE) jslint
$(MAKE) cpplint
Expand Down Expand Up @@ -120,7 +123,7 @@ test-debug: test-build
test-message: test-build
$(PYTHON) tools/test.py message

test-simple: all
test-simple: | cctest # Depends on 'all'.
$(PYTHON) tools/test.py parallel sequential

test-pummel: all
Expand Down Expand Up @@ -402,4 +405,9 @@ cpplint:

lint: jslint cpplint

.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install install-includes install-bin all staticlib dynamiclib test test-all test-addons build-addons website-upload pkg blog blogclean tar binary release-only bench-http-simple bench-idle bench-all bench bench-misc bench-array bench-buffer bench-net bench-http bench-fs bench-tls
.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean \
check uninstall install install-includes install-bin all staticlib \
dynamiclib test test-all test-addons build-addons website-upload pkg \
blog blogclean tar binary release-only bench-http-simple bench-idle \
bench-all bench bench-misc bench-array bench-buffer bench-net \
bench-http bench-fs bench-tls cctest
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ To run the tests:
> vcbuild test
```

### Android / Android based devices, aka. Firefox OS

Be sure you have downloaded and extracted [Android NDK]
(https://developer.android.com/tools/sdk/ndk/index.html)
before in a folder. Then run:

```
$ ./android-configure /path/to/your/android-ndk
$ make
```

### `Intl` (ECMA-402) support:

[Intl](https://github.com/joyent/node/wiki/Intl) support is not
Expand Down Expand Up @@ -262,14 +273,15 @@ information about the governance of the io.js project, see
* **Fedor Indutny** ([@indutny](https://github.com/indutny)) <[email protected]> (Technical Committee)
* **Trevor Norris** ([@trevnorris](https://github.com/trevnorris)) <[email protected]> (Technical Committee)
* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <[email protected]> (Technical Committee)
<br>Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
- Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
* **Colin Ihrig** ([@cjihrig](https://github.com/cjihrig)) &lt;[email protected]&gt;
* **Mikeal Rogers** ([@mikeal](https://github.com/mikeal)) &lt;[email protected]&gt;
* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) &lt;[email protected]&gt;
<br>Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
- Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
* **Thorsten Lorenz** ([@thlorenz](https://github.com/thlorenz)) &lt;[email protected]&gt;
* **Stephen Belanger** ([@qard](https://github.com/qard)) &lt;[email protected]&gt;
* **Jeremiah Senkpiel** ([@fishrock123](https://github.com/fishrock123)) &lt;[email protected]&gt;
- Release GPG key: FD3A5288F042B6850C66B31F09FE44734EB7990E
* **Evan Lucas** ([@evanlucas](https://github.com/evanlucas)) &lt;[email protected]&gt;
* **Brendan Ashworth** ([@brendanashworth](https://github.com/brendanashworth)) &lt;[email protected]&gt;
* **Vladimir Kurchatkin** ([@vkurchatkin](https://github.com/vkurchatkin)) &lt;[email protected]&gt;
Expand Down
13 changes: 12 additions & 1 deletion WORKING_GROUPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ back in to the TC.
* [i18n](#i18n)
* [Evangelism](#evangelism)
* [Roadmap](#roadmap)
* [Docker](#docker)
* [Starting a Working Group](#starting-a-wg)
* [Bootstrap Governance](#bootstrap-governance)

Expand Down Expand Up @@ -67,7 +68,6 @@ Its responsibilities are:
* Produce Packages for all target platforms.
* Run tests.
* Run performance testing and comparisons.
* Creates and manages official docker images.
* Creates and manages build-containers.


Expand Down Expand Up @@ -168,6 +168,17 @@ Their responsibilities are:
* Create Pull Requests for relevant changes to [Roadmap.md](./ROADMAP.md)


### [Docker](https://github.com/iojs/docker-iojs)

The Docker working group's purpose is to build, maintain, and improve official
Docker images for the `io.js` project.

Their responsibilities are:
* Keep the official Docker images updated in line with new `io.js` releases.
* Decide and implement image improvements and/or fixes.
* Maintain and improve the images' documentation.


## Starting a WG

A Working Group is established by first defining a charter that can be
Expand Down
10 changes: 5 additions & 5 deletions android-configure
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
export TOOLCHAIN=$PWD/android-toolchain
mkdir -p $TOOLCHAIN
$1/build/tools/make-standalone-toolchain.sh \
--toolchain=arm-linux-androideabi-4.7 \
--toolchain=arm-linux-androideabi-4.9 \
--arch=arm \
--install-dir=$TOOLCHAIN \
--platform=android-9
export PATH=$TOOLCHAIN/bin:$PATH
export AR=arm-linux-androideabi-ar
export CC=arm-linux-androideabi-gcc
export CXX=arm-linux-androideabi-g++
export LINK=arm-linux-androideabi-g++
export AR=$TOOLCHAIN/bin/arm-linux-androideabi-ar
export CC=$TOOLCHAIN/bin/arm-linux-androideabi-gcc
export CXX=$TOOLCHAIN/bin/arm-linux-androideabi-g++
export LINK=$TOOLCHAIN/bin/arm-linux-androideabi-g++

./configure \
--dest-cpu=arm \
Expand Down
38 changes: 38 additions & 0 deletions benchmark/crypto/aes-gcm-throughput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
var common = require('../common.js');
var crypto = require('crypto');
var keylen = {'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32};
var bench = common.createBenchmark(main, {
n: [500],
cipher: ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'],
len: [1024, 4 * 1024, 16 * 1024, 64 * 1024, 256 * 1024, 1024 * 1024]
});

function main(conf) {
var message = (new Buffer(conf.len)).fill('b');
var key = crypto.randomBytes(keylen[conf.cipher]);
var iv = crypto.randomBytes(12);
var associate_data = (new Buffer(16)).fill('z');
bench.start();
AEAD_Bench(conf.cipher, message, associate_data, key, iv, conf.n, conf.len);
}

function AEAD_Bench(cipher, message, associate_data, key, iv, n, len) {
var written = n * len;
var bits = written * 8;
var mbits = bits / (1024 * 1024);

for (var i = 0; i < n; i++) {
var alice = crypto.createCipheriv(cipher, key, iv);
alice.setAAD(associate_data);
var enc = alice.update(message);
alice.final();
var tag = alice.getAuthTag();
var bob = crypto.createDecipheriv(cipher, key, iv);
bob.setAuthTag(tag);
bob.setAAD(associate_data);
var clear = bob.update(enc);
bob.final();
}

bench.end(mbits);
}
2 changes: 1 addition & 1 deletion benchmark/crypto/hash-stream-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var crypto = require('crypto');

var bench = common.createBenchmark(main, {
writes: [500],
algo: [ 'sha256', 'md5' ],
algo: ['sha1', 'sha256', 'sha512'],
type: ['asc', 'utf', 'buf'],
len: [2, 1024, 102400, 1024 * 1024],
api: ['legacy', 'stream']
Expand Down
45 changes: 45 additions & 0 deletions benchmark/crypto/rsa-encrypt-decrypt-throughput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// throughput benchmark in signing and verifying
var common = require('../common.js');
var crypto = require('crypto');
var fs = require('fs');
var path = require('path');
var fixtures_keydir = path.resolve(__dirname, '../../test/fixtures/keys/');
var keylen_list = ['1024', '2048', '4096'];
var RSA_PublicPem = {};
var RSA_PrivatePem = {};

keylen_list.forEach(function(key) {
RSA_PublicPem[key] = fs.readFileSync(fixtures_keydir +
'/rsa_public_' + key + '.pem');
RSA_PrivatePem[key] = fs.readFileSync(fixtures_keydir +
'/rsa_private_' + key + '.pem');
});

var bench = common.createBenchmark(main, {
n: [500],
keylen: keylen_list,
len: [16, 32, 64]
});

function main(conf) {
var crypto = require('crypto');
var message = (new Buffer(conf.len)).fill('b');

bench.start();
StreamWrite(conf.algo, conf.keylen, message, conf.n, conf.len);
}

function StreamWrite(algo, keylen, message, n, len) {
var written = n * len;
var bits = written * 8;
var kbits = bits / (1024);

var privateKey = RSA_PrivatePem[keylen];
var publicKey = RSA_PublicPem[keylen];
for (var i = 0; i < n; i++) {
var enc = crypto.privateEncrypt(privateKey, message);
var clear = crypto.publicDecrypt(publicKey, enc);
}

bench.end(kbits);
}
Loading

0 comments on commit d6ab370

Please sign in to comment.