Wednesday, July 13, 2011

sudo race condition in Fabric 1.0.0

If you've used Fabric with sudo, you might notice keystrokes during the password phase sometimes doesn't work. The problem with Fabric for sudo() command is tracked here:

The diff for Fabric 1.0.2 is here:

It appears that the fix basically shuts off the input_loop when the connection is attempting to use get_pass() when performing an SSH connection to another machine with Fabric. The problem is
that while Fabric claims it is single-threaded, but it still creates thread handlers for standard input/output:

        workers = (
            ThreadHandler('out', output_loop, channel, "recv", stdout),
            ThreadHandler('err', output_loop, channel, "recv_stderr", stderr),
            ThreadHandler('in', input_loop, channel, using_pty)

The fix disables input checking so that the getpass inside the prompt_for_password() command can work correctly.

No comments:

Post a Comment