[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`hanging' pipes and zeroed tty pgroups...



me again :)  i somehow forgot to send this one...

 quoted from dosmem.c, line 707:

>/* release the controlling terminal, if we're a process group leader */
>	fp = curproc->handle[-1];
>	if (fp && is_terminal(fp) && curproc->pgrp == curproc->pid) {
>		struct tty *tty = (struct tty *)fp->devinfo;
>		if (curproc->pgrp == tty->pgrp)
>			tty->pgrp = 0;
			^^^^^^^^^^^^^
 i think this is a bug :-)

 no patch because i'm not sure what exactly to do here (well search for
another process that has the same ctty, but in what order... anyone?)
but you can reproduce the effect when you do something like `sh -c ps |less'
(tried with BSD sh and ksh) and then try to interrupt or stop less with
^C or ^Z.  either nothing happens (running on /dev/fasttext) or you kill
everything (running on toswin)...

 btw i used this to check a ttys pgrp (just redirect its input):

-------cut----
#include <stdio.h>
#include <ioctl.h>

main(argc,argv)
int argc;
char *argv[];
{
	int fd;
	char *f = "stdin";
	long pgrp;

	fd = 0;
	if (!(isatty(fd))) {
		if ((fd = open("U:\\dev\\tty",0)) < 0) {
			perror("can't open tty");
			exit(1);
		}
		f = "/dev/tty";
	}

	if (ioctl(fd,TIOCGPGRP,&pgrp)) {
		perror("can't do ioctl");
		exit(1);
	}

	printf("%s pgrp: %ld\n", f, pgrp);

	exit(0);
}
-----cut----

 (and if your stty still ignores redirected input, just recompile with a
newer mintlib... :-)

 hope it helps,
	Juergen
-- 
J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
								...ohne Gewehr
PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA