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

Shell's cd() and mkdir() functions should validate user input and not print stack trace

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.5.1
    • Affects Version/s: 2.4.0-rc2
    • Component/s: Shell
    • None
    • Environment:
      macosx source build
    • Minor Change
    • ALL

      running cd() function on the shell produced the following stack trace:

      > cd 
      function cd() { [native code] }
      > cd()
      Mon Mar 11 09:38:08.331 Assertion: 13111:field not found, expected type 2
      0x102b04e6b 0x102ae36be 0x102ae377d 0x102a2b571 0x102a2b5f9 0x102a2d936 0x102ac84e0 0x102ac713d 0x102bc4a40 0x33e29f306362 
       0   mongo                               0x0000000102b04e6b _ZN5mongo15printStackTraceERSo + 43
       1   mongo                               0x0000000102ae36be _ZN5mongo11msgassertedEiPKc + 174
       2   mongo                               0x0000000102ae377d _ZN5mongo11msgassertedEiRKSs + 29
       3   mongo                               0x0000000102a2b571 _ZNK5mongo11BSONElement3chkEi + 793
       4   mongo                               0x0000000102a2b5f9 _ZNK5mongo11BSONElement6StringEv + 41
       5   mongo                               0x0000000102a2d936 _ZN5mongo11shell_utils2cdERKNS_7BSONObjEPv + 102
       6   mongo                               0x0000000102ac84e0 _ZN5mongo7V8Scope14nativeCallbackEPS0_RKN2v89ArgumentsE + 680
       7   mongo                               0x0000000102ac713d _ZN5mongo7V8Scope10v8CallbackERKN2v89ArgumentsE + 123
       8   mongo                               0x0000000102bc4a40 _ZN2v88internalL21Builtin_HandleApiCallENS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEEPNS0_7IsolateE + 464
       9   ???                                 0x000033e29f306362 0x0 + 57048426373986
      Mon Mar 11 09:38:08.337 JavaScript execution failed: Error: field not found, expected type 2
      

      The mkdir() function has the same problem.

      These functions should throw a UserAssertion on a failure to validate their input arguments, resulting in a JavaScript exceptiojn that can be trapped by user code. They should not print a stack trace.

            Assignee:
            tad Tad Marshall
            Reporter:
            norberto.leite Norberto Fernando Rocha Leite (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: