Date: Sat, 28 Jun 2003 18:12:39 +0200 From: "Karl M. Joch" <k.joch@kmjeuro.com> To: arno@heho.snv.jussieu.fr Cc: freebsd-current@freebsd.org Subject: Re: 5.1 on a production box with some small problems (su, linux emu 7) Message-ID: <3EFDBE77.1070303@kmjeuro.com> In-Reply-To: <wpof0ifpac.fsf@heho.snv.jussieu.fr> References: <3EFCC896.7050104@kmjeuro.com> <wpof0ifpac.fsf@heho.snv.jussieu.fr>
next in thread | previous in thread | raw e-mail | index | archive | help
arno,
thanks. i already found that patch posted somewhere on
people.freebsd.org. but it hasnt helped. but thanks anyway.
i had that :
--- su.c.orig Sat Jun 28 17:52:21 2003
+++ su.c Sat Jun 28 17:57:13 2003
@@ -359,6 +359,8 @@
child_pid = fork();
switch (child_pid) {
default:
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGTTOU, &sa, NULL);
close(fds[0]);
setpgid(child_pid, child_pid);
tcsetpgrp(1, child_pid);
@@ -366,7 +368,9 @@
sigaction(SIGPIPE, &sa_pipe, NULL);
while ((pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) {
if (WIFSTOPPED(statusp)) {
- kill(getpid(), SIGSTOP);
+ if (WSTOPSIG(statusp) != SIGTTOU &&
+ WSTOPSIG(statusp) != SIGTTIN)
+ kill(getpid(), SIGSTOP);
child_pgrp = getpgid(child_pid);
tcsetpgrp(1, child_pgrp);
kill(child_pid, SIGCONT);
arno@heho.snv.jussieu.fr wrote:
> Karl,
>
>
>>i run 5.1 on one of the inhouse production boxes successful. there are
>>only 2 small points witch are a pain and i found no solution. box was
>>fresh setup with 5.0 then cvsuped to 5.1.
>>
>>1. when starting some scripts su doesnt return from the shell and
>>hangs on boot. when starting manually i get "tty output stopped". with
>>exit there is a way out of this shell, but i havnt found a
>>solution. most of the scripts runs since 3.x, at least 4.x and was
>>working up to 4.8. one of this scripts is the pervasive sql server
>>startup script which is part of the pervasive server for linux. using
>>#!/compat/linux/bin/sh doesnt help. there are 2 lines in it starting
>>sqlmgr and psql with:
>>echo "commands...." | /bin/su - psql || exit 1
>>after the 1st one tty output is stopped. the other script is vmware
>>and vncserver related and uses linux emu too.
>
>
> I had a similar problem, which has been solved by the following
> patch posted by David Xu (not white-space clean), you might
> give it a try.
>
> Arno
>
> #####
> Index: usr.bin/su/su.c
> ===================================================================
> RCS file: /home/ncvs/src/usr.bin/su/su.c,v
> retrieving revision 1.68
> diff -c -r1.68 su.c
> *** usr.bin/su/su.c 8 Apr 2003 16:59:53 -0000 1.68
> --- usr.bin/su/su.c 28 Jun 2003 10:33:17 -0000
> ***************
> *** 359,364 ****
> --- 359,366 ----
> child_pid = fork();
> switch (child_pid) {
> default:
> + sa.sa_handler = SIG_IGN;
> + sigaction(SIGTTOU, &sa, NULL);
> close(fds[0]);
> setpgid(child_pid, child_pid);
> tcsetpgrp(1, child_pid);
> ***************
> *** 366,372 ****
> sigaction(SIGPIPE, &sa_pipe, NULL);
> while ((pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) {
> if (WIFSTOPPED(statusp)) {
> ! kill(getpid(), SIGSTOP);
> child_pgrp = getpgid(child_pid);
> tcsetpgrp(1, child_pgrp);
> kill(child_pid, SIGCONT);
> --- 368,376 ----
> sigaction(SIGPIPE, &sa_pipe, NULL);
> while ((pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) {
> if (WIFSTOPPED(statusp)) {
> ! if (WSTOPSIG(statusp) != SIGTTOU &&
> ! WSTOPSIG(statusp) != SIGTTIN)
> ! kill(getpid(), SIGSTOP);
> child_pgrp = getpgid(child_pid);
> tcsetpgrp(1, child_pgrp);
> kill(child_pid, SIGCONT);
--
Best regards / Mit freundlichen Gruessen,
Karl M. Joch
k.joch@ctseuro.com
http://www.ctseuro.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EFDBE77.1070303>
