-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
repl: don't crash if self is not in replMap #7718
Conversation
Paging REPL folks: @addaleax @Fishrock123 |
Sorry, no idea what's up here. |
@evanlucas Alternatively, this will fix it too:
|
@Trott that does work for me as well. Want to submit a PR for it? Or should I just change it here? |
This patch seems to be the Right Way™ to stop the undefined reference from occurring in the first place: diff --git a/lib/repl.js b/lib/repl.js
index ed896552656c..82f532f42e5f 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -727,12 +727,12 @@ function complete(line, callback) {
});
var flat = new ArrayStream(); // make a new "input" stream
var magic = new REPLServer('', flat); // make a nested REPL
+ replMap.set(magic, replMap.get(this));
magic.context = magic.createContext();
flat.run(tmp); // eval the flattened code
// all this is only profitable if the nested REPL
// does not have a bufferedCommand
if (!magic.bufferedCommand) {
- replMap.set(magic, replMap.get(this));
return magic.complete(line, callback);
}
} ( I’m inclined to say that some larger refactoring of the entire REPL completion implementation might be a good idea in the long run. |
I'm not sure which is better--I can think of hypothetical pros and cons for both, although they might not hold up to closer scrutiny of the code. And it's possible that there's a third fix lurking in there. (I have an idea half-formed.) If this isn't super-critical to fix RIGHT AWAY, I think what I'd like to do is get the code coverage up a bit by adding other tests first, just to get a few more wonky edge cases in the mix. There's about 54 statements in Then, once the tests are in place, try out both fixes, and maybe a third option if I can put it together, and see how they all do. Maybe try to break one or the other to see if we can. Alternatively, if you want to get this fixed ASAP, by all means, add a test and land either fix. |
Oh, I should add that there's an excellent chance what's going on is that I or someone else failed to account for something or other about |
What's really weird is that the test from test/parallel/test-repl-tab-complete-crash.js should not be passing. The |
@Trott |
@evanlucas Do you want to use my patch for this PR? The reason |
@addaleax yea, I've been working on fixing that test as well. That test should still call the event handler, IMO. I have traced the reason back to the domain exiting. So, not really sure if that is another bug in itself or not... I'll be able to update tonight/tomorrow hopefully |
Ok, updated. PTAL |
LGTM with CI (which I would start if loading Jenkins didn’t take, like, ages rn) |
Fixes: nodejs#7716 PR-URL: nodejs#7718 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in 392c70a. Thanks! |
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
repl
Description of change
Fixes: #7716
This fixes an undefined referenced. I am still trying to figure out why the undefined reference is occurring though, so marking as WIP.