| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
This is a fix for #7655. @micnic @thealphanerd This can be safely backported, if necessary. |
Sorry, something went wrong.
|
LGTM with some comments As I see, in some fs stream prototype constructors Object.create() is used instead of utils._extend(), it would be good to use a single object properties copying method About tests, it would be good to have such tests for other methods that receive as parameters user defined objects, cc @nodejs/testing |
Sorry, something went wrong.
There was a problem hiding this comment.
Please add common.mustCall() to the callback.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
minor nit... s/don't/Don't
(there are multiple comments in this doc that start with lower case that should be uppercase)
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
|
cc @nodejs/collaborators |
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
|
CI: https://ci.nodejs.org/job/node-test-pull-request/3456/ |
Sorry, something went wrong.
|
Object.assign might be better than util._extend which would be deprecated by the former one day? |
Sorry, something went wrong.
|
@thefourtheye Why does this remove Object.create() from tests? Does it break with Object.create()? |
Sorry, something went wrong.
> Object.create(Object.create({encoding: 'utf8'})).encoding
'utf8'
> util._extend({}, Object.create({encoding: 'utf8'})).encoding
undefinedDoesn't it make this semver-major? |
Sorry, something went wrong.
@ChALkeR because the Object.create takes its arguments into prototype chain, not the direct field, but the Object.keys that the util._extend is internally using does not return keys from prototype chain as below:
|
Sorry, something went wrong.
|
@yorkie, so, this means that it actually broke those tests? |
Sorry, something went wrong.
Yea, we have to change those cases IMO :-( |
Sorry, something went wrong.
|
Labeling as semver-major due to a breaking change. Note that it also changes existing tests expectations. Feel free to remove the semver-major label if this will be changed so that all the existing tests pass. Could we keep support for those somehow? Btw, this potentially could break some modules out there, so I'm not even sure if landing this in the current state to 7.0 without a deprecation cycle will be fine. Refs: #7912. Note: it's not semver-major due to the actual intended change that is described in the commit title, it's semver-major because passing something like Object.create({encoding: 'utf8'}) worked before and doesn't work now. |
Sorry, something went wrong.
|
@nodejs/ctc ... any further thoughts on this? |
Sorry, something went wrong.
|
What is this options = Object.create(options) trying to achieve anyways? |
Sorry, something went wrong.
Sorry, something went wrong.
|
@silverwind We add few properties to options object passed by users, in few of the fs APIs. Object.create(options) would avoid mutating the original options object passed by user. |
Sorry, something went wrong.
|
@thefourtheye Wouldn't something like: const options = { a: { b: 1 } };
const newOptions = Object.create(options);
newOptions.a.b = 2;
still alter the original options object? |
Sorry, something went wrong.
|
The status post must be wrong as there was a failure on aix even though the check above show as green. I assume this was not seen earlier as the test did not make it that far. not ok 338 parallel/test-fs-options-immutable # events.js:160 # throw er; // Unhandled 'error' event # ^ # # Error: ENOENT: no such file or directory, open '/home/iojs/node-tmp/tmp.0/streams' --- |
Sorry, something went wrong.
|
Hmm, see it passed in an earlier CI run so not sure why that would fail unless there could be some conflict with temp directory generation and other tests running in parallel ? Failure on PPC was unrelated as its related to the know test-tic-processor-issues covered in: #8725 |
Sorry, something went wrong.
|
Stress run on AIX https://ci.nodejs.org/job/node-stress-single-test/986/ |
Sorry, something went wrong.
|
Seems to fail consistently in stress run, did the test change since the successful CI run ? |
Sorry, something went wrong.
|
Investigating locally, believe it may be because the test assumes the write will complete before the read starts which is not guaranteed |
Sorry, something went wrong.
|
Yes believe it is a race condition in the test. This version passes reliably: {
const fileName = path.resolve(common.tmpDir, 'streams');
assert.doesNotThrow(() =>
fs.WriteStream(fileName, options).once('open', () => {
assert.doesNotThrow(() => fs.ReadStream(fileName, options))
})
);
}
|
Sorry, something went wrong.
|
Awesome. Thanks for digging deeper and providing a fix as well, @mhdawson :-) https://ci.nodejs.org/job/node-stress-single-test/989/ is Green. One last CI Run before landing: https://ci.nodejs.org/job/node-test-pull-request/4437/ |
Sorry, something went wrong.
This patch makes a copy of the `options` object before the fs module functions alter it. PR-URL: nodejs#7831 Fixes: nodejs#7655 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Nicu Micleușanu <micnic90@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
|
I had to rebase because of the linter rule upgrade. New CI: https://ci.nodejs.org/job/node-test-pull-request/4440/ |
Sorry, something went wrong.
|
FreeBSD failures are not related. Landing this now... |
Sorry, something went wrong.
|
This does not land cleanly on v7.x-staging without the semver-major #7165 also applied. |
Sorry, something went wrong.
|
@jasnell Oh, do you want me to PR this targeting 7.x? |
Sorry, something went wrong.
|
No no, sorry i wasn't clear. Both prs landed in v7.x-staging, I was just On Monday, October 10, 2016, Sakthipriyan Vairamani <
|
Sorry, something went wrong.
|
Backport PRs will be necessary if desired, this appears to depend on #7165 / I don't know how to resolve easily. |
Sorry, something went wrong.
This patch makes a copy of the `options` object before the fs module functions alter it. PR-URL: nodejs/node#7831 Fixes: nodejs/node#7655 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Nicu Micleușanu <micnic90@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
This patch makes a copy of the `options` object before the fs module functions alter it. PR-URL: nodejs/node#7831 Fixes: nodejs/node#7655 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Nicu Micleușanu <micnic90@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
This patch makes a copy of the `options` object before the fs module functions alter it. PR-URL: nodejs/node#7831 Fixes: nodejs/node#7655 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Nicu Micleușanu <micnic90@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
| Back | FazBrowse Home | New Git URL |
Checklist
Affected core subsystem(s)
fs
Description of change
This patch makes a copy of the options object before altering it.
cc @nodejs/fs