[SERVER-17167] Shell breaks when a multiline function is input Created: 03/Feb/15  Updated: 18/Sep/15  Resolved: 03/Feb/15

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 3.0.0-rc7
Fix Version/s: 3.0.0-rc8

Type: Bug Priority: Critical - P2
Reporter: William Cross Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-16946 "it" not working in the javascript sh... Closed
is related to SERVER-5399 Add "quit" as a synonym for "exit" in... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

At the bash prompt:

echo "db.collection.find({" > broken_pipe.js
echo "})" >> broken_pipe.js
cat broken_pipe.js| mongo

This gives the output:

MongoDB shell version: 3.0.0-rc7
connecting to: test
2015-02-03T16:47:26.299-0500 E QUERY    SyntaxError: Unexpected token ILLEGAL
error2:SyntaxError: Unexpected token ILLEGAL
User interrupt detected; exiting...

Contrast this with:

mongo broken_pipe.js

which gives the output:

MongoDB shell version: 3.0.0-rc7
connecting to: test

Note that this break happened between 2.8.0-rc5 and 3.0.0-rc6.

Participants:

 Description   

The mongo shell breaks when given a multiline function, either directly in the shell or when piped in.

This is a problem because breaking functions into multiple lines can dramatically improve readability, and does not change the fact that they are valid javascript.



 Comments   
Comment by Githook User [ 04/Feb/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-17167 restore multiline functionality in shell

Revert "SERVER-5399 Essentially aliasing quit, exit, and function call variations."

This reverts commit f1d696d46b65dd1f76727b37d85e0c08c291f533.

(cherry picked from commit fc14926f9c8256edce8bbd15d439ca34667c6ebb)
Branch: v3.0
https://github.com/mongodb/mongo/commit/3f09e9dacbb34f9cdd45ac025ba0c8238eec5d31

Comment by Githook User [ 04/Feb/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-17167 restore multiline functionality in shell

Revert "SERVER-5399 SERVER-16946 fixed shell helper parsing"

This reverts commit 2d397b55c3207e875b6085944799b3c243ff4cf3.

(cherry picked from commit f67e39825ac93c0915db0192d7a35b3d73834388)
Branch: v3.0
https://github.com/mongodb/mongo/commit/f0531d8229e9a3e2d663ba0612495ad2ba4aa1b7

Comment by Githook User [ 03/Feb/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-17167 restore multiline functionality in shell

Revert "SERVER-5399 Essentially aliasing quit, exit, and function call variations."

This reverts commit f1d696d46b65dd1f76727b37d85e0c08c291f533.
Branch: master
https://github.com/mongodb/mongo/commit/fc14926f9c8256edce8bbd15d439ca34667c6ebb

Comment by Githook User [ 03/Feb/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-17167 restore multiline functionality in shell

Revert "SERVER-5399 SERVER-16946 fixed shell helper parsing"

This reverts commit 2d397b55c3207e875b6085944799b3c243ff4cf3.
Branch: master
https://github.com/mongodb/mongo/commit/f67e39825ac93c0915db0192d7a35b3d73834388

Comment by William Cross [ 03/Feb/15 ]

Depends on whitespace within a line, too:

db.collection.find({}
)

returns the error, but not:

db.collection.find( {}
)

(note the space preceding the braces in the second example)

Comment by William Cross [ 03/Feb/15 ]

stennie noted that this may be related to SERVER-5399.

Generated at Thu Feb 08 03:43:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.