#1874 shell: using backspace inside strings causes an error

Reporter lissine
Owner Nobody
Created
Updated
Stars ★ (1)
Tags
  • Priority-Medium
  • Type-Defect
  • Status-New
  1. lissine on

    What steps will reproduce the problem? 1. `sudo prosodyctl shell` 2. Type `module:show("s2s")` but when typing "s2s", make a typo and use backspace to reverse it. 3. Hit enter. What is the expected output? Normal output of `prosody> module:show("s2s")` What do you see instead? ``` adminstream error Traceback[c2s]: /usr/local/lib/prosody/util/stanza.lua:65: invalid text value: contains invalid utf8 stack traceback: [C]: in function 'error' /usr/local/lib/prosody/util/stanza.lua:65: in upvalue 'check_text' /usr/local/lib/prosody/util/stanza.lua:141: in method 'add_direct_child' /usr/local/lib/prosody/util/stanza.lua:116: in method 'text' /usr/local/lib/prosody/util/prosodyctl/shell.lua:30: in upvalue 'send_line' /usr/local/lib/prosody/util/prosodyctl/shell.lua:44: in upvalue 'repl' /usr/local/lib/prosody/util/prosodyctl/shell.lua:110: in field '?' /usr/local/lib/prosody/util/events.lua:81: in function </usr/local/lib/prosody/util/events.lua:77> (...tail calls...) /usr/local/lib/prosody/util/adminstream.lua:293: in upvalue 'func' /usr/local/lib/prosody/util/async.lua:144: in function </usr/local/lib/prosody/util/async.lua:142> ``` What version of the product are you using? On what operating system? Using Prosody 0.12.4 on OpenBSD 7.5 Note: The issue might be non-reproducible on Linux.

  2. lissine on

    Additional information: $ prosodyctl about Prosody 0.12.4 # Prosody directories Data directory: /var/prosody Config directory: /etc/prosody Source directory: /usr/local/lib/prosody Plugin directories: /var/prosody/custom_plugins - not a directory! /usr/local/lib/prosody/modules/ # Operating system OpenBSD 7.5 # Lua environment Lua version: Lua 5.4 Lua module search paths: /usr/local/lib/prosody/?.lua /usr/local/share/lua/5.4/?.lua /usr/local/share/lua/5.4/?/init.lua /usr/local/lib/lua/5.4/?.lua /usr/local/lib/lua/5.4/?/init.lua /home/lis/.luarocks/share/lua/5.4/?.lua /home/lis/.luarocks/share/lua/5.4/?/init.lua /var/prosody/custom_plugins/share/lua/5.4/?.lua /var/prosody/custom_plugins/share/lua/5.4/?/init.lua Lua C module search paths: /usr/local/lib/prosody/?.so /usr/local/lib/lua/5.4/?.so /usr/local/lib/lua/5.4/loadall.so /home/lis/.luarocks/lib/lua/5.4/?.so LuaRocks: Installed (2.x+) # Network Backend: epoll # Lua module versions LuaDBI: 0.7 LuaExpat: 1.3.0 LuaFileSystem: 1.8.0 LuaSec: 1.2.0 LuaSocket: 3.1.0 luaunbound: 1.0.0 # library versions libcrypto: LibreSSL 3.9.0 libunbound: 1.19.1

  3. MattJ on

    This sounds like readline is broken or misconfigured. I can't reproduce it on Linux. Something to do with locales, perhaps?

  4. MattJ on

    Hmm, no, I was thinking of the UTF8 issue when I suggested locales. If this is the backspace character making its way into the input, there is likely something else at fault. Oh wait! I just remembered we support running without readline. Indeed, 'readline' is not present in your 'prosodyctl about' output. So it's because https://prosody.im/doc/depends#lua-readline is missing, most likely, and our fallback code is inadequate (unsurprisingly... because it's certainly hard to implement reliable interactive line-editing functionality in a terminal, and we've barely tried).

  5. lissine on

    The description of this issue is not accurate. The traceback is only triggered if the backspace comes after an accented character e.g. à or é or è

  6. lissine on

    I found a workaround: If you don't only delete the accented character, but also delete the character before it, then the traceback isn't triggered.

New comment

Not published. Used for spam prevention and optional update notifications.