#1468 Prosodyctl adduser incorrect dialog / missing io.flush

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

    What steps will reproduce the problem? 1. prosodyctl adduser test@xyz.zz 2. 3. What is the expected output? Dialog to set a password. What do you see instead? Nothing. You'll see "Enter new password", after you entered input. What version of the product are you using? On what operating system? Latest packages on Void Linux . $ prosodyctl about Prosody 0.11.2 # Prosody directories Data directory: /var/lib/prosody Config directory: /etc/prosody Source directory: /usr/lib/prosody Plugin directories: /usr/lib/prosody/modules/ # Lua environment Lua version: Lua 5.1 Lua module search paths: /usr/lib/prosody/?.lua /usr/share/lua/5.1/?.lua /usr/share/lua/5.1/?/init.lua /usr/lib/lua/5.1/?.lua /usr/lib/lua/5.1/?/init.lua Lua C module search paths: /usr/lib/prosody/?.so /usr/lib/lua/5.1/?.so /usr/lib/lua/5.1/loadall.so LuaRocks: Not installed # Lua module versions lfs: LuaFileSystem 1.7.0 lxp: LuaExpat 1.3.0 socket: LuaSocket 2.0.2 ssl: 0.5.1 Please provide any additional information below. A simplie "flush" after the io.writes fixes the issue. $ diff prosodyctl.lua.old prosodyctl.lua.new 100a101 > io.flush() 106a108 > io.flush()

  2. Vito on

    I discovered the same problem in alpine linux. It looks like all musl-based distributions have the same problem related to io.write. Bug in the alpine linux bugtracker: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16964 Bug in the lunarmodules bugtracker: https://github.com/lunarmodules/luasystem/issues/54 I have patched the problem in the following way: --- a/util/human/io.lua +++ b/util/human/io.lua @@ -9,6 +9,7 @@ local function getchar(n) local stty_ret = os.execute("stty raw -echo 2>/dev/null"); local ok, char; + io.flush(); if stty_ret then ok, char = pcall(io.read, n or 1); os.execute("stty sane"); @@ -24,6 +25,7 @@ end local function getline() + io.flush(); local ok, line = pcall(io.read, "*l"); if ok then return line; @@ -35,6 +37,7 @@ if not stty_ret then io.write("\027[08m"); -- ANSI 'hidden' text attribute end + io.flush(); local ok, pass = pcall(io.read, "*l"); if stty_ret then os.execute("stty sane"); --- a/util/prosodyctl/shell.lua +++ b/util/prosodyctl/shell.lua @@ -25,6 +25,7 @@ return readline.readline(prompt_string); else io.write(prompt_string); + io.flush(); return io.read("*line"); end end

New comment

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