Skip to content
Snippets Groups Projects
  1. Aug 23, 2022
    • Gleb Kashkin's avatar
      console: fix multiline commands saved as oneline · d2271ec0
      Gleb Kashkin authored
      When multiline commands were loaded from .tarantool_history, they were
      treated as a bunch of oneline commands. Now readline is configured to
      write timestamps in .tarantool_history as delimiters and multiline
      commands are handled correctly.
      
      If there is already a .tarantool_history file, readline will set
      timestamps automatically, nothing will be lost.
      
      Closes #7320
      NO_DOC=bugfix
      NO_TEST=impossible to check readline history from lua
      d2271ec0
  2. Jul 19, 2022
    • Rianov Viacheslav's avatar
      lua: fix sigint behavior in multiline input mode · e8abbcbc
      Rianov Viacheslav authored
      This patch fixes the ctrl+c behavior in multiline mode.
      The old behavior was ignoring sigint in this mode.
      The new behavior is quitting this mode and printing the new
      default prompt.
      Added a new test for covering the mentioned case.
      
      Follows up #2717
      Closes #7109
      
      NO_DOC=BUGFIX
      e8abbcbc
  3. Jul 14, 2022
    • Ilya Verbin's avatar
      console: raise error if lua_encode failed · 69852e1f
      Ilya Verbin authored
      lua_encode can raise an exception (e.g. from luaL_checkfield) or return
      `nil, err` result. Handle it in lbox_console_format_lua, similar to
      lbox_console_format_yaml.
      
      When fixed, it will expose another issue - nil value can not be
      serialized:
      
      ```
      tarantool> \set output lua
      true;
      tarantool> 1, nil, 2
      1, {error = "console: exception while formatting the output:
          \"serializer: unexpected data (nd.field.size 0 nd.field.type 5)\""}, 2;
      tarantool>
      ```
      
      Fix this too.
      
      Part of #6781
      Part of #6934
      
      NO_DOC=bugfix
      NO_TEST=not a visible change
      NO_CHANGELOG=not a visible change
      69852e1f
    • Ilya Verbin's avatar
      console: check lua_yaml_encode error in lbox_console_format_yaml · c84cdc73
      Ilya Verbin authored
      This patch adds a missed check for `lua_yaml_encode` return value,
      similar to the check in `console_dump_plain`. Now Lua error is raised
      if YAML encoding failed for any reason (e.g. OOM or formatting error).
      
      Before:
      ```
      tarantool> box.error.new(box.error.ILLEGAL_PARAMS, '\x80')
      ~/test$ echo $?
      0
      ~/test$
      ```
      
      After:
      ```
      tarantool> box.error.new(box.error.ILLEGAL_PARAMS, '\x80')
      ---
      - error: 'console: an exception occurred when formatting the output:
          expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS'
      ...
      
      tarantool>
      ```
      
      Part of #6781
      Part of #6934
      
      NO_DOC=bugfix
      NO_TEST=see later commits
      NO_CHANGELOG=see later commits
      c84cdc73
  4. Apr 13, 2022
    • Vladimir Davydov's avatar
      console: add internal on_console_eval trigger · d0ce4c9a
      Vladimir Davydov authored
      The trigger is invoked on console eval. The trigger callback is passed
      the eval expression string. It will be used for auditing console events
      in the EE version.
      
      NO_TEST=ee
      NO_DOC=internal
      NO_CHANGELOG=internal
      d0ce4c9a
  5. Mar 18, 2022
    • Sergey Ostanevich's avatar
      console: introduce __autocomplete metamethod · 7817fc13
      Sergey Ostanevich authored
      This patch updates the logic in lua_rl_complete() where __index from
      a metatable apparently expected to be a table, not a function. It is
      rather simple for a table object, but some of them are userdata, so
      an __autocomplete method is introduced to be sure it returns a table
      with all names suitable for tabcompletion.
      
      Part of #6305
      NO_DOC=internal
      NO_CHANGELOG=part of a fix
      7817fc13
  6. Mar 17, 2022
    • vr009's avatar
      lua: fix SIGINT handling · a8b3b267
      vr009 authored
      Tarantool console quits if you type Ctrl+C.
      This patch fixes console behavior on sending SIGINT.
      Console discards the current input on typing Ctrl+C
      and invites user to the new line.
      
      In daemon mode the process will exit after receiving SIGINT.
      
      Test gh-2717 should be skipped on release build, cause it
      uses error injection which is enabled only on debug mode.
      
      Fixes #2717
      
      @TarantoolBot document
      Title: Use Ctrl+C to discard the input in console
      
      The signal SIGINT discards the input in console mode.
      When tarantool executes with -e flag or runs as a daemon, SIGINT
      kills the process and tarantool complains about it in log.
      a8b3b267
  7. Feb 04, 2022
  8. Jan 19, 2022
  9. Nov 11, 2021
  10. Jul 07, 2021
  11. Dec 01, 2020
    • Cyrill Gorcunov's avatar
      console: drop unused serpent module · b53cb2ae
      Cyrill Gorcunov authored
      
      Since the commit ae7e2103 we use internal serializer
      thus we no longer need serpent code.
      
      The patch removes the references from the source code
      and .gitmodules file, still one might need to run
      
       | git submodule deinit -f third_party/serpent
      
      manually to clean up the working tree depending
      on local git version.
      
      Closes #5517
      
      Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
      b53cb2ae
  12. May 19, 2020
    • Vladislav Shpilevoy's avatar
      session: remove box.session.push() 'sync' · a38c861e
      Vladislav Shpilevoy authored
      Closes #4689
      
      @TarantoolBot document
      Title: box.session.push() 'sync' is deprecated
      
      box.session.push() had two parameters - data to push and 'sync'.
      The sync was a request ID with which the out of bound data should
      be pushed into a socket.
      
      This was introduced as a workaround for #3450, and is useless
      since its resolution.
      
      A user anyway can't push to different sessions, where that
      parameter could be useful. And pushing into requests of the same
      session, on the contrary, is something not really needed anywhere,
      not portable to non-binary session types (console, background),
      and is just dangerous since it is easy to add a bug here.
      
      The patch removes the parameter. Now there will be thrown a
      'Usage' error at attempt to use 'sync' parameter. In version 2.4
      it is deprecated, prints warnings into logs, but still works. In
      2.5 it is removed completely.
      a38c861e
  13. May 18, 2020
  14. Apr 14, 2020
    • Vladislav Shpilevoy's avatar
      box: export box_session_push to the public C API · 5d795527
      Vladislav Shpilevoy authored
      API is different from box.session.push() - sync argument was
      removed. It will disappear from Lua API as well, because it just
      is not needed here. Session is omitted as well. Indeed, a user
      can't push to a foreign session, and the current session can be
      obtained inside box_session_push(). And anyway session is not in
      the public C API.
      
      Internally dump into iproto is done using obuf_dup(), just like
      tuple_to_obuf() does. obuf_alloc() would be a bad call here,
      because it wouldn't be able to split the pushed data into several
      obuf chunks, and would cause obuf fragmentation.
      
      Dump into plain text behaves just like a Lua push - it produces a
      YAML formatted text or Lua text depending on output format. But to
      turn MessagePack into YAML or Lua text an intermediate Lua
      representation is used, because there are no a MessagePack -> YAML
      and MessagePack -> Lua text translators yet.
      
      Closes #4734
      
      @TarantoolBot document
      Title: box_session_push() C API
      
      There is a new function in the public C API:
      ```C
          int
          box_session_push(const char *data, const char *data_end);
      ```
      
      It takes raw MessagePack, and behaves just like Lua
      `box.session.push()`.
      5d795527
  15. Apr 13, 2020
  16. Jul 24, 2019
    • Cyrill Gorcunov's avatar
      box/lua/console: Add support for lua output format · 42725501
      Cyrill Gorcunov authored
      @TarantoolBot document
      Title: document \set output lua
      
      Historically we use YAML format to print results of operation to
      a console. Moreover our test engine is aiming YAML as a primary format
      to compare results of test runs. Still we need an ability to print
      results in a different fasion, in particular one may need to use
      the console in a REPL way so that the results would be copied and
      pased back to further processing.
      
      For this sake we introduce that named "output" command which allows
      to specify which exactly output format to use. Currently only yaml
      and lua formats are supported.
      
      To specify lua output format type
      
       | tarantool> \set output lua
      
      in the console. lua mode supports line oriented output (default) or
      block mode.
      
      For example
      
       | tarantool> a={1,2,3}
       | tarantool> a
       | ---
       | - - 1
       |   - 2
       |   - 3
       | ...
       | tarantool> \set output lua
       | true
       | tarantool> a
       | {1, 2, 3}
       | tarantool> \set output lua,block
       | true
       | tarantool> a
       | {
       |   1,
       |   2,
       |   3
       | }
      
      By default YAML output format is kept for now, simply to not
      break the test engine. The output is bound to a session, thus every
      new session should setup own conversion if needed.
      
      Since serializing lua data is not a trivial task we use "serpent"
      third party module to convert data.
      
      Part-of #3834
      42725501
  17. May 29, 2019
    • Cyrill Gorcunov's avatar
      box/lua/console: Fix hang in case of cancelling console fiber · fb13b1a8
      Cyrill Gorcunov authored
      Since commit f42596a2 we've started
      to test if a fiber is cancelled in coio_wait. This may hang interactive
      console with simple fiber.kill(fiber.self()) call.
      
      Sane users don't do such tricks and this affects interactive console
      mode only but still to be on a safe side lets exit if someone occasionally
      killed the console fiber.
      
      Notes:
       - such exit may ruine terminals settings and one need
         to reset it after;
       - the issue happens on interactive console only
         so I didn't find a way for automatic test and
         tested manually.
      fb13b1a8
  18. Jun 08, 2018
    • Vladislav Shpilevoy's avatar
      session: introduce binary box.session.push · 2b1143a7
      Vladislav Shpilevoy authored
      Box.session.push() allows to send a message to a client with no
      finishing a main request. Tarantool after this patch supports
      pushes over binary protocol.
      
      IProto message is encoded using a new header code - IPROTO_CHUNK.
      Push works as follows: a user calls box.session.push(message).
      The message is encoded into currently active obuf in TX thread,
      and then Kharon notifies IProto thread about new data.
      
      Originally Kharon is the ferryman of Hades who carries souls of
      the newly deceased across the rivers Styx and Acheron that
      divided the world of the living from the world of the dead. In
      Tarantool Kharon is a message and does the similar work. It
      notifies IProto thread about new data in an output buffer
      carrying pushed messages to IProto. Styx here is cpipe, and the
      boat is cbus message.
      
      One connection has single Kharon for all pushes. But Kharon can
      not be in two places at the time. So once he got away from TX to
      IProto, new messages can not send Kharon. They just set a special
      flag. When Kharon is back to TX and sees the flag is set, he
      immediately takes the road back to IProto.
      
      Herewith a user is not blocked to write to obuf when Kharon is
      busy. The user just updates obuf and set the flag if not set.
      There is no waiting for Kharon arrival back.
      
      Closes #2677
      2b1143a7
  19. Jun 07, 2018
  20. Jun 06, 2018
    • Vladislav Shpilevoy's avatar
      session: introduce text box.session.push · 6d99d51e
      Vladislav Shpilevoy authored
      box.session.push allows to send some intermediate results in the
      scope of main request with no finalizing it. Messages can be
      sent over text and binary protocol. This patch allows to send
      text pushes.
      
      Text push is a YAML document tagged with '!push!' handle and
      'tag:tarantool.io/push,2018' prefix. YAML tags is a standard way
      to define a type of the document.
      
      Console received push message just prints it to the stdout (or
      sends to a next console, if it is remote console too).
      
      Part of #2677
      6d99d51e
  21. May 31, 2018
    • Vladislav Shpilevoy's avatar
      session: introduce session vtab and meta · 145f72d7
      Vladislav Shpilevoy authored
      box.session.push implementation depends on session type -
      console session must send YAML tagged text, binary session must
      send MessagePack via another thread, other sessions must return
      error.
      
      Add virtual table to a session with 'push', 'fd' and 'sync'
      functions.
      
      The same virtual table together with struct session meta can be
      used to use memory of struct session more effectively. Before the
      patch session stored sync and fd as attributes, but:
      * fd was duplicated for iproto, which already has fd in
        connection;
      * sync is used only by iproto, and just occupies 8 byte in other
        sessions;
      * after the #2677 session additionaly must be able to store
        iproto connection pointer.
      
      Struct session meta uses C union to store either iproto, or
      console, or another meta, but not all of them together.
      
      Part of #2677
      145f72d7
    • Vladislav Shpilevoy's avatar
      console: use Lua C API to do formatting for console · ac715203
      Vladislav Shpilevoy authored
      YAML formatting C API is needed for #2677, where it will be used
      to send text pushes and prints as tagged YAML documents.
      
      Push in the next patches is implemented as a virtual C method of
      struct session, so it is necessary to be able format YAML from C.
      
      Needed for #2677
      ac715203
  22. May 05, 2018
  23. Dec 19, 2017
  24. Dec 07, 2017
    • ivankosenko's avatar
      Input history improvements. (#2938) · 7906e408
      ivankosenko authored
      * Input history improvements.
      
      Don't add to input history empty lines and two same lines together (to achieve behavior as in bash, python, etc.)
      
      * Coding style fix.
      7906e408
  25. May 04, 2017
  26. Feb 13, 2017
  27. Jan 31, 2017
  28. Sep 30, 2016
  29. Sep 29, 2016
  30. Sep 28, 2016
    • Nick Zavaritsky's avatar
      Fix gh-1490: Readline history not saved · 7daab631
      Nick Zavaritsky authored
      Created Lua bindings for history load/save functions. Lua console module
      is now responsible for persisting the history.
      
      Formerly history setup was done in main, but only when tarantool was
      invoked sans arguments. Affected tarantoolctl.
      7daab631
  31. Sep 27, 2016
Loading