Operating System - HP-UX
1833065 Members
2663 Online
110049 Solutions
New Discussion

using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

 
SOLVED
Go to solution
Belina Ang_1
Occasional Advisor

using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Does anyone have any idea why using the script below on HP-UX 11 works and not on HP-UX 11.11?

HOST=$1
ID=$2
PW=$3
telnet $HOST 2>&1 | tee /tmp/logfile |&
(sleep 1; print -p $ID)
(sleep 1; print -p $PW)
(sleep 1; print -p echo hello)
a="$(sleep 1; read -p | tr -d '\r')"
while [[ "$a" != *hello* ]] ;
do
print [$a]
a="$(sleep 1; read -p | tr -d '\r')"
done
print -p echo exit

Thanks in advance....
13 REPLIES 13
Michael Steele_2
Honored Contributor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Why don't you add debug lines? And see's how far it gets?

ksh: set -xv

sh: sh -x -v script
Support Fatherhood - Stop Family Law
Belina Ang_1
Occasional Advisor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Did that already as well as tusc, but was not able to see anything important except in the tusc file. On HP-UX 11.11, it seems to be using a select() instead of a sigtimedwait().

Michael Steele_2
Honored Contributor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

You do have one of the following on the first line, right?

#!/usr/bin/ksh

#!/usr/bin/sh
Support Fatherhood - Stop Family Law
Ramkumar Devanathan
Honored Contributor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

hi,

I've seen this problem with 11.11 machines. But somehow now I am not able to reproduce this on the same hp-ux 11.11 machine. Check if this is a problem with patches required.

In any case, I suggest you use something like remsh to do the above. or even expect scripts.

http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.37/

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x2919237a4bc6d611abdb0090277a778c,00.html

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x9ec691ccb36bd611abdb0090277a778c,00.html

- ramd.
HPE Software Rocks!
Belina Ang_1
Occasional Advisor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Yes, there is a
!#/usr/bin/ksh -x
on the first line. I am more inclined to think that patches would solve the problem. I just have not found the correct one yet. If anyone remembers, would really appreciate it.
Jeff Schussele
Honored Contributor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Hi Belina,

That first line HAS to be Sh-Bang - like

#!/usr/bin/ksh -x

NOT

!#/usr/bin/ksh -x

Was that just a typo in your last post?

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Belina Ang_1
Occasional Advisor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Sorry, typo

it was a ....

#!/usr/bin/ksh

Ramkumar Devanathan
Honored Contributor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Belina,

I don't know if this will help very much, but my ksh binary has this what string -

# what /usr/bin/ksh
/usr/bin/ksh:
$Revision: B.11.11_LR
Wed Nov 8 19:55:23 PST 2000 $
$ B.11.11_LR Oct 27 2000 00:40:10 $
Version 11/16/88

I ran the following script several times just now -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#!/usr/bin/ksh

cat /var/adm/syslog/syslog.log |&
while read -p line
do
echo $line
done
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

And it worked fine.

Probably you may try to increase some kernel parameters - max_thread_proc is 1024 on this machine.

- ramd.
HPE Software Rocks!
Steven E. Protter
Exalted Contributor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

First thing I'd do is check the PATH varable. All the commands you are using were migrated to 11.11 as far as I know. If its a new system, the /etc/profile might be different, causing different behavior.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Belina Ang_1
Occasional Advisor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Hello Ramd,

=> what /usr/bin/ksh
/usr/bin/ksh:
$Revision: B.11.11_LR
Wed Nov 8 19:55:23 PST 2000 $
$ B.11.11_LR Oct 27 2000 00:40:10 $
Version 11/16/88

The script you wrote also worked on my 11.11

I have exactly the same results you got. I think I might be looking for a telnet patch since when I compared the tusc outputs between a 11 and 11.11. It started being different at the point when the password is about to be entered. I was ablt to enter the login name, but when it prompted for the password, I was getting the following:

Password: Local flow control on
Connection closed by foreign host.


19174: select(2048, 0x40005860, 0x40005760, 0x40005660, NULL) = 1
19174: recv(4, 0x400064f8, 1024, 0) = 0
19174: ioctl(0, TCSETATTRD, 0x7aff09c4) ERR#25 ENOTTY
19174: ioctl(0, TIOCSLTC, 0x40004b30) ERR#25 ENOTTY
19174: ioctl(0, FIONBIO, 0x7aff0a08) ERR#25 ENOTTY
19174: ioctl(1, FIONBIO, 0x7aff0a08) ERR#25 ENOTTY
19174: close(4) = 0
19174: ioctl(0, TCSETATTRD, 0x7aff0a04) ERR#25 ENOTTY
19174: ioctl(0, TIOCSLTC, 0x40004b38) ERR#25 ENOTTY
19174: ioctl(0, FIONBIO, 0x7aff0a48) ERR#25 ENOTTY
19174: ioctl(1, FIONBIO, 0x7aff0a48) ERR#25 ENOTTY
19174: select(2, NULL, 0x7aff09b8, NULL, NULL) = 1
19174: ioctl(0, TCSETATTRD, 0x7aff0a04) ERR#25 ENOTTY
19174: ioctl(0, TIOCSLTC, 0x40004b30) ERR#25 ENOTTY
19174: ioctl(0, FIONBIO, 0x7aff0a48) ERR#25 ENOTTY
19174: ioctl(1, FIONBIO, 0x7aff0a48) ERR#25 ENOTTY
Ramkumar Devanathan
Honored Contributor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Ok Belina,

I guess that explains it. Your connection got closed and so, the pipe was broken!

I think I might have faced a similar problem in reading a file which was probably not present. what are the errors you get when you run the script actually?

- ramd.
HPE Software Rocks!
Dietmar Konermann
Honored Contributor
Solution

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

I digged a little bit around this symptom.

The problem is not 11.11 specific. Instead it applies for 11.00 and 11.11, but was actually introduced by patches.

In fact the fix for JAGab75328 (11.00 PHNE_22159, 11.11 PHNE_23937) introduced it. With this fix the connection is supposed to be dropped if "stty 0" is issued. As a side effect telnetd closes connections when the speed is "0"... unfortunately this is true when telnet's stdin is no tty.

JAGae02032 adresses this incompatibility. It is included in the latest telnetd patches (11.00 PHNE_26096, 11.11 PHNE_24829) and restores the original behaviour, unless telnetd's new "-y" option is used.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Belina Ang_1
Occasional Advisor

Re: using ksh or posix sh coprocessor |& with telnet on HP-UX 11 works but not on 11.11

Thank you everybody for your help.

=) Thanks again....