| Ticket UUID: | 7fcb7ca586605f5dfaafc78d47366b6c4074e4e8 | |||
| Title: | exec on a script which execute the 'rsh' command | |||
| Type: | Bug | Version: | wish v8.5 | |
| Submitter: | anonymous | Created on: | 2014-10-08 10:42:09 | |
| Subsystem: | 75. wish | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Open | Last Modified: | 2014-10-20 10:03:07 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
This bug is similar to : http://sourceforge.net/p/tcl/mailman/message/16175494/ TCL code : exec ./script.sh & Bash script script.sh : [...] rsh [IP] ls ==> Hang on this line The wish processus is stopped (and can run again with a SIGCONT signal). The Bash script is also stopped. The rsh processus is also stopped. Sending a SIGCONT to the rsh processus stop again the wish processus... The script works if it is run from a terminal (without wish). I have to use 'rsh' because the server is very old (1984) and use a very old operating system which dosn't have SSH capacity. Thanks, Germain | |||
| User Comments: |
anonymous added on 2014-10-20 10:03:07:
$ gdb
(gdb) attach 25676 (PID of wish)
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff67fe000
0x00007fbbe96d62c3 in __select_nocancel () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install tk-8.5.7-5.el6.x86_64
(gdb) bt
#0 0x00007fbbe96d62c3 in __select_nocancel () from /lib64/libc.so.6
#1 0x00007fbbeab26b73 in Tcl_WaitForEvent () from /usr/lib64/libtcl8.5.so
#2 0x00007fbbeaaf22ab in Tcl_DoOneEvent () from /usr/lib64/libtcl8.5.so
#3 0x00007fbbeadac282 in Tk_MainLoop () from /usr/lib64/libtk8.5.so
#4 0x00007fbbeadb9bb7 in Tk_MainEx () from /usr/lib64/libtk8.5.so
#5 0x0000000000400a2c in main ()
(gdb) info thread
* 1 process 25676 0x00007fbbe96d62c3 in __select_nocancel () from /lib64/libc.so.6
(gdb) c
Continuing.
Click on 'TEST' => Detaching after fork from child process 26201.
/
Click on 'TEST' => Detaching after fork from child process 26303.
/
Click on 'TEST' => Detaching after fork from child process 26311.
/
Click on 'TEST' => Detaching after fork from child process 26383.
/
GDB changes signal handling and in this way wish doesn't hang up.
I suppose the problem is in signal handling.
For information, RSH has to fork and use administrator rights to send IP packets from privilege ports (< 1024).
$ gdb
(gdb) attach 26637 (PID of rsh, need to be root)
Attaching to process 26637
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fffa45d4000
0x00007fd7617c9430 in __read_nocancel () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install rsh-0.17-60.el6.x86_64
==> It looks to be a forked process of 'wish'.
(gdb) bt
#0 0x00007fd7617c9430 in __read_nocancel () from /lib64/libc.so.6
#1 0x00007fd7620df284 in ?? ()
#2 0x00007fd7620df7e1 in main ()
(gdb) c
Continuing.
Program received signal SIGTTIN, Stopped (tty input).
0x00007fd7617c9430 in __read_nocancel () from /lib64/libc.so.6
(gdb) c
Continuing.
Program received signal SIGTTIN, Stopped (tty input).
0x00007fd7617c9430 in __read_nocancel () from /lib64/libc.so.6
==> Impossible to continue (loop on this signal)
And now with strace :
$ strace -p 26637 (PID of rsh, need to be root)
read(0, 0x7fffa445ba70, 8192) = ? ERESTARTSYS (To be restarted)
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
read(0, 0x7fffa445ba70, 8192) = ? ERESTARTSYS (To be restarted)
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
read(0, 0x7fffa445ba70, 8192) = ? ERESTARTSYS (To be restarted)
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
read(0, 0x7fffa445ba70, 8192) = ? ERESTARTSYS (To be restarted)
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
etc...
$ strace -p 25676 (PID of wish)
Process 25676 attached - interrupt to quit
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
select(4, [3], [], [], NULL) = 1 (in [3])
[...]
And when a click on 'TEST' :
select(4, [3], [], [], NULL) = ? ERESTARTNOHAND (To be restarted)
--- SIGCHLD (Child exited) @ 0 (0) ---
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
--- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
select(4, [3], [], [], NULL) = 1 (in [3])
[...]
Note :
Each time the 'TEST' button is cliked, 2 processus 'rsh' are created, and have the same backtrace (certainly locked on the fork mecanism).
=> I think the SIGCHLD signal sent when RSH process forked is intercepted somewhere by wish.
And from 'man rsh' :
BUGS
If you are using csh(1) and put a rsh in the background without redirecting its input away from the terminal, it will block even
if no reads are posted by the remote command. If no input is desired you should redirect the input of rsh to /dev/null using the
-n option.
You cannot run an interactive command (like rogue(6) or vi(1)) using rsh; use rlogin(1) instead.
Stop signals stop the local rsh process only; this is arguably wrong, but currently hard to fix for reasons too complicated to
explain here.
Thanks
dgp added on 2014-10-17 15:58:57: I cannot reproduce. I suspect that's at least in part due to differences in rsh operations, which here report refused connections. What command precisely is blocking? Is it the [exec]? Can the failure be drilled down further to a particular line of C code? anonymous added on 2014-10-16 09:18:00: The rsh command gives :
$ rsh -l root 10.129.0.11 pwd
/
The script.sh is :
#!/bin/sh
rsh -l root 10.129.0.11 pwd
So the script gives :
$ chmod u+x ./script.sh
$ ./script.sh
/
This is the TCl script :
#!/usr/bin/wish
button .test -text "TEST" -command "exec_script"
pack .test
proc exec_script {} {
file attributes script.sh -permissions 0754
exec ./script.sh &
}
Launch with :
$ wish ./test.tcl &
When click on 'TEST', the HMI hang.
I bypass the problem using 'nohup' :
set output [exec nohup ./script.sh 1>/dev/null 2>/dev/null]
puts "$output"
dgp added on 2014-10-15 15:56:53: What behavior are you expecting that you are not seeing? "The script works" is not a precise description. Are you just running into the difference that wish always runs an event loop and continues while tclsh exits when it reaches the end of a script? | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki