Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-13430

Config parser allows unbalanced quotation marks

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Configuration
    • None
    • Storage Engines
    • 3
    • StorEng - Defined Pipeline

      Reproducer:

      # Current commit: commit bc2394f9127a2462cc6249300dca5c8553347ace (HEAD -> develop, origin/develop, origin/HEAD)
      
      # Diff:
      diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c
      index 79499fe920..02d4c07ced 100644
      --- a/examples/c/ex_all.c
      +++ b/examples/c/ex_all.c
      @@ -1077,7 +1077,7 @@ connection_ops(WT_CONNECTION *conn)
           {
               /*! [Open a session] */
               WT_SESSION *session;
      -        error_check(conn->open_session(conn, NULL, NULL, &session));
      +        error_check(conn->open_session(conn, NULL, "\"foobar", &session));
               /*! [Open a session] */
      
      # You can now build and run ex_all without any issues. 
      

      WT also does not complain if the config is made of a single quote: "\"".

      The expected output would be EINVAL. A "valid" invalid config value would be for instance:

      diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c
      index 79499fe920..b7382e2235 100644
      --- a/examples/c/ex_all.c
      +++ b/examples/c/ex_all.c
      @@ -1077,7 +1077,7 @@ connection_ops(WT_CONNECTION *conn)
           {
               /*! [Open a session] */
               WT_SESSION *session;
      -        error_check(conn->open_session(conn, NULL, NULL, &session));
      +        error_check(conn->open_session(conn, NULL, "foobar", &session));
               /*! [Open a session] */
       
               session_ops(session);
      

      And this gives:

      % ./ex_all
      The database home is WT_HOME
      [1724134583:59531][1646:0x2028f0f40], WT_CONNECTION.open_session: [WT_VERB_DEFAULT][ERROR]: int __config_check_search(WT_SESSION_IMPL *, const WT_CONFIG_CHECK *, u_int, const WT_CONFIG_ITEM *, const uint8_t *, const WT_CONFIG_CHECK **), 114: unknown configuration key 'foobar': Invalid argument
      ex_all: FAILED: void connection_ops(WT_CONNECTION *)/1080: conn->open_session(conn, NULL, "foobar", &session): Invalid argument
      ex_all: process aborting
      WiredTiger Error: void __wt_abort(WT_SESSION_IMPL *), 28: aborting WiredTiger library
      zsh: abort      ./ex_all
      

            Assignee:
            keith.smith@mongodb.com Keith Smith
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: