CharLee has asked for the wisdom of the Perl Monks concerning the following question:

Hi!

About two years ago I wrote some Perl program using Expect to automatically log in via SSH; it was based on v1.21.

Today I ran the program again (now at v1.32), and the program does not work as expected:

I'm waiting for a password prompt, then the user should type the password. The regex matches, but the after-match string (that should be empty) has unexpected contents.

Here is the essential part of the debug output:

spawn id(3): Does `*************************************************** +***************************\r\n* This login banner can be configured +to adhere to your corporate security *\r\n* policies. + *\r\n* + *\r\ +n* Due to security concerns, default users will be prompted to change + default *\r\n* passwords upon login. To retain the default password, + re-enter it at the *\r\n* Password: and Confirm: prompts. + *\r\n* + *\r\n**************** +**************************************************************\r\n\r\ +nPassword: ' match: pattern #1: -re `^Password: $'? YES!! Before match string: `******************************************** +**********************************\r\n* This login banner can be conf +igured to adhere to your corporate security *\r\n* policies. + *\r\n* + + *\r\n* Due to security concerns, default users will be prompted to + change default *\r\n* passwords upon login. To retain the default pa +ssword, re-enter it at the *\r\n* ' Match string: `Password: ' After match string: `and Confirm: prompts. + *\r\n* + *\r\n******************************* +***********************************************\r\n\r\nPassword: ' Matchlist: ()

As you can see "Password:" is not matched at the beginning of the line as expected (despite of saying differently); at least the after string behaves as if the "Password:" was matched in the middle of a line.

To me it seems the version of Expect.pm is broken; see also https://bugzilla.opensuse.org/show_bug.cgi?id=976535