Bug 9917

Summary: autopasswd doesn't work at all
Product: [Retired] Red Hat Linux Reporter: Geoffrey D. Bennett <geoffrey>
Component: tcltkAssignee: Jens Petersen <petersen>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-01-16 07:48:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Geoffrey D. Bennett 2000-03-02 11:06:17 UTC
The autopasswd script included with tcl/tk doesn't work at all because it
sends the password before passwd starts listening for a password.  This
results in the script just hanging.

Even if it did work, certain passwords (eg. those beginning with a hyphen)
cannot be set because the password is interpreted as an option to "send".

The replacement script below fixes both of the above problems.  I don't
know if the 0.1s sleep is sufficient in all cases, but I've not had it fail
for me yet.

#!/usr/bin/expect --
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, passwd as 2nd

set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
expect "password:"
sleep 0.1
send -- "$password\r"
expect "password:"
sleep 0.1
send -- "$password\r"
expect eof

Comment 1 Jeff Johnson 2000-03-18 20:58:59 UTC
*** This bug has been marked as a duplicate of 4768 ***

Comment 2 Geoffrey D. Bennett 2002-10-16 12:38:10 UTC
I don't think this bug is resolved.  Bug 4768 has nothing to do with autopasswd.
 Although the timing issue seems to have gone away in later releases of RHL, the
problem with not being able to put in passwords beginning with hyphens is still
present.

Comment 3 Jens Petersen 2002-12-10 06:24:11 UTC
Should be fixed in expect-5.38.0-76.

Comment 4 Jens Petersen 2003-01-16 07:48:34 UTC
Closing for now.  Please re-open if there are still problems.