2002-09-24 08:53:35

by Ingo Molnar

[permalink] [raw]
Subject: [patch] pgrp-fix-2.5.38-A2


the attached patch, against BK-curr, fixes the emacs bug reported by
Andries. It should probably also fix other, terminal handling related
weirdnesses introduced by the new PID handling code in 2.5.38.

the bug was in the session_of_pgrp() function, if no proper session is
found in the process group then we must take the session ID from the
process that has pgrp PID (which does not necesserily have to be part of
the pgrp). The fallback code is only triggered when no process in the
process group has a valid session - besides being faster, this also
matches the old implementation.

[ hey, who needs a POSIX conformance testsuite when we have emacs! ;) ]

Ingo

--- linux/kernel/exit.c.orig Tue Sep 24 10:29:09 2002
+++ linux/kernel/exit.c Tue Sep 24 10:58:40 2002
@@ -131,9 +131,14 @@
for_each_task_pid(pgrp, PIDTYPE_PGID, p, l, pid)
if (p->session > 0) {
sid = p->session;
- break;
+ goto out;
}
+ p = find_task_by_pid(pgrp);
+ if (p)
+ sid = p->session;
+out:
read_unlock(&tasklist_lock);
+
return sid;
}



2002-09-24 09:46:10

by William Lee Irwin III

[permalink] [raw]
Subject: Re: [patch] pgrp-fix-2.5.38-A2

On Tue, Sep 24, 2002 at 11:06:51AM +0200, Ingo Molnar wrote:
> the attached patch, against BK-curr, fixes the emacs bug reported by
> Andries. It should probably also fix other, terminal handling related
> the bug was in the session_of_pgrp() function, if no proper session is
> found in the process group then we must take the session ID from the
> process that has pgrp PID (which does not necesserily have to be part of
> the pgrp). The fallback code is only triggered when no process in the
> process group has a valid session - besides being faster, this also
> matches the old implementation.
> [ hey, who needs a POSIX conformance testsuite when we have emacs! ;) ]
> Ingo

Fix verified here. aeb's testcase now succeeds.


Cheers,
Bill