From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9524 invoked from network); 15 May 2008 17:38:49 -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:38:49 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 21317 invoked from network); 15 May 2008 17:38:42 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 May 2008 17:38:42 -0000 Received: (qmail 29017 invoked by alias); 15 May 2008 17:38:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25046 Received: (qmail 28997 invoked from network); 15 May 2008 17:38:38 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 15 May 2008 17:38:38 -0000 Received: from smtpoutm.mac.com (smtpoutm.mac.com [17.148.16.71]) by bifrost.dotsrc.org (Postfix) with ESMTP id B780480589A4 for ; Thu, 15 May 2008 19:38:34 +0200 (CEST) Received: from asmtp012-bge351000 (asmtp012-bge351000 [10.150.69.75]) by smtpoutm.mac.com (Xserve/smtpout008/MantshX 4.0) with ESMTP id m4FHcXXN021246 for ; Thu, 15 May 2008 10:38:33 -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 <0K0X0021L7O79530@asmtp012.mac.com> for zsh-workers@sunsite.dk; Thu, 15 May 2008 10:38:33 -0700 (PDT) In-reply-to: <480CEB80051F27AE@mac.com> 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:38:34 -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 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 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