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

Shell breaks when a multiline function is input

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-rc7
    • Fix Version/s: 3.0.0-rc8
    • Component/s: Shell
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      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

              Assignee:
              benety.goh Benety Goh
              Reporter:
              william.cross William Cross
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: