[30627] in Perl-Users-Digest
Perl-Users Digest, Issue: 1872 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 24 06:09:42 2008
Date: Wed, 24 Sep 2008 03:09:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 24 Sep 2008 Volume: 11 Number: 1872
Today's topics:
Re: expect.pm - stdout buffering issue <yandry77@gmail.com>
Re: expect.pm - stdout buffering issue <yandry77@gmail.com>
Re: How to unable the use of tainted mode in a CGI scri <tim@burlyhost.com>
Re: How to unable the use of tainted mode in a CGI scri <tim@burlyhost.com>
new CPAN modules on Wed Sep 24 2008 (Randal Schwartz)
Re: question about "package" and variable scope... <hansmu@xs4all.nl>
Re: question about "package" and variable scope... <tadmc@seesig.invalid>
Re: Unix Shell Scripting course started in Kalwa <tadmc@seesig.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 24 Sep 2008 01:25:37 -0700 (PDT)
From: Andry <yandry77@gmail.com>
Subject: Re: expect.pm - stdout buffering issue
Message-Id: <b6c75011-4839-4646-bb62-2ddd3e1a07e6@25g2000hsx.googlegroups.com>
On 23 Set, 18:01, Josef Moellers <5502109103600...@t-online.de> wrote:
> Andry wrote:
> > Hi all,
> > I have the following script:
> > ******************************************************************
> > #!/usr/bin/perl -w
> > use Expect;
>
> > $timeout =3D 5;
> > $|=3D1;
>
> > $exp =3D new Expect();
> > $exp->raw_pty(1);
>
> > $exp->log_file("output.log", "w");
>
> > $exp->spawn("ssh -l username 10.17.39.29");
> > $exp->expect($timeout, [ "[Pp]assword" =3D> sub { $_[0]->send("password
> > \n"); } ]);
> > $exp->expect($timeout, [ "prompt-string" =3D> sub { $_[0]->send("ls -l
> > \n"); } ]);
> > sleep 2;
> > $exp->expect($timeout, [ "prompt-string" =3D> sub { $_[0]->send("ls
> > \n"); } ]);
> > sleep 5;
>
> > $exp->log_file(undef);
>
> > $exp->expect($timeout, [ "prompt-string" =3D> sub { $_[0]->send("exit
> > \n"); } ]);
> > ******************************************************************
>
> > When I run the script, the console (stdout) shows:
> > 1) ssh (login...)...
> > 2) sleeping 2 seconds
> > 3) "ls -l" output
> > 4) sleeping 5 seconds
> > ... the script quits without displaying the output of the second
> > command "ls"
> > Even the log file does not contain the missing output.
>
> On my way home, I have been thinking about this (with this miserable
> weather one *has* to think about something else) ...
>
> In a wider sense, it has nothing to do with buffering.
>
> What happens is:
>
> You (disguised as a Perl/Expect script) wait for the password prompt and
> send the password. Then you wait for the shell prompt and send the ls
> command. Then you sleep for 2 seconds. In the meantime, the remote "ls
> -l" produces output, but there is no-one there to notice.
> Then you wait for the next shell prompt. *Now* you have to sift through
> ls' output to look for the prompt (btw. here Glenn's remark about
> anchoring comes into play, if one of the file names would contain the
> prompt as a substring!). While sifting though the output, it will be
> echoed to the console.
> When you find the prompt, you send the next "ls" command and the
> previous section hits you again.
>
> So, it's not classical buffering but rather a postponed reading/echoing
> of output produced earlier (of course, pedantics would call this
> buffering, too, ...)
>
> What you are expecting is the equivalent of
>
> expect(prompt)
> send("ls -l\r")
> expect(prompt) =A0<< Here you get "ls -l"'s output
> sleep 2
> send("ls\r")
> expect(prompt) =A0<< Here you get "ls"'s output
> sleep 5;
>
> HTH,
>
> Josef
> --
> Mails please to josef dot moellers
> and I'm on gmx dot de.
Hi Josef,
I checked and the prompt string is not present in any line of the "ls"
output.
Actually the problem starts even before that: right after sending the
password, the output shows that the script executes the first sleep (2
seconds) even BEFORE sending the first "ls -l".
So the problem is not related to unexpected (or not timely) matching
of the prompt string.
I put a couple of "print" before and after each "send" command to
better understand the timing issue.
'print "\nSending...\n"' is put right before each 'send'.
'print "\n...Sent!\n"' is put right after each 'send' (before the
'sleep').
Here is the output I get (I typed comments to highlight when the
'sleep' occurs):
********************************************************
root@10.17.39.29's password:
Sending...
...Sent!
Last login: Wed Sep 24 09:57:48 2008 from 10.17.91.83
Welcome to the Milan TestLab server
If you're not part of the TestLab team, you're not welcome anymore...
Sending...
...Sent!
########## NOW IS SLEEPING TWO SECONDS ##########
[root@svr-mila-testlab2 ~]# ls -l
total 2364
-rw-r--r-- 1 root root 33980 Feb 8 2007 1
-rw------- 1 root root 1534 Feb 5 2007 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 Feb 5 2007 Desktop
-rw-r--r-- 1 root root 38253 Feb 5 2007 install.log
-rw-r--r-- 1 root root 4475 Feb 5 2007 install.log.syslog
-rw-r--r-- 1 root root 2297093 Sep 24 10:01 sb-log.txt
-rw-r--r-- 1 root root 3034 Feb 6 2007 xorg.conf.new
drwxr-xr-x 2 root root 4096 Feb 7 2007 yum-keys
[root@svr-mila-testlab2 ~]#
Sending...
...Sent!
########## NOW IS SLEEPING FIVE SECONDS ##########
ls
1 Desktop install.log.syslog xorg.conf.new
anaconda-ks.cfg install.log sb-log.txt yum-keys
[root@svr-mila-testlab2 ~]#
Sending...
...Sent!
exit
logout
Connection to 10.17.39.29 closed.
********************************************************
Instead, what I expect should be something like this:
********************************************************
root@10.17.39.29's password:
Sending...
Last login: Wed Sep 24 09:57:48 2008 from 10.17.91.83
Welcome to the Milan TestLab server
If you're not part of the TestLab team, you're not welcome anymore...
[root@svr-mila-testlab2 ~]#
...Sent!
Sending...
ls -l
total 2364
-rw-r--r-- 1 root root 33980 Feb 8 2007 1
-rw------- 1 root root 1534 Feb 5 2007 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 Feb 5 2007 Desktop
-rw-r--r-- 1 root root 38253 Feb 5 2007 install.log
-rw-r--r-- 1 root root 4475 Feb 5 2007 install.log.syslog
-rw-r--r-- 1 root root 2297093 Sep 24 10:01 sb-log.txt
-rw-r--r-- 1 root root 3034 Feb 6 2007 xorg.conf.new
drwxr-xr-x 2 root root 4096 Feb 7 2007 yum-keys
[root@svr-mila-testlab2 ~]#
...Sent!
########## NOW IS SLEEPING TWO SECONDS ##########
Sending...
ls
1 Desktop install.log.syslog xorg.conf.new
anaconda-ks.cfg install.log sb-log.txt yum-keys
[root@svr-mila-testlab2 ~]#
...Sent!
########## NOW IS SLEEPING FIVE SECONDS ##########
Sending...
exit
...Sent!
logout
Connection to 10.17.39.29 closed.
********************************************************
Maybe it's ok that "...Sent!" is displayed right after "Sending..."
because the output of the 'send' command takes longer to display and
it comes after, but the time of displaying "Sending..." is wrong
anyway and, above all, the time of 'sleep' is wrong.
Of course this is trivial example but I need to display output lines
and execute 'sleep' commands in the proper order to build a more
complex non-interactive script.
Any idea?
Thanks,
Andrea
------------------------------
Date: Wed, 24 Sep 2008 02:30:28 -0700 (PDT)
From: Andry <yandry77@gmail.com>
Subject: Re: expect.pm - stdout buffering issue
Message-Id: <ee3b408e-faf2-4614-805c-3e3393c60a38@a70g2000hsh.googlegroups.com>
On 24 Set, 10:25, Andry <yandr...@gmail.com> wrote:
> On 23 Set, 18:01, Josef Moellers <5502109103600...@t-online.de> wrote:
>
>
>
> > Andry wrote:
> > > Hi all,
> > > I have the following script:
> > > ******************************************************************
> > > #!/usr/bin/perl -w
> > > use Expect;
>
> > > $timeout =3D 5;
> > > $|=3D1;
>
> > > $exp =3D new Expect();
> > > $exp->raw_pty(1);
>
> > > $exp->log_file("output.log", "w");
>
> > > $exp->spawn("ssh -l username 10.17.39.29");
> > > $exp->expect($timeout, [ "[Pp]assword" =3D> sub { $_[0]->send("passwo=
rd
> > > \n"); } ]);
> > > $exp->expect($timeout, [ "prompt-string" =3D> sub { $_[0]->send("ls -=
l
> > > \n"); } ]);
> > > sleep 2;
> > > $exp->expect($timeout, [ "prompt-string" =3D> sub { $_[0]->send("ls
> > > \n"); } ]);
> > > sleep 5;
>
> > > $exp->log_file(undef);
>
> > > $exp->expect($timeout, [ "prompt-string" =3D> sub { $_[0]->send("exit
> > > \n"); } ]);
> > > ******************************************************************
>
> > > When I run the script, the console (stdout) shows:
> > > 1) ssh (login...)...
> > > 2) sleeping 2 seconds
> > > 3) "ls -l" output
> > > 4) sleeping 5 seconds
> > > ... the script quits without displaying the output of the second
> > > command "ls"
> > > Even the log file does not contain the missing output.
>
> > On my way home, I have been thinking about this (with this miserable
> > weather one *has* to think about something else) ...
>
> > In a wider sense, it has nothing to do with buffering.
>
> > What happens is:
>
> > You (disguised as a Perl/Expect script) wait for the password prompt an=
d
> > send the password. Then you wait for the shell prompt and send the ls
> > command. Then you sleep for 2 seconds. In the meantime, the remote "ls
> > -l" produces output, but there is no-one there to notice.
> > Then you wait for the next shell prompt. *Now* you have to sift through
> > ls' output to look for the prompt (btw. here Glenn's remark about
> > anchoring comes into play, if one of the file names would contain the
> > prompt as a substring!). While sifting though the output, it will be
> > echoed to the console.
> > When you find the prompt, you send the next "ls" command and the
> > previous section hits you again.
>
> > So, it's not classical buffering but rather a postponed reading/echoing
> > of output produced earlier (of course, pedantics would call this
> > buffering, too, ...)
>
> > What you are expecting is the equivalent of
>
> > expect(prompt)
> > send("ls -l\r")
> > expect(prompt) =A0<< Here you get "ls -l"'s output
> > sleep 2
> > send("ls\r")
> > expect(prompt) =A0<< Here you get "ls"'s output
> > sleep 5;
>
> > HTH,
>
> > Josef
> > --
> > Mails please to josef dot moellers
> > and I'm on gmx dot de.
>
> Hi Josef,
> I checked and the prompt string is not present in any line of the "ls"
> output.
> Actually the problem starts even before that: right after sending the
> password, the output shows that the script executes the first sleep (2
> seconds) even BEFORE sending the first "ls -l".
> So the problem is not related to unexpected (or not timely) matching
> of the prompt string.
> I put a couple of "print" before and after each "send" command to
> better understand the timing issue.
> 'print "\nSending...\n"' is put right before each 'send'.
> 'print "\n...Sent!\n"' is put right after each 'send' (before the
> 'sleep').
>
> Here is the output I get (I typed comments to highlight when the
> 'sleep' occurs):
> ********************************************************
> r...@10.17.39.29's password:
> Sending...
>
> ...Sent!
>
> Last login: Wed Sep 24 09:57:48 2008 from 10.17.91.83
> Welcome to the Milan TestLab server
> If you're not part of the TestLab team, you're not welcome anymore...
>
> Sending...
>
> ...Sent!
> ########## NOW IS SLEEPING TWO SECONDS ##########
> [root@svr-mila-testlab2 ~]# ls -l
> total 2364
> -rw-r--r-- 1 root root =A0 33980 Feb =A08 =A02007 1
> -rw------- 1 root root =A0 =A01534 Feb =A05 =A02007 anaconda-ks.cfg
> drwxr-xr-x 2 root root =A0 =A04096 Feb =A05 =A02007 Desktop
> -rw-r--r-- 1 root root =A0 38253 Feb =A05 =A02007 install.log
> -rw-r--r-- 1 root root =A0 =A04475 Feb =A05 =A02007 install.log.syslog
> -rw-r--r-- 1 root root 2297093 Sep 24 10:01 sb-log.txt
> -rw-r--r-- 1 root root =A0 =A03034 Feb =A06 =A02007 xorg.conf.new
> drwxr-xr-x 2 root root =A0 =A04096 Feb =A07 =A02007 yum-keys
> [root@svr-mila-testlab2 ~]#
> Sending...
>
> ...Sent!
> ########## NOW IS SLEEPING FIVE SECONDS ##########
> ls
> 1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Desktop =A0 =A0 =A0install.log.syslog =
=A0xorg.conf.new
> anaconda-ks.cfg =A0install.log =A0sb-log.txt =A0 =A0 =A0 =A0 =A0yum-keys
> [root@svr-mila-testlab2 ~]#
> Sending...
>
> ...Sent!
> exit
> logout
> Connection to 10.17.39.29 closed.
> ********************************************************
>
> Instead, what I expect should be something like this:
> ********************************************************
> r...@10.17.39.29's password:
> Sending...
> Last login: Wed Sep 24 09:57:48 2008 from 10.17.91.83
> Welcome to the Milan TestLab server
> If you're not part of the TestLab team, you're not welcome anymore...
> [root@svr-mila-testlab2 ~]#
> ...Sent!
>
> Sending...
> =A0ls -l
> total 2364
> -rw-r--r-- 1 root root =A0 33980 Feb =A08 =A02007 1
> -rw------- 1 root root =A0 =A01534 Feb =A05 =A02007 anaconda-ks.cfg
> drwxr-xr-x 2 root root =A0 =A04096 Feb =A05 =A02007 Desktop
> -rw-r--r-- 1 root root =A0 38253 Feb =A05 =A02007 install.log
> -rw-r--r-- 1 root root =A0 =A04475 Feb =A05 =A02007 install.log.syslog
> -rw-r--r-- 1 root root 2297093 Sep 24 10:01 sb-log.txt
> -rw-r--r-- 1 root root =A0 =A03034 Feb =A06 =A02007 xorg.conf.new
> drwxr-xr-x 2 root root =A0 =A04096 Feb =A07 =A02007 yum-keys
> [root@svr-mila-testlab2 ~]#
> ...Sent!
>
> ########## NOW IS SLEEPING TWO SECONDS ##########
>
> Sending...
> ls
> 1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Desktop =A0 =A0 =A0install.log.syslog =
=A0xorg.conf.new
> anaconda-ks.cfg =A0install.log =A0sb-log.txt =A0 =A0 =A0 =A0 =A0yum-keys
> [root@svr-mila-testlab2 ~]#
> ...Sent!
> ########## NOW IS SLEEPING FIVE SECONDS ##########
>
> Sending...
> exit
> ...Sent!
>
> logout
> Connection to 10.17.39.29 closed.
> ********************************************************
>
> Maybe it's ok that "...Sent!" is displayed right after "Sending..."
> because the output of the 'send' command takes longer to display and
> it comes after, but the time of displaying "Sending..." is wrong
> anyway and, above all, the time of 'sleep' is wrong.
> Of course this is trivial example but I need to display output lines
> and execute 'sleep' commands in the proper order to build a more
> complex non-interactive script.
>
> Any idea?
>
> Thanks,
> Andrea
I ran again the exp_internal tool for debug and found that somehow the
'sleep' commands are correctly executed but the output is displayed at
the wrong time, see below (I added comments to highlight 'sleep'
executions that are not logged by exp_internal):
**************************************************************
Spawned 'ssh -l root 10.17.39.29'
spawn id(3)
Pid: 31550
Tty: /dev/pts/4
Expect::spawn('Expect=3DGLOB(0x9817238)','ssh -l root 10.17.39.29')
called
at ./ssh.pl line 34
Starting EXPECT pattern matching...
Expect::expect('Expect=3DGLOB(0x9817238)',5,'ARRAY(0x9822520)') called
at
./ssh.pl line 37
spawn id(3): list of patterns:
#1: -re `[Pp]assword'
spawn id(3): Does `'
match:
pattern #1: -re `[Pp]assword'? No.
root@10.17.39.29's password:
spawn id(3): Does `root@10.17.39.29\'s password: '
match:
pattern #1: -re `[Pp]assword'? YES!!
Before match string: `root@10.17.39.29\'s '
Match string: `password'
After match string: `: '
Matchlist: ()
Calling hook CODE(0x9817274)...
Sending...
Sending 'XXXXXXXX\n' to spawn id(3)
Expect::print('Expect=3DGLOB(0x9817238)','XXXXXXXX\x{a}') called at ./
ssh.
pl line 37
main::__ANON__('Expect=3DGLOB(0x9817238)') called at /usr/lib/perl5/
site_p
erl/5.8.3/Expect.pm line 758
Expect::_multi_expect(5,'undef','ARRAY(0x98380d4)') called at /usr/
lib/p
erl5/site_perl/5.8.3/Expect.pm line 563
Expect::expect('Expect=3DGLOB(0x9817238)',5,'ARRAY(0x9822520)') called
at
./ssh.pl line 37
...Sent!
Starting EXPECT pattern matching...
Expect::expect('Expect=3DGLOB(0x9817238)',5,'ARRAY(0x98069ec)') called
at
./ssh.pl line 56
spawn id(3): list of patterns:
#1: -re `svr-mila'
spawn id(3): Does `: '
match:
pattern #1: -re `svr-mila'? No.
spawn id(3): Does `: \n'
match:
pattern #1: -re `svr-mila'? No.
spawn id(3): Does `: \nLast login: Wed Sep 24 11:05:15 2008 from
10.17.91.83\r\r
\nWelcome to the Milan TestLab server\r\nIf you\'re not part of the
TestLab team
, you\'re not welcome anymore...\r\n\r\n'
match:
pattern #1: -re `svr-mila'? No.
Last login: Wed Sep 24 11:05:15 2008 from 10.17.91.83
Welcome to the Milan TestLab server
If you're not part of the TestLab team, you're not welcome anymore...
spawn id(3): Does `: \nLast login: Wed Sep 24 11:05:15 2008 from
10.17.91.83\r\r
\nWelcome to the Milan TestLab server\r\nIf you\'re not part of the
TestLab team
, you\'re not welcome anymore...\r\n\r\n[root@svr-mila-testlab2 ~]# '
match:
pattern #1: -re `svr-mila'? YES!!
Before match string: `: \nLast login: Wed Sep 24 11:05:15 2008
from 10.17.91
.83\r\r\nWelcome to the Milan TestLab server\r\nIf you\'re not part of
the TestL
ab team, you\'re not welcome anymore...\r\n\r\n[root@'
Match string: `svr-mila'
After match string: `-testlab2 ~]# '
Matchlist: ()
Calling hook CODE(0x981743c)...
Sending 'ls -l\n' to spawn id(3)
Expect::print('Expect=3DGLOB(0x9817238)','ls -l\x{a}') called at ./
ssh.pl
line 53
main::__ANON__('Expect=3DGLOB(0x9817238)') called at /usr/lib/perl5/
site_p
erl/5.8.3/Expect.pm line 758
Expect::_multi_expect(5,'undef','ARRAY(0x97a9bf4)') called at /usr/
lib/p
erl5/site_perl/5.8.3/Expect.pm line 563
Expect::expect('Expect=3DGLOB(0x9817238)',5,'ARRAY(0x98069ec)') called
at
./ssh.pl line 56
[root@svr-mila-testlab2 ~]#
Sending...
...Sent!
########## NOW IT'S SLEEPING 2 SECONDS ##########
Starting EXPECT pattern matching...
Expect::expect('Expect=3DGLOB(0x9817238)',5,'ARRAY(0x98382a8)') called
at
./ssh.pl line 72
spawn id(3): list of patterns:
#1: -re `svr-mila'
spawn id(3): Does `-testlab2 ~]# '
match:
pattern #1: -re `svr-mila'? No.
ls -l
total 2368
-rw-r--r-- 1 root root 33980 Feb 8 2007 1
-rw------- 1 root root 1534 Feb 5 2007 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 Feb 5 2007 Desktop
-rw-r--r-- 1 root root 38253 Feb 5 2007 install.log
-rw-r--r-- 1 root root 4475 Feb 5 2007 install.log.syslog
-rw-r--r-- 1 root root 2299385 Sep 24 11:06 sb-log.txt
-rw-r--r-- 1 root root 3034 Feb 6 2007 xorg.conf.new
drwxr-xr-x 2 root root 4096 Feb 7 2007 yum-keys
[root@svr-mila-testlab2 ~]#
spawn id(3): Does `-testlab2 ~]# ls -l\r\n\033[00mtotal 2368\r\n-rw-r--
r-- 1 roo
t root 33980 Feb 8 2007 \033[00m1\033[00m\r\n-rw------- 1 root
root 1534
Feb 5 2007 \033[00manaconda-ks.cfg\033[00m\r\ndrwxr-xr-x 2 root
root 4096 F
eb 5 2007 \033[01;34mDesktop\033[00m\r\n-rw-r--r-- 1 root root
38253 Feb 5
2007 \033[00minstall.log\033[00m\r\n-rw-r--r-- 1 root root 4475
Feb 5 2007
\033[00minstall.log.syslog\033[00m\r\n-rw-r--r-- 1 root root 2299385
Sep 24 11:
06 \033[00msb-log.txt\033[00m\r\n-rw-r--r-- 1 root root 3034 Feb
6 2007 \03
3[00mxorg.conf.new\033[00m\r\ndrwxr-xr-x 2 root root 4096 Feb 7
2007 \033[0
1;34myum-keys\033[00m\r\n\033[m[root@svr-mila-testlab2 ~]# '
match:
pattern #1: -re `svr-mila'? YES!!
Before match string: `-testlab2 ~]# ls -l\r\n\033[00mtotal 2368\r
\n-rw-r--r-
- 1 root root 33980 Feb 8 2007 \033[00m1\033[00m\r\n-rw------- 1
root root
1534 Feb 5 2007 \033[00manaconda-ks.cfg\033[00m\r\ndrwxr-xr-x 2
root root
4096 Feb 5 2007 \033[01;34mDesktop\033[00m\r\n-rw-r--r-- 1 root
root 38253
Feb 5 2007 \033[00minstall.log\033[00m\r\n-rw-r--r-- 1 root root
4475 Feb
5 2007 \033[00minstall.log.syslog\033[00m\r\n-rw-r--r-- 1 root root
2299385 Sep
24 11:06 \033[00msb-log.txt\033[00m\r\n-rw-r--r-- 1 root root 3034
Feb 6 2
007 \033[00mxorg.conf.new\033[00m\r\ndrwxr-xr-x 2 root root 4096
Feb 7 2007
\033[01;34myum-keys\033[00m\r\n\033[m[root@'
Match string: `svr-mila'
After match string: `-testlab2 ~]# '
Matchlist: ()
Calling hook CODE(0x9814f54)...
Sending...
Sending 'ls\n' to spawn id(3)
Expect::print('Expect=3DGLOB(0x9817238)','ls\x{a}') called at ./ssh.pl
lin
e 69
main::__ANON__('Expect=3DGLOB(0x9817238)') called at /usr/lib/perl5/
site_p
erl/5.8.3/Expect.pm line 758
Expect::_multi_expect(5,'undef','ARRAY(0x98380e0)') called at /usr/
lib/p
erl5/site_perl/5.8.3/Expect.pm line 563
Expect::expect('Expect=3DGLOB(0x9817238)',5,'ARRAY(0x98382a8)') called
at
./ssh.pl line 72
...Sent!
########## NOW IT'S SLEEPING FIVE SECONDS ###########
Starting EXPECT pattern matching...
Expect::expect('Expect=3DGLOB(0x9817238)',5,'ARRAY(0x9575530)') called
at
./ssh.pl line 90
spawn id(3): list of patterns:
#1: -re `svr-mila'
spawn id(3): Does `-testlab2 ~]# '
match:
pattern #1: -re `svr-mila'? No.
ls
1 Desktop install.log.syslog xorg.conf.new
anaconda-ks.cfg install.log sb-log.txt yum-keys
[root@svr-mila-testlab2 ~]#
spawn id(3): Does `-testlab2 ~]# ls\r\n\033[00m
\033[00m1\033[00m
\033[01;34mDesktop\033[00m \033[00minstall.log.syslog\033[00m
\033[00mxorg
.conf.new\033[00m\r\n\033[00manaconda-ks.cfg\033[00m
\033[00minstall.log\033[00
m \033[00msb-log.txt\033[00m \033[01;34myum-keys\033[00m\r\n
\033[m[roo
t@svr-mila-testlab2 ~]# '
match:
pattern #1: -re `svr-mila'? YES!!
Before match string: `-testlab2 ~]# ls\r\n\033[00m
\033[00m1\033[00m
\033[01;34mDesktop\033[00m \033[00minstall.log.syslog
\033[00m \033[
00mxorg.conf.new\033[00m\r\n\033[00manaconda-ks.cfg\033[00m
\033[00minstall.log
\033[00m \033[00msb-log.txt\033[00m \033[01;34myum-keys
\033[00m\r\n\03
3[m[root@'
Match string: `svr-mila'
After match string: `-testlab2 ~]# '
Matchlist: ()
Calling hook CODE(0x98150f8)...
Sending...
Sending 'exit\n' to spawn id(3)
Expect::print('Expect=3DGLOB(0x9817238)','exit\x{a}') called at ./
ssh.pl l
ine 90
main::__ANON__('Expect=3DGLOB(0x9817238)') called at /usr/lib/perl5/
site_p
erl/5.8.3/Expect.pm line 758
Expect::_multi_expect(5,'undef','ARRAY(0x9838074)') called at /usr/
lib/p
erl5/site_perl/5.8.3/Expect.pm line 563
Expect::expect('Expect=3DGLOB(0x9817238)',5,'ARRAY(0x9575530)') called
at
./ssh.pl line 90
...Sent!
exit
logout
Connection to 10.17.39.29 closed.
**********************************************************
Eventhough I could ignore the display to console, I still have the
problem that the log_file does not capture the last part of the script
(from the second "ls" on). So, I still think there is a real issue
with STDOUT buffering.
Any way out?
Thanks,
Andrea
------------------------------
Date: Tue, 23 Sep 2008 17:08:23 -0700
From: Tim Greer <tim@burlyhost.com>
Subject: Re: How to unable the use of tainted mode in a CGI script ?
Message-Id: <XxfCk.558$Cl1.72@newsfe01.iad>
Azol wrote:
> In article <CJZBk.113$Cl1.5@newsfe01.iad>, tim@burlyhost.com says...
>> Azol wrote:
>>
>> > Hello.
>> >
>> > I have to use a long perl script which use the "tainted mode" (-T
>> > option), but the hoster we use doesn't allow this option unless on
>> > dedicated server (and, of course, we can't pay a dedicated server).
>> >
>> > What I have to do to remove the tainted mode in the script ?
>> >
>> > I'm using PERL sometimes, but don't know very well what implies
>> > this "tainted mode" option. However, I suppose removing the "-T" on
>> > bash line isn't enough :(
>> >
>> > Could you tell me, please.
>>
>> What do you mean that your host won't allow you to use Taint mode?
>> Do you mean they don't allow Perl, or actually don't allow you to use
>> Taint mode? That seems crazy, are you sure that's the case and there
>> wasn't some misunderstanding about the question or feature? I can't
>> imagine anyone in their right mind denying a user from using a switch
>> that helps keep your site (and by proxy, their service your site runs
>> on) from being exposed to problems with a potentially insecure
>> portion
>> of your code? Is your script perhaps set to run in the background,
>> launching a child process or something? This is a really strange
>> thing to hear.
>>
>
> Thanks to all of you : it's very cool to get all of your returns :)
>
> Yes, it's the reply of their support : remove the -T option : oops :(
> Their site is http://www.....fr/
>
> Also, effectively, the script manage a child process : what do you
> think about that ?
I had just suggested that perhaps they didn't understand the question,
not that you were running something in the background, but just an
example of a misunderstanding that perhaps they were saying something
else wasn't allowed (if you were using Taint mode in that non allowed
script).
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Tue, 23 Sep 2008 17:08:43 -0700
From: Tim Greer <tim@burlyhost.com>
Subject: Re: How to unable the use of tainted mode in a CGI script ?
Message-Id: <fyfCk.560$Cl1.330@newsfe01.iad>
Azol wrote:
> In article <CJZBk.113$Cl1.5@newsfe01.iad>, tim@burlyhost.com says...
>> What do you mean that your host won't allow you to use Taint mode?
>> Do you mean they don't allow Perl, or actually don't allow you to use
>> Taint mode?
>>
>
> They allow Perl, but not the -T option (so, tainted mode)
Right, I got that part. Odd that they don't allow it.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Wed, 24 Sep 2008 04:42:24 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Sep 24 2008
Message-Id: <K7onqo.AyH@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
AnyEvent-IRC-0.6
http://search.cpan.org/~elmex/AnyEvent-IRC-0.6/
An event system independend IRC protocol module
----
App-Bondage-0.3.0
http://search.cpan.org/~hinrik/App-Bondage-0.3.0/
A featureful IRC bouncer based on POE::Component::IRC
----
Audio-MPD-Common-0.1.3
http://search.cpan.org/~jquelin/Audio-MPD-Common-0.1.3/
a bunch of common helper classes for mpd
----
BerkeleyDB-Manager-0.05
http://search.cpan.org/~nuffin/BerkeleyDB-Manager-0.05/
General purpose BerkeleyDB wrapper
----
CHI-0.08
http://search.cpan.org/~jswartz/CHI-0.08/
Unified cache interface
----
CHI-Driver-Memcached-0.01
http://search.cpan.org/~jswartz/CHI-Driver-Memcached-0.01/
Distributed cache via memcached (memory cache daemon)
----
CPAN-Indexer-Mirror-0.05
http://search.cpan.org/~adamk/CPAN-Indexer-Mirror-0.05/
Creates the mirror.yml and mirror.json files
----
Chart-Clicker-2.10
http://search.cpan.org/~gphat/Chart-Clicker-2.10/
Powerful, extensible charting.
----
Config-Model-0.627
http://search.cpan.org/~ddumont/Config-Model-0.627/
Framework to create configuration validation tools and editors
----
DBD-Pg-2.10.7
http://search.cpan.org/~turnstep/DBD-Pg-2.10.7/
PostgreSQL database driver for the DBI module
----
DBD-Unify-0.75
http://search.cpan.org/~hmbrand/DBD-Unify-0.75/
DBI driver for Unify database systems
----
DBIx-DataModel-1.02
http://search.cpan.org/~dami/DBIx-DataModel-1.02/
Classes and UML-style Associations on top of DBI
----
DBIx-DataModel-1.03
http://search.cpan.org/~dami/DBIx-DataModel-1.03/
Classes and UML-style Associations on top of DBI
----
Data-InputMonster-0.008
http://search.cpan.org/~rjbs/Data-InputMonster-0.008/
consume data from multiple sources, best first; om nom nom!
----
Data-ParseBinary-0.07
http://search.cpan.org/~semuelf/Data-ParseBinary-0.07/
Yet Another parser for binary structures
----
DateTimeX-Easy-0.084
http://search.cpan.org/~rkrimen/DateTimeX-Easy-0.084/
Parse a date/time string using the best method available
----
EekBoek-1.04.00.03
http://search.cpan.org/~jv/EekBoek-1.04.00.03/
Bookkeeping software for small and medium-size businesses
----
EekBoek-1.04.00.04
http://search.cpan.org/~jv/EekBoek-1.04.00.04/
Bookkeeping software for small and medium-size businesses
----
Foorum-0.2.6
http://search.cpan.org/~fayland/Foorum-0.2.6/
forum system based on Catalyst
----
Geometry-Primitive-0.12
http://search.cpan.org/~gphat/Geometry-Primitive-0.12/
Primitive Geometry Entities
----
Gitosis-Config-0.0.1
http://search.cpan.org/~perigrin/Gitosis-Config-0.0.1/
Parse and Write gitosis config files
----
Google-Chart-0.05007
http://search.cpan.org/~dmaki/Google-Chart-0.05007/
Interface to Google Charts API
----
Graphics-Primitive-0.31
http://search.cpan.org/~gphat/Graphics-Primitive-0.31/
Device and library agnostic graphic primitives
----
Graphics-Primitive-0.32
http://search.cpan.org/~gphat/Graphics-Primitive-0.32/
Device and library agnostic graphic primitives
----
Graphics-Primitive-Driver-Cairo-0.25
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-Cairo-0.25/
Cairo backend for Graphics::Primitive
----
Graphics-Primitive-Driver-Cairo-0.26
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-Cairo-0.26/
Cairo backend for Graphics::Primitive
----
Graphics-Primitive-Driver-Cairo-0.27
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-Cairo-0.27/
Cairo backend for Graphics::Primitive
----
Graphics-Primitive-Driver-Cairo-0.28
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-Cairo-0.28/
Cairo backend for Graphics::Primitive
----
Graphics-Primitive-Driver-CairoPango-0.1
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-CairoPango-0.1/
Cairo/Pango backend for Graphics::Primitive
----
Graphics-Primitive-Driver-CairoPango-0.2
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-CairoPango-0.2/
Cairo/Pango backend for Graphics::Primitive
----
Graphics-Primitive-Driver-CairoPango-0.3
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-CairoPango-0.3/
Cairo/Pango backend for Graphics::Primitive
----
HTML-Widget-Plugin-JS-0.001
http://search.cpan.org/~rjbs/HTML-Widget-Plugin-JS-0.001/
a JavaScript combo box widget
----
Kephra-0.3.10_18
http://search.cpan.org/~lichtkind/Kephra-0.3.10_18/
crossplatform, GUI-Texteditor along perllike Paradigms
----
Mac-PropertyList-SAX-0.82
http://search.cpan.org/~kulp/Mac-PropertyList-SAX-0.82/
work with Mac plists at a low level, fast
----
MasonX-Resolver-WidgetFactory-0.007
http://search.cpan.org/~rjbs/MasonX-Resolver-WidgetFactory-0.007/
resolve paths to HTML::Widget::Factory plugins
----
Net-IRC3-0.6
http://search.cpan.org/~elmex/Net-IRC3-0.6/
An event system independend IRC protocol module
----
ORLite-0.14
http://search.cpan.org/~adamk/ORLite-0.14/
Extremely light weight SQLite-specific ORM
----
Object-Event-0.6
http://search.cpan.org/~elmex/Object-Event-0.6/
A class that provides an event callback interface
----
Panotools-Script-0.18
http://search.cpan.org/~bpostle/Panotools-Script-0.18/
Panorama Tools scripting
----
Parse-MediaWikiDump-0.52
http://search.cpan.org/~triddle/Parse-MediaWikiDump-0.52/
Tools to process MediaWiki dump files
----
RWDE-518
http://search.cpan.org/~damjanp/RWDE-518/
Rapid Web Development Framework
----
RWDE-Doxy-518
http://search.cpan.org/~damjanp/RWDE-Doxy-518/
----
Rose-DBx-Object-Cached-CHI-0.08
http://search.cpan.org/~kmcgrath/Rose-DBx-Object-Cached-CHI-0.08/
Rose::DB::Object Cache using the CHI interface
----
SMS-Claro-0.01
http://search.cpan.org/~tbr/SMS-Claro-0.01/
Send SMS messages via Claro (BAE).
----
SVN-Hooks-0.07.357
http://search.cpan.org/~gnustavo/SVN-Hooks-0.07.357/
A framework for implementing Subversion hooks.
----
Task-Kensho-0.0.2
http://search.cpan.org/~perigrin/Task-Kensho-0.0.2/
A Glimpse at an Enlightened Perl
----
Test-Reporter-1.5201
http://search.cpan.org/~dagolden/Test-Reporter-1.5201/
sends test results to cpan-testers@perl.org
----
Text-Editor-Easy-0.41
http://search.cpan.org/~grommier/Text-Editor-Easy-0.41/
A perl module to edit perl code with syntax highlighting and more.
----
Text-Template-Simple-0.54_13
http://search.cpan.org/~burak/Text-Template-Simple-0.54_13/
Simple text template engine
----
Tk-Date-0.43
http://search.cpan.org/~srezic/Tk-Date-0.43/
a date/time widget for perl/Tk
----
Tk-FontDialog-0.15
http://search.cpan.org/~srezic/Tk-FontDialog-0.15/
a font dialog widget for perl/Tk
----
Tk-GBARR-2.08
http://search.cpan.org/~srezic/Tk-GBARR-2.08/
----
Tk-Getopt-0.50
http://search.cpan.org/~srezic/Tk-Getopt-0.50/
User configuration window for Tk with interface to Getopt::Long
----
Tk-HistEntry-0.43_50
http://search.cpan.org/~srezic/Tk-HistEntry-0.43_50/
Entry widget with history capability
----
Tk-LogScale-0.09
http://search.cpan.org/~srezic/Tk-LogScale-0.09/
A logarithmic Scale widget
----
URI-ParseSearchString-2.6
http://search.cpan.org/~sden/URI-ParseSearchString-2.6/
parse Apache refferer logs and extract search engine query strings.
----
kurila-1.14_0
http://search.cpan.org/~tty/kurila-1.14_0/
Perl Kurila
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Wed, 24 Sep 2008 00:33:42 +0200
From: Hans Mulder <hansmu@xs4all.nl>
Subject: Re: question about "package" and variable scope...
Message-Id: <48d96f6e$0$188$e4fe514c@news.xs4all.nl>
Raymundo wrote:
> Then, if I want to
> declare a variable that is visible in "only this package"... is there
> any way to do so? (other than using braces that enclose the entire
> package)
Package variables are global in scope: you can access them from anywhere
using the $package::name notation.
> (other than using braces that enclose the entire package)
Even that won't help:
$foo = "foo from main\n";
{
package Foo;
$foo = "foo from Foo\n";
}
print $foo; # foo from main
print $Foo::foo; # foo from Foo
You can use the $Foo::foo notation to access variables in packages
that aren't mentioned anywhere else in your script. Perl will
silently create the package if that's what it takes to make this work.
If you want to restrict visibility, you'll have to use "my". But "my"
pays attention only to braces and file boundaries, not to packages.
Hope this helps,
-- HansM
------------------------------
Date: Tue, 23 Sep 2008 06:06:02 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: question about "package" and variable scope...
Message-Id: <slrngdhjcq.ut2.tadmc@tadmc30.sbcglobal.net>
Raymundo <gypark@gmail.com> wrote:
> Ooops.. I couldn't even imagine that "our" and "use vars" have
> different scope rule...
Simply read their documentation...
perldoc -f our
... within the lexical scope of the C<our> declaration ...
perldoc vars
the "use vars" and "use subs" declarations are not BLOCK−scoped.
They are thus effective for the entire file in which they appear...
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Tue, 23 Sep 2008 06:09:02 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Unix Shell Scripting course started in Kalwa
Message-Id: <slrngdhjie.ut2.tadmc@tadmc30.sbcglobal.net>
Shubham <shubhamcomp@gmail.com> wrote:
> As Shell scripting is essential part of system administration
This is the Perl newsgroup.
comp.unix.shell is thataway ===>
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1872
***************************************