Skip to content

Commit 4b78112

Browse files
committed
fix(console): skip extra newline after username in login_stage_2()
The login loop in SSHConsoleConn.login_stage_2() sends an unconditional write_channel(RETURN) at the bottom of every iteration. After the username is sent and user_sent is set to True, the loop falls through to this write_channel, sending a blank newline to the DUT before the Password: prompt is read. The DUT receives the blank newline as the password input, causing authentication to fail. Linux pam_faildelay then enforces a 3-second delay before responding with Login incorrect. The test framework times out within this 3-second window, closes the connection, and retries - all three attempts fail the same way. Fix: add continue after user_sent = True so the loop restarts at the top and waits for the Password: prompt before taking any further action. Root cause confirmed via live manual test on bjw-can-7060-1: - Sending empty Enter at Password: prompt -> 3-second silence -> Login incorrect - Normal login with correct password succeeds in under 1 second - Pass rate of dut_console/test_escape_character.py was 2.6% due to this race
1 parent 258a8fd commit 4b78112

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tests/common/connections/ssh_console_conn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def login_stage_2(self,
133133
output = self.read_channel()
134134
return_msg += output
135135
user_sent = True
136+
continue # Skip loop-bottom write_channel(RETURN); wait for Password: prompt next iteration
136137

137138
# Search for password pattern / send password
138139
if user_sent and not password_sent and re.search(pwd_pattern, output, flags=re.I):

0 commit comments

Comments
 (0)