Bug #37060
closedUsing nonASCII characters in sudo password in REX raises NoMethodError undefined method `empty?' for nil:NilClass:
Description
Description of problem:
Setting REX with sudo with effective user password (I assume with REX user password it will be the same), when the password contains some wide characters, REX job fails with output
output: 'Error initializing command: NoMethodError - undefined method `empty?''
for nil:NilClass'
and relevant backtrace in proxy.log
Steps to Reproduce:
1. On a client, configure some user with password containing a wide character (I used password čislo where the č did it)
2. Set the user as a sudoer requiring password
3. Invoke a REX job via ssh with:
effective_user_method: sudo
ssh_user: the-sudo-user
Effective user password : the password from 1.
Actual results:
The REX job fails with below backtrace in /var/log/foreman-proxy/proxy.log:
2024-01-15T11:21:42 [E] error while initializing command NoMethodError undefined method `empty?' for nil:NilClass:
/usr/share/gems/gems/smart_proxy_dynflow-0.8.2/lib/smart_proxy_dynflow/io_buffer.rb:87:in `write_available!'
/usr/share/gems/gems/smart_proxy_dynflow-0.8.2/lib/smart_proxy_dynflow/process_manager.rb:130:in `each'
/usr/share/gems/gems/smart_proxy_dynflow-0.8.2/lib/smart_proxy_dynflow/process_manager.rb:130:in `process'
/usr/share/gems/gems/smart_proxy_dynflow-0.8.2/lib/smart_proxy_dynflow/process_manager.rb:65:in `run!'
/usr/share/gems/gems/smart_proxy_remote_execution_ssh-0.7.3/lib/smart_proxy_remote_execution_ssh/runners/script_runner.rb:327:in `run_sync'
/usr/share/gems/gems/smart_proxy_remote_execution_ssh-0.7.3/lib/smart_proxy_remote_execution_ssh/runners/script_runner.rb:404:in `ensure_remote_command'
/usr/share/gems/gems/smart_proxy_remote_execution_ssh-0.7.3/lib/smart_proxy_remote_execution_ssh/runners/script_runner.rb:167:in `preflight_checks'
/usr/share/gems/gems/smart_proxy_remote_execution_ssh-0.7.3/lib/smart_proxy_remote_execution_ssh/runners/script_runner.rb:147:in `start'
/usr/share/gems/gems/smart_proxy_dynflow-0.8.2/lib/smart_proxy_dynflow/runner/dispatcher.rb:32:in `start_runner'
/usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/actor.rb:13:in `on_message'
..
Expected results:
No such error.
Additional info:
ruby IO sending the wide character reports back it sent multiple chars instead just the one, causing @buffer underflow in io_buffer.rb .