Skip to content
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

Node repl crashes when trying to convert old JSON history file to new line separated one #4102

Closed
zeusdeux opened this issue Dec 1, 2015 · 1 comment
Labels
repl Issues and PRs related to the REPL subsystem.

Comments

@zeusdeux
Copy link
Contributor

zeusdeux commented Dec 1, 2015

If NODE_REPL_HISTORY_FILE was set as $HOME/.node_repl_history pre-v3.0 and if it is empty, running node (post-v3.0) throws.

Twitter conversation about this between @chrisdickinson, @Fishrock123 and myself is here.

Edit: So, I had NODE_REPL_HISTORY_FILE set to $HOME/.node_repl_history but I didn't have the file. Running node created an empty file and since oldHistoryPath was truthy in the call to onread in internal/repl.js, it tried to JSON.parse an empty string and threw.

@mscdex mscdex added the repl Issues and PRs related to the REPL subsystem. label Dec 1, 2015
@zeusdeux
Copy link
Contributor Author

zeusdeux commented Dec 1, 2015

Working on the fix for this right now.

zeusdeux added a commit to zeusdeux/node that referenced this issue Dec 16, 2015
If the deprecated NODE_REPL_HISTORY_FILE is set to default
node history file path ($HOME/.node_repl_history) and the file
doesn't exist, then node creates the file and then crashes when
it tries to parse that file as JSON thinking that it's an older
JSON formatted history file. This fixes that bug.

This patch also prevents node repl from throwing if the old
history file is empty or if $HOME/.node_repl_history is empty.
Fishrock123 pushed a commit to Fishrock123/node that referenced this issue Dec 22, 2015
If the deprecated NODE_REPL_HISTORY_FILE is set to default
node history file path ($HOME/.node_repl_history) and the file
doesn't exist, then node creates the file and then crashes when
it tries to parse that file as JSON thinking that it's an older
JSON formatted history file. This fixes that bug.

This patch also prevents node repl from throwing if the old
history file is empty or if $HOME/.node_repl_history is empty.

Fixes: nodejs#4102
PR-URL: nodejs#4108
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Fishrock123 pushed a commit to Fishrock123/node that referenced this issue Jan 6, 2016
If the deprecated NODE_REPL_HISTORY_FILE is set to default
node history file path ($HOME/.node_repl_history) and the file
doesn't exist, then node creates the file and then crashes when
it tries to parse that file as JSON thinking that it's an older
JSON formatted history file. This fixes that bug.

This patch also prevents node repl from throwing if the old
history file is empty or if $HOME/.node_repl_history is empty.

Fixes: nodejs#4102
PR-URL: nodejs#4108
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this issue Jan 13, 2016
If the deprecated NODE_REPL_HISTORY_FILE is set to default
node history file path ($HOME/.node_repl_history) and the file
doesn't exist, then node creates the file and then crashes when
it tries to parse that file as JSON thinking that it's an older
JSON formatted history file. This fixes that bug.

This patch also prevents node repl from throwing if the old
history file is empty or if $HOME/.node_repl_history is empty.

Fixes: #4102
PR-URL: #4108
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this issue Jan 19, 2016
If the deprecated NODE_REPL_HISTORY_FILE is set to default
node history file path ($HOME/.node_repl_history) and the file
doesn't exist, then node creates the file and then crashes when
it tries to parse that file as JSON thinking that it's an older
JSON formatted history file. This fixes that bug.

This patch also prevents node repl from throwing if the old
history file is empty or if $HOME/.node_repl_history is empty.

Fixes: #4102
PR-URL: #4108
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
scovetta pushed a commit to scovetta/node that referenced this issue Apr 2, 2016
If the deprecated NODE_REPL_HISTORY_FILE is set to default
node history file path ($HOME/.node_repl_history) and the file
doesn't exist, then node creates the file and then crashes when
it tries to parse that file as JSON thinking that it's an older
JSON formatted history file. This fixes that bug.

This patch also prevents node repl from throwing if the old
history file is empty or if $HOME/.node_repl_history is empty.

Fixes: nodejs#4102
PR-URL: nodejs#4108
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants