1.7: Job control failing in rxvt + bash (can suspend, but fg/bg fail)
Ali Soleimani
alis@ku.edu
Sun Jul 26 14:10:00 GMT 2009
I'm having problems with the job control inside the Windows-native
rxvt: I can suspend jobs fine. But when I attempt to foreground them
via "fg" or "%1", the shell reports the name of the job (e.g. "vim
.inputrc") and then just gives me another shell prompt. After this
point, the job no longer appears in the output of 'jobs', nor can it
be foregrounded, etc. However the job's process is still running and
(in the cases of vim or emacs) in a sleeping state. It cannot (in the
cases of vim or emacs) be killed normally, but only with a kill -9.
This issue only appears in certain circumstances: only when I'm
running inside cygwin's Windows-native rxvt window, and only when I'm
running the bash shell. There's no problem when using the tcsh shell
in a native rxvt, and no problem when using bash in a Windows
terminal. But the combination of native rxvt+bash seems to break job
control.
I did some further testing using a simple perl script which
continually output the time to a file. When I ran it, stopped it, and
attempted to resume it in the foreground, bash again failed to
actually foreground the process. Bash also lost track of the job.
But it did get the script to continue executing; and the script could
be killed with a normal kill (SIGTERM.)
When I ran the script, stopped it, and attempted to resume it in
the background, the behavior was even more odd. The stop worked fine,
as before, and running "bg" did cause the script to begin executing in
the background. But when I ran ps, bash then reported "Unkown status:
core dumped" and lost track of the job, even though the process
continued running with no problem. (It could again be killed with a
normal SIGTERM.)
I've included a text file with shell transcripts showing this
behavior, and cygcheck output. Anyone know the cause?
Thanks,
Ali
-----------------
Versions:
Windows Vista 64-bit (x86_64) SP1
CYGWIN 1.7 Beta
cygwin: 1.7.0-52
bash: 3.2.49-23
rxvt: 20050409-21 (Rxvt v2.7.10 - released: 26 MARCH 2003)
------------------
--
Although this may seem a paradox, all exact science is dominated by
the idea of approximation.
-Bertrand Russell (1872-1970)
-------------- next part --------------
############# Foregrounding a script ##############
Ali@DELMAR ~
$ ./monitor.pl
[1]+ Stopped ./monitor.pl
Ali@DELMAR ~
$ cat monitor.out
Loop #1 at 19:32:35
Loop #2 at 19:32:36
Loop #3 at 19:32:37
Ali@DELMAR ~
$ ps
PID PPID PGID WINPID TTY UID STIME COMMAND
1856 1 1856 1856 con 1000 18:48:21 /usr/bin/rxvt
2648 1856 2648 3232 0 1000 18:48:21 /usr/bin/bash
S 3092 2648 3092 3592 0 1000 19:32:35 /usr/bin/perl
2604 2648 2604 360 0 1000 19:32:44 /usr/bin/ps
Ali@DELMAR ~
$ cat monitor.out
Loop #1 at 19:32:35
Loop #2 at 19:32:36
Loop #3 at 19:32:37
Ali@DELMAR ~
$ fg
./monitor.pl
Ali@DELMAR ~
$ ps
PID PPID PGID WINPID TTY UID STIME COMMAND
1856 1 1856 1856 con 1000 18:48:21 /usr/bin/rxvt
2648 1856 2648 3232 0 1000 18:48:21 /usr/bin/bash
3092 2648 3092 3592 0 1000 19:32:35 /usr/bin/perl
584 2648 584 1992 0 1000 19:33:02 /usr/bin/ps
Ali@DELMAR ~
$ cat monitor.out
Loop #1 at 19:32:35
Loop #2 at 19:32:36
Loop #3 at 19:32:37
Loop #4 at 19:33:1
Loop #5 at 19:33:2
Loop #6 at 19:33:3
Loop #7 at 19:33:4
Loop #8 at 19:33:5
Loop #9 at 19:33:6
Loop #10 at 19:33:7
Loop #11 at 19:33:8
Loop #12 at 19:33:9
Ali@DELMAR ~
$ kill %1
bash: kill: %1: no such job
Ali@DELMAR ~
$ jobs
Ali@DELMAR ~
$ kill 3092
Ali@DELMAR ~
$ ps
PID PPID PGID WINPID TTY UID STIME COMMAND
1856 1 1856 1856 con 1000 18:48:21 /usr/bin/rxvt
2648 1856 2648 3232 0 1000 18:48:21 /usr/bin/bash
2284 2648 2284 2368 0 1000 19:33:26 /usr/bin/ps
######################################################################
########### Backgrounding a script ##############
Ali@DELMAR ~
$ ./monitor.pl
[1]+ Stopped ./monitor.pl
Ali@DELMAR ~
$ cat monitor.out
Loop #1 at 19:18:9
Loop #2 at 19:18:11
Loop #3 at 19:18:12
Loop #4 at 19:18:13
Ali@DELMAR ~
$ cat monitor.out
Loop #1 at 19:18:9
Loop #2 at 19:18:11
Loop #3 at 19:18:12
Loop #4 at 19:18:13
Ali@DELMAR ~
$ bg
[1]+ ./monitor.pl &
Ali@DELMAR ~
$
Ali@DELMAR ~
$
Ali@DELMAR ~
$ ps
PID PPID PGID WINPID TTY UID STIME COMMAND
1856 1 1856 1856 con 1000 18:48:21 /usr/bin/rxvt
2648 1856 2648 3232 0 1000 18:48:21 /usr/bin/bash
2248 2648 2248 2964 0 1000 19:18:09 /usr/bin/perl
1992 2648 1992 3624 0 1000 19:18:25 /usr/bin/ps
[1]+ Unknown status (core dumped) ./monitor.pl
Ali@DELMAR ~
$ cat monitor.out
Loop #1 at 19:18:9
Loop #2 at 19:18:11
Loop #3 at 19:18:12
Loop #4 at 19:18:13
Loop #5 at 19:18:23
Loop #6 at 19:18:24
Loop #7 at 19:18:25
Loop #8 at 19:18:26
Loop #9 at 19:18:27
Loop #10 at 19:18:28
Ali@DELMAR ~
$ cat monitor.out
Loop #1 at 19:18:9
Loop #2 at 19:18:11
Loop #3 at 19:18:12
Loop #4 at 19:18:13
Loop #5 at 19:18:23
Loop #6 at 19:18:24
Loop #7 at 19:18:25
Loop #8 at 19:18:26
Loop #9 at 19:18:27
Loop #10 at 19:18:28
Loop #11 at 19:18:29
Loop #12 at 19:18:30
Ali@DELMAR ~
$ kill %1
bash: kill: %1: no such job
Ali@DELMAR ~
$ kill 2248
Ali@DELMAR ~
$ ps
PID PPID PGID WINPID TTY UID STIME COMMAND
1856 1 1856 1856 con 1000 18:48:21 /usr/bin/rxvt
2648 1856 2648 3232 0 1000 18:48:21 /usr/bin/bash
2180 2648 2180 1564 0 1000 19:30:21 /usr/bin/ps
######################################################################
########### The script I used ##############
Ali@DELMAR ~
$ cat monitor.pl
#!/usr/bin/perl
$outfile = "monitor.out";
open OUTFILE,">$outfile" or die "Can't open output file!";
select(OUTFILE);
$|=1;
$i=0;
while(1) {
$i++;
@curtime=localtime;
print OUTFILE "Loop #$i at $curtime[2]:$curtime[1]:$curtime[0]\n";
sleep 1;
}
close OUTFILE;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 144211 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090726/2549d41e/attachment.obj>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list