Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tcl crashes when reading copyright symbol

Status
Not open for further replies.

vijipriya

Programmer
Jul 25, 2007
2
US
Hi,

I have an expect script that logs into a remote machine using ssh. Upon successful authentication, the remote machine displays a banner that contains the following text: "Copyright © 2001", which appears as "Copyright \357\276\251 2001," in the expect_out buffer and Expect/Tcl crashes when parsing this banner text. The debug of the core file indicate that a SIGSEGV is raised in Tcl_UniCharToUtf() when processing that 'copyright symbol'. If that symbol is removed, then everything works successfully.

Please advice how this can be resolved.

Thanks in advance.

Regards,
Priya.


========================================
Debug of the core file:
For information about new features see `help changes'
To remove this message, put `dbxenv suppress_startup_message 7.5' in your .dbxrc
Reading expect
core file header read successfully
Reading ld.so.1
Reading libtcl8.4.so
Reading libdl.so.1
Reading libsocket.so.1
Reading libnsl.so.1
Reading libm.so.2
Reading libc.so.1
Reading libc_psr.so.1
Reading en_US.ISO8859-1.so.3
program terminated by signal SEGV (no mapping at the fault address)
0xff312234: Tcl_UniCharToUtf+0x0058: stb %o3, [%o1 + 1]
(dbx) where
=>[1] Tcl_UniCharToUtf(0xa9, 0x90000, 0x2, 0xa9, 0x75068, 0xa9), at 0xff312234
[2] expNullStrip(0x6dcb0, 0x60c, 0x75674, 0x0, 0x90000, 0x90000), at 0x23ea4
[3] expRead(0x47be8, 0x50650, 0x1, 0xffbfe8ac, 0x3c, 0xa), at 0x241fc
[4] Exp_ExpectObjCmd(0x41ca0, 0x47be8, 0x6, 0xffbfec6c, 0x0, 0x4), at 0x258a0
[5] TclEvalObjvInternal(0x47be8, 0x6, 0xffbfec6c, 0xff34b8b0, 0x0, 0x5e310), at 0xff2a30bc
[6] Tcl_EvalObjv(0x47be8, 0x6, 0xffbfec6c, 0x0, 0xffbfeacc, 0xffbfe984), at 0xff2a357c
[7] exp_eval_with_one_arg(0x0, 0x47be8, 0x4884c, 0x0, 0x6, 0xffbfec6c), at 0x21a94
[8] Exp_ExpectObjCmd(0x0, 0x47be8, 0x2, 0x4884c, 0x94, 0x3), at 0x25558
[9] TclEvalObjvInternal(0x47be8, 0x2, 0x4884c, 0x0, 0x0, 0x5e310), at 0xff2a30bc
[10] TclExecuteByteCode(0x47be8, 0x1, 0x0, 0x2, 0x4884c, 0x48848), at 0xff2d268c
[11] TclCompEvalObj(0x47be8, 0x4f580, 0x0, 0x0, 0x8f, 0x1), at 0xff2d1cac
[12] TclObjInterpProc(0x0, 0x47be8, 0xffbff1e8, 0xffbff6a0, 0xff33fe60, 0x4fc68), at 0xff30aaac
[13] TclEvalObjvInternal(0x47be8, 0x3, 0xffbff6a0, 0x633fe, 0x1d, 0x5ffc8), at 0xff2a30bc
[14] Tcl_EvalEx(0x47be8, 0x60660, 0xffbff6ac, 0x0, 0x2ad, 0xffbff6a0), at 0xff2a3db0
[15] Tcl_FSEvalFile(0x47be8, 0x4f6b8, 0x1, 0x0, 0x5ee38, 0x4f670), at 0xff2f14ac
[16] Tcl_EvalFile(0x47be8, 0xffbffbb6, 0x4f6b8, 0x10, 0x1, 0x0), at 0xff2f001c
[17] exp_interpret_cmdfilename(0x47be8, 0xffbffbb6, 0xffbffa8c, 0x4, 0x5f520, 0xb), at 0x17228
[18] main(0xb, 0xffbffa8c, 0xffbffabc, 0x3f400, 0x0, 0x47be8), at 0x15990
(dbx) quit
 
Is there any way to read the remote stream as binary and convert it on the client side?

_________________
Bob Rashkin
 
Thanks for your reply Bob. I am curious to learn how to read that in binary. Could you pls tell me how to do it?
=======================
This issue got resolved by changing the encoding type. By default the encoding type was "identity". When I changed it to utf-8 using the command: "encoding system utf-8", it worked.




 
At some point you open the stream. I don't know much about EXPECT but in "straight" Tcl, when you open a stream, you get an ID number returned. Then you can configure that stream: fconfigure <ID number> -translation binary

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top