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

pathExists on empty string prints stack trace

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.7.1
    • Affects Version/s: None
    • Component/s: Shell
    • Labels:
      None
    • Fully Compatible
    • Platforms 2017-10-23, Platforms 2017-11-13, Platforms 2017-12-04
    • 0

      To reproduce this, run inside a shell:

      pathExists("");
      

      The output is something like:

       mongo(_ZN5mongo15printStackTraceERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEE+0x3A) [0x101077f8a]
       mongo(_ZN5mongo10logContextEPKc+0x15F) [0x100ffee6f]
       mongo(_ZN5mongo12verifyFailedEPKcS1_j+0x230) [0x100fed9d0]
       mongo(_ZN5mongo11shell_utils10PathExistsERKNS_7BSONObjEPv+0x220) [0x100fda730]
       mongo(_ZN5mongo5mozjs18NativeFunctionInfo4callEP9JSContextN2JS8CallArgsE+0xC1) [0x100f8cce1]
       mongo(_ZN5mongo5mozjs7smUtils4callINS0_18NativeFunctionInfoEEEbP9JSContextjPN2JS5ValueE+0x36) [0x100f6fd56]
       mongo(_ZN2js6InvokeEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE+0x2D7) [0x10171d717]
       mongo(_ZL9InterpretP9JSContextRN2js8RunStateE+0xBE18) [0x1017167b8]
       mongo(_ZN2js9RunScriptEP9JSContextRNS_8RunStateE+0x1E9) [0x10170a949]
       mongo(_ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_11ExecuteTypeENS_16AbstractFramePtrEPS9_+0x13B) [0x10171e10b]
       mongo(_ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE+0xE8) [0x10171e298]
       mongo(_ZL13ExecuteScriptP9JSContextN2JS6HandleIP8JSObjectEENS2_IP8JSScriptEEPNS1_5ValueE+0x2B) [0x1015bb66b]
       mongo(_Z16JS_ExecuteScriptP9JSContextN2JS6HandleIP8JSScriptEENS1_13MutableHandleINS1_5ValueEEE+0x62) [0x1015bb602]
       mongo(_ZN5mongo5mozjs14MozJSImplScope4execENS_10StringDataERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbbbi+0x1AF) [0x100f6d8ef]
       mongo(_ZNSt3__110__function6__funcIZN5mongo5mozjs15MozJSProxyScope4execENS2_10StringDataERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEbbbiE4$_26NS9_ISE_EEFvvEEclEv+0x4F) [0x100f9f80f]
       mongo(_ZN5mongo5mozjs15MozJSProxyScope10implThreadEPv+0x1B9) [0x100f9b519]
       mongo(_ZN4nspr6Thread13ThreadRoutineEPv+0x1C) [0x100f50afc]
       mongo(_ZNSt3__114__thread_proxyINS_5tupleIJPFPvS2_EPN4nspr6ThreadEEEEEES2_S2_+0x61) [0x100f510e1]
       libsystem_pthread.dylib(_pthread_body+0xB4) [0x7fffe9be293b]
       libsystem_pthread.dylib(_pthread_body+0x0) [0x7fffe9be2887]
       libsystem_pthread.dylib(thread_start+0xD) [0x7fffe9be208d]
      -----  END BACKTRACE  -----
      2017-10-03T17:46:25.108-0400 E QUERY    [thread1] Error: assertion src/mongo/shell/shell_utils_launcher.cpp:808 
      

      I think it'd be better to just return false in this case (unless if there's already specific reason not to).

      Also, when the fuzzer produces a statement like this, the logs end up getting polluted with the resulting stack traces, which can make it more difficult to find stack information for "real bugs."

            Assignee:
            fiona.rowan@mongodb.com Fiona Rowan
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: