From owner-freebsd-current@FreeBSD.ORG Sat Jun 28 09:12:50 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D080537B401 for ; Sat, 28 Jun 2003 09:12:50 -0700 (PDT) Received: from sv07e.atm-tzs.kmjeuro.com (sv07e.atm-tzs.kmjeuro.com [193.81.94.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C81B43FE5 for ; Sat, 28 Jun 2003 09:12:49 -0700 (PDT) (envelope-from k.joch@kmjeuro.com) Received: from kmjeuro.com (adsl.sbg.kmjeuro.com [62.99.198.46]) (authenticated bits=0)h5SGCeva032459; Sat, 28 Jun 2003 18:12:41 +0200 (CEST) (envelope-from k.joch@kmjeuro.com) Message-ID: <3EFDBE77.1070303@kmjeuro.com> Date: Sat, 28 Jun 2003 18:12:39 +0200 From: "Karl M. Joch" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: arno@heho.snv.jussieu.fr References: <3EFCC896.7050104@kmjeuro.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-MailScanner: Mail Server protected by CTS Austria www.ctseuro.com Message found to be clean cc: freebsd-current@freebsd.org Subject: Re: 5.1 on a production box with some small problems (su, linux emu 7) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jun 2003 16:12:51 -0000 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