SUMMARY: Sudo 1.6.3p5 and expect 5.32.1 on OSF1 V5.0 1094 alpha / OSF1 V4. 0 1229 alpha

From: Buuren, B.J. van DTO/DB/BGM/SVM/SGM <BJ.v.Buuren_at_mindef.nl>
Date: Thu, 02 Nov 2000 11:09:51 +0100

It turned out to be a bug in the script after all <g!>.

Thanks to Andy Betteridge for pointing this out.

--
Maybe the wait is catching you out. From the expect man page
wait [args]
        delays until a spawned process (or the current process if none is
        named) terminates.
which i don't think is the behaviour you're loking for.
Andy.
> -----Original Message-----
> From: Buuren, B.J. van DTO/DB/BGM/SVM/SGM 
> [mailto:BJ.v.Buuren_at_mindef.nl]
> Sent: Thursday, November 02, 2000 8:58 AM
> To: 'tru64-unix-managers_at_ornl.gov'
> Subject: Sudo 1.6.3p5 and expect 5.32.1 on OSF1 V5.0 1094 alpha / OSF1
> 
> 
> 
> Hi all,
> 
> I am having trouble getting the included expect script to 
> work on various
> dec-unix machines running unix versions 4.0f and 5.0a. It 
> simply remains
> dead once started. Also included is the trace output using alpha-trace
> (www.tru64.org). I'm using Sudo version 1.6.3p5 and expect 
> version 5.32.1.
> 
> Although there seems nothing wrong with the script-code it locks up
> apparently right at the moment it tries to spawn sudo. This problem is
> probably more related to Expect than OSF1 or sudo, but I'm 
> curious if anyone
> can reproduce this behavior, or comment on a possible workaround.
> 
> Any help is much appreciated.
> 
> Jacco van Buuren.
> 
> 
> 
> #!/usr/local/bin/expect --
> 
> log_user 0
> set timeout 3
> spawn sudo usermod -G system sx02089
> wait
> set sudo $spawn_id
> expect -i $sudo {
>         -gl "assword:" {
>                 send_user "Sending password"
>         }
>         -re "(#|\\\$|>|])" {
>                 send_user "Done."
>                 exit
>         }
>         timeout {
>                 send_user "Timeout waiting for password"
>                 exit 1
>         }
> }
> send -i $sudo -- "*******"
> send -i $sudo "\r"
> expect -i $sudo {
>         -re "(#|\\\$|>|])" {
>                 send_user "Done."
>                 exit
>         }
>         timeout {
>                 send_user "Timeout waiting for prompt"
>                 exit 1
>         }
> }
> 
> # Trace output on dec-unix 5.0a (patched with patch 
> t64v50aas0001-20000718)
> 
> Warning: sysent[018] has syscall 229 getfsstat(pdd)d
> Warning: sysent[067] has syscall 224 stat(sp)d
> Warning: sysent[068] has syscall 225 lstat(sp)d
> Warning: sysent[091] has syscall 226 fstat(dp)d
> Warning: sysent[160] has syscall 227 statfs(spd)d
> Warning: sysent[161] has syscall 228 fstatfs(dpd)d
> odd_stuff_expect_sudo.exp
> Tracing process /proc/138271
> getpagesize () = 8192
> obreak (0x140017e50) = 0
> sigaction (SIGPIPE, {{0x1,0x0,0}}, {{0x14000a100,0x801178f4,}}) = 0
> obreak (0x140025e50) = 0
> uname (0x11fffbe00) = 0
> access ("/bin/expect", 01) =  -1, (No such file or directory)
> access ("/sbin/expect", 01) =  -1, (No such file or directory)
> access ("/usr/bin/expect", 01) =  -1, (No such file or directory)
> access ("/usr/sbin/expect", 01) =  -1, (No such file or directory)
> access ("/usr/local/bin/expect", 01) = 0
> unknown_call () = 0
> open ("/usr/local/lib/tcl8.3/encoding/iso8859-1.enc", 
> O_RDONLY, 00) = 4
> fcntl (4, F_SETFD, 1) = 0
> ioctl (4, 0x2000745e<Void,TIOCunknown,0>, 0) = -1 (Not a typewriter)
> read (4, 0x4001a028, 4096) = 1094 [, "# Encoding file: iso8859-1,
> single-byte\nS\n003F 0 1\n00\n00000001000200030004000500"..., ]
> close (4) = 0
> access ("/usr/local/lib/tcl8.3/init.tcl", 00) = 0
> unknown_call () = 0
> open ("/usr/local/lib/tcl8.3/init.tcl", O_RDONLY, 0644) = 4
> fcntl (4, F_SETFD, 1) = 0
> ioctl (4, 0x2000745e<Void,TIOCunknown,0>, 0) = -1 (Not a typewriter)
> read (4, 0x4001a028, 4096) = 4096 [, "# init.tcl --\n#\n# 
> Default system
> startup file for Tcl-based applications.  Defin"..., ]
> read (4, 0x4001a028, 4096) = 4096 [, " the command was 
> invoked interactively
> at top-level:\n#\t    (a) see if the comman"..., ]
> read (4, 0x4001a028, 4096) = 4096 [, "to_load --\n# Checks a 
> collection of
> library directories to see if a procedure\n# "..., ]
> obreak (0x140033e50) = 0
> read (4, 0x4001a028, 4096) = 4096 [, "and clean them up\n    
> # (making sure
> that foo:::::bar will be treated as foo::ba"..., ]
> read (4, 0x4001a028, 4096) = 889 [, "\n\tset checked($dir) 
> {}\n\tforeach ext
> {{} .com .exe .bat} {\n\t    set file [file jo"..., ]
> read (4, 0x4001a028, 4096) = 0 [, "", ]
> close (4) = 0
> obreak (0x140028000) = 0
> getpid () = 138271
> open ("/dev/tty", O_RDWR, 030002077600) = 4
> ioctl (4, 0x2000745e<Void,TIOCunknown,0>, 0) = 0
> ioctl (4, 0x402c7413<Out,TIOCGETA,44>, 140009d70) = 0
> ioctl (4, 0x40087468<Out,TIOCGWINSZ,8>, 140006ae0) = 0
> ioctl (0, 0x2000745e<Void,TIOCunknown,0>, 0) = 0
> ioctl (1, 0x2000745e<Void,TIOCunknown,0>, 0) = 0
> getpid () = 138271
> ioctl (0, 0x2000745e<Void,TIOCunknown,0>, 0) = 0
> lseek (0, 0, SEEK_CUR) = 860059
> lseek (1, 0, SEEK_CUR) = 860091
> obreak (0x140036000) = 0
> lseek (2, 0, SEEK_CUR) = 860148
> ioctl (2, 0x2000745e<Void,TIOCunknown,0>, 0) = 0
> fcntl (4, F_SETFD, 1) = 0
> sigaction (SIGINT, {{0x120012510,0x0,0}}, 
> {{0x0,0xbff8bb88,SA_RESTART}}) = 0
> sigaction (SIGTERM, {{0x120012510,0x0,0}}, 
> {{0x0,0xbff8bb88,SA_ONSTACK|
> SA_RESTART| SA_NOCLDSTOP}}) = 0
> open ("/usr/local/lib/expect5.32/expect.rc", O_RDONLY, 00) = 
> -1 (No such
> file or directory)
> open ("/home/users/sx02089/.expect.rc", O_RDONLY, 00) = -1 
> (No such file or
> directory)
> unknown_call () = 0
> open ("./odd_stuff_expect_sudo.exp", O_RDONLY, 0644) = 6
> fcntl (6, F_SETFD, 1) = 0
> ioctl (6, 0x2000745e<Void,TIOCunknown,0>, 0) = -1 (Not a typewriter)
> read (6, 0x40030028, 4096) = 591 [, "#!/usr/local/bin/expect 
> --\n\n#log_user
> 0\nset timeout 3\n#spawn sudo usermod -G use"..., ]
> read (6, 0x40030028, 4096) = 0 [, "", ]
> close (6) = 0
> write (1, <73 70 61 77 6e 00 00 00 30 72 08 c0 ff 03 00 00 79 
> 20 21 3d 20 22
> 22 00 02 00 00 00 00 00 00 00 2d 47 00 40 01 00 00 00 30 72 
> 08 c0 ff 03 00
> 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 30 00 02 
> 40 01 00 00 00
> 30 72 08 c0 ff 03 00 00>..., 5) = spawn5
> write (1, <20 00 00 00 00 00 00 00 0d 0a 00 00 00 00 00 00 25 
> 73 00 00 00 00
> 00 00 2f 00 00 00 00 00 00 00 25 64 00 00 00 00 00 00 25 64 
> 00 00 00 00 00
> 00 0d 0a 00 00 00 00 00 00 20 00 00 00 00 00 00 00 25 64 00 
> 00 00 00 00 00
> 20 00 00 00 00 00 00 00>..., 1) =  1
> write (1, <73 75 64 6f 00 00 00 00 30 72 08 c0 ff 03 00 00 6c 
> 66 00 2e 33 00
> 6d 3a 02 00 00 00 00 00 00 00 2f 75 73 72 2f 6c 6f 63 61 6c 
> 2f 62 69 6e 2f
> 65 78 70 65 63 74 00 3a 09 02 00 00 00 00 00 00 00 e0 fa fd 
> bf ff 03 00 00
> 00 00 00 00 00 00 00 00>..., 4) = sudo4
> write (1, <20 00 00 00 00 00 00 00 0d 0a 00 00 00 00 00 00 25 
> 73 00 00 00 00
> 00 00 2f 00 00 00 00 00 00 00 25 64 00 00 00 00 00 00 25 64 
> 00 00 00 00 00
> 00 0d 0a 00 00 00 00 00 00 20 00 00 00 00 00 00 00 25 64 00 
> 00 00 00 00 00
> 20 00 00 00 00 00 00 00>..., 1) =  1
> write (1, <75 73 65 72 6d 6f 64 00 30 72 08 c0 ff 03 00 00 00 
> 00 00 00 00 00
> 00 00 02 00 00 00 00 00 00 00 65 78 69 74 00 00 00 00 30 72 
> 08 c0 ff 03 00
> 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 73 70 61 
> 77 6e 00 00 00
> 30 72 08 c0 ff 03 00 00>..., 7) = usermod7
> write (1, <20 00 00 00 00 00 00 00 0d 0a 00 00 00 00 00 00 25 
> 73 00 00 00 00
> 00 00 2f 00 00 00 00 00 00 00 25 64 00 00 00 00 00 00 25 64 
> 00 00 00 00 00
> 00 0d 0a 00 00 00 00 00 00 20 00 00 00 00 00 00 00 25 64 00 
> 00 00 00 00 00
> 20 00 00 00 00 00 00 00>..., 1) =  1
> write (1, <2d 47 00 40 01 00 00 00 30 72 08 c0 ff 03 00 00 00 
> 00 00 00 00 00
> 00 00 02 00 00 00 00 00 00 00 30 00 02 40 01 00 00 00 30 72 
> 08 c0 ff 03 00
> 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 33 00 02 
> 40 01 00 00 00
> 30 72 08 c0 ff 03 00 00>..., 2) = -G2
> write (1, <20 00 00 00 00 00 00 00 0d 0a 00 00 00 00 00 00 25 
> 73 00 00 00 00
> 00 00 2f 00 00 00 00 00 00 00 25 64 00 00 00 00 00 00 25 64 
> 00 00 00 00 00
> 00 0d 0a 00 00 00 00 00 00 20 00 00 00 00 00 00 00 25 64 00 
> 00 00 00 00 00
> 20 00 00 00 00 00 00 00>..., 1) =  1
> write (1, <73 79 73 74 65 6d 00 00 30 72 08 c0 ff 03 00 00 00 
> 00 00 00 00 00
> 00 00 fb ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 b0 73 
> 08 c0 ff 03 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00
> 00 00 00 00 00 00 00 00>..., 6) = system6
> write (1, <20 00 00 00 00 00 00 00 0d 0a 00 00 00 00 00 00 25 
> 73 00 00 00 00
> 00 00 2f 00 00 00 00 00 00 00 25 64 00 00 00 00 00 00 25 64 
> 00 00 00 00 00
> 00 0d 0a 00 00 00 00 00 00 20 00 00 00 00 00 00 00 25 64 00 
> 00 00 00 00 00
> 20 00 00 00 00 00 00 00>..., 1) =  1
> write (1, <73 78 30 32 30 38 39 00 30 72 08 c0 ff 03 00 00 00 
> 00 00 00 00 00
> 00 00 08 00 00 00 00 00 00 00 70 d0 00 40 01 00 00 00 80 c9 
> 00 40 01 00 00
> 00 01 00 00 00 00 00 00 00 e0 a3 f9 bf ff 03 00 00 60 d5 f8 
> bf ff 03 00 00
> 00 00 00 00 00 00 00 00>..., 7) = sx020897
> write (1, <0d 0a 00 00 00 00 00 00 25 73 00 00 00 00 00 00 2f 
> 00 00 00 00 00
> 00 00 25 64 00 00 00 00 00 00 25 64 00 00 00 00 00 00 0d 0a 
> 00 00 00 00 00
> 00 20 00 00 00 00 00 00 00 25 64 00 00 00 00 00 00 20 00 00 
> 00 00 00 00 00
> 2d 69 00 00 00 00 00 00>..., 2) = 
> 2
> open ("/dev/ptmx", O_RDWR, 020002665700) = 6
> obreak (0x140044000) = 0
> ioctl (6, 0x20007447<Void,ISPTM,0>, 0) = 66060288
> unknown_call () = 0
> ioctl (6, 0x20007447<Void,ISPTM,0>, 0) = 66060288
> ioctl (6, 0x20007449<Void,UNLKPT,0>, 0) = 0
> ioctl (6, 0x20007447<Void,ISPTM,0>, 0) = 66060288
> sigprocmask (1, 0x80000, 0x11fffb588) = 0
> fork () = 138262
> wait4 (138262, 0x11fffb598, 0, 0x0) = 138262
> sigprocmask (3, 0x0, 0x0) = 524288
> SIGNAL [20 SIGCHLD]
> ioctl (6, 0x80047410<In,TIOCFLUSH,4>, 0) = -1 (Bad address)
> fcntl (6, F_SETFD, 1) = 0
> pipe (0x11fffb650) = 7
> pipe (0x11fffb648) = 9
> pipe (0x11fffb640) = 11
> fork () = 138269
> close (8) = 0
> close (9) = 0
> close (12) = 0
> fcntl (6, F_SETFD, 1) = 0
> read (7, 0x1fffb630, 1) = 1 [, " ", ]
> write (10, <20 00 00 00 00 00 00 00 25 64 00 00 00 00 00 00 
> 20 00 00 00 00
> 00 00 00 2d 69 00 00 00 00 00 00 65 78 70 5f 70 69 64 00 25 
> 64 00 00 00 00
> 00 00 25 64 00 00 00 00 00 00 25 64 20 25 6c 66 00 00 65 78 
> 70 00 00 00 00
> 00 00 00 00 00 00 00 00 00>..., 1) = 1
> close (7) = 0
> close (10) = 0
> read (11, 0x1fffb638, 4) = 0 [, "", ]
> close (11) = 0
> wait4 (138269, 0x140034484, 0, 0x0) = 
> 
> 
> 
> -----------------------------------------------------
> Ing. B.J. van Buuren           Tel.: +31(0)174-538684
> UNIX System Administrator                   room B118
> DTO Maasland             mailto:BJ.v.Buuren_at_MINDEF.NL
> -----------------------------------------------------
> 
Received on Thu Nov 02 2000 - 10:11:51 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:41 NZDT