Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-17167

Shell breaks when a multiline function is input

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Fixed
    • 3.0.0-rc7
    • 3.0.0-rc8
    • Shell
    • None
    • Fully Compatible
    • ALL
    • Hide

      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.

      Show
      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.

    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.

      Attachments

        Issue Links

          Activity

            People

              benety.goh@mongodb.com Benety Goh
              william.cross William Cross
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: