truss calls setpgid()

2010-10-11 Thread Ed Schouten
Hi all,

I've been seeing this bug for a very long time, but I was too lazy to
figure out the root cause earlier. It is TTY related, but in this case
the TTY layer is not to blame. It does things correctly.

When you run a command in truss which calls ioctls on TTYs, it just
locks up. This is because truss runs jobs in a separate process group.
This also means you cannot send signals to it:

truss sleep 1

Pressing ^C here won't work.

I've fixed it locally like this:

Index: usr.bin/truss/setup.c
===
--- usr.bin/truss/setup.c   (revision 213113)
+++ usr.bin/truss/setup.c   (working copy)
@@ -78,7 +78,6 @@
}
if (pid == 0) { /* Child */
ptrace(PT_TRACE_ME, 0, 0, 0);
-   setpgid (0, 0); 
execvp(command[0], command);
err(1, execvp %s, command[0]);

Question: was this intentional? I'd rather not break stuff.

Greetings,
-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpgLNWsANUMZ.pgp
Description: PGP signature


Re: truss calls setpgid()

2010-10-11 Thread John Baldwin
On Monday, October 11, 2010 9:17:19 am Ed Schouten wrote:
 Hi all,
 
 I've been seeing this bug for a very long time, but I was too lazy to
 figure out the root cause earlier. It is TTY related, but in this case
 the TTY layer is not to blame. It does things correctly.
 
 When you run a command in truss which calls ioctls on TTYs, it just
 locks up. This is because truss runs jobs in a separate process group.
 This also means you cannot send signals to it:
 
   truss sleep 1
 
 Pressing ^C here won't work.
 
 I've fixed it locally like this:
 
 Index: usr.bin/truss/setup.c
 ===
 --- usr.bin/truss/setup.c   (revision 213113)
 +++ usr.bin/truss/setup.c   (working copy)
 @@ -78,7 +78,6 @@
 }
 if (pid == 0) { /* Child */
 ptrace(PT_TRACE_ME, 0, 0, 0);
 -   setpgid (0, 0); 
 execvp(command[0], command);
 err(1, execvp %s, command[0]);
 
 Question: was this intentional? I'd rather not break stuff.

It was added in the switch from procfs to ptrace(), but it's not clear why the 
child has a new process group.  It doesn't look like truss ever tries to kill 
the entire group for example.

-- 
John Baldwin
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org