From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4705 invoked from network); 15 May 2008 17:53:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 May 2008 17:53:13 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 26543 invoked from network); 15 May 2008 17:53:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 May 2008 17:53:09 -0000 Received: (qmail 8356 invoked by alias); 15 May 2008 17:53:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25047 Received: (qmail 8339 invoked from network); 15 May 2008 17:53:05 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 15 May 2008 17:53:05 -0000 Received: from smtpoutm.mac.com (smtpoutm.mac.com [17.148.16.74]) by bifrost.dotsrc.org (Postfix) with ESMTP id DE90780589A4 for ; Thu, 15 May 2008 19:53:01 +0200 (CEST) Received: from asmtp012-bge351000 (asmtp012-bge351000 [10.150.69.75]) by smtpoutm.mac.com (Xserve/smtpout011/MantshX 4.0) with ESMTP id m4FHr0pm014695 for ; Thu, 15 May 2008 10:53:00 -0700 (PDT) MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Received: from [192.168.1.254] (static-141-157-25-210.balt.east.verizon.net [141.157.25.210]) by asmtp012.mac.com (Sun Java(tm) System Messaging Server 6.3-6.03 (built Mar 14 2008; 32bit)) with ESMTPA id <0K0X002BT8C95C30@asmtp012.mac.com> for zsh-workers@sunsite.dk; Thu, 15 May 2008 10:53:00 -0700 (PDT) In-reply-to: References: <34AE8142-F5DA-44FD-96BA-61BDE12BC74E@mac.com> <200805151318.m4FDIvKS015244@news01.csr.com> <20080515145054.GC5190@sc.homeunix.net> <99E8D43E-EC34-48DB-A5AD-BFA197A3AAA3@mac.com> <480CEB80051F27AE@mac.com> Message-id: Content-transfer-encoding: quoted-printable From: Jaime Vargas Subject: Re: zpty woes Date: Thu, 15 May 2008 13:53:00 -0400 To: Zsh hackers list X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: ClamAV 0.91.2/7129/Thu May 15 18:00:53 2008 on bifrost X-Virus-Status: Clean I got it working. By changing the pattern to '*assword:'. Thanks for =20 the help. -- Jaime On May 15, 2008, at 1:38 PM, Jaime Vargas wrote: > Still no luck. Am I missing something stupid? > > nerd% ./zpty-test.zsh > +./zpty-test.zsh:4> zmodload zsh/zpty > +./zpty-test.zsh:8> zpty scppty scp hello.world 'user@host:~/' > +./zpty-test.zsh:9> zpty -t scppty > +./zpty-test.zsh:10> zpty -r scppty line assword: > > #!/opt/csw/bin/zsh > set -x > zmodload zsh/zpty > die() {print -r -- $1 >&2; exit 1;} > zpty scppty scp hello.world user@host:~/ > zpty -t scppty || die "fuck" > zpty -r scppty line "assword:" || die "no password asked" > zpty -w scppty "TopSecret" > while zpty -r scppty line; > do > result+=3D"$line"$'\n' > done > zpty -d scppty > print $result > > On May 15, 2008, at 1:03 PM, Stephane Chazelas wrote: > >> On Thu, May 15, 2008 at 12:00:25PM -0400, Jaime Vargas wrote: >>> Still doesn't work for me. Below is the modified script and the =20 >>> debug >>> output. >>> >>> #!/opt/csw/bin/zsh >>> >>> set -x >>> >>> zmodload zsh/zpty >>> >>> die() {print -r -- $1 >&2; exit 1;} >>> >>> zpty scppty scp hello.world jvargas@aoma6000-4-9.aoma.rhbss.com:~/ >>> zpty -t scppty || die "fuck" >>> zpty -r scppty line "*:" || die "no password asked" >>> zpty -w scppty "3lp&tbw" >>> while zpty -r scppty line; >>> do >>> result+=3D"$line"$'\n' >>> done >>> zpty -d scppty >>> print $result >>> >>> I changed my credentials for security. Basically it now hangs =20 >>> waitng for >>> password and doesnt' do anything. -- Jaime >>> >>> nerd% ./zpty-test.zsh >>> +./zpty-test.zsh:5> zmodload zsh/zpty >>> +./zpty-test.zsh:10> zpty scppty scp hello.world 'luser@host:~/' >>> +./zpty-test.zsh:11> zpty -t scppty >>> +./zpty-test.zsh:12> zpty -r scppty line '*:' >> >> Had you printed $line, you'd have seen something like >> "+myscript:", not "Passwd: ". >> >> >> [...] >>> +./zpty-test.zsh:14> zpty -r scppty line >> [...] >> >> As Peter said, if you don't provide with a pattern to look for, >> zpty will look for NL characters. >> >> That last zpty is probably still waiting because so far, it has >> only received "Password: " and is waiting for a NL character >> that will never come. >> >> So, in your code above, you should wait for something more >> specific than just ":": >> >> zpty -r scppty line "assword: " || die "no password asked" >> >> for instance. >> >> --=20 >> St=E9phane >