From owner-freebsd-bugs@FreeBSD.ORG Tue Jun 3 04:10:10 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D17C37B401 for ; Tue, 3 Jun 2003 04:10:10 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA3D743FBD for ; Tue, 3 Jun 2003 04:10:09 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h53BA9Up018201 for ; Tue, 3 Jun 2003 04:10:09 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h53BA9P8018200; Tue, 3 Jun 2003 04:10:09 -0700 (PDT) Date: Tue, 3 Jun 2003 04:10:09 -0700 (PDT) Message-Id: <200306031110.h53BA9P8018200@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: David Malone Subject: Re: bin/52746: tcsh fails to handle large arguements X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: David Malone List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jun 2003 11:10:10 -0000 The following reply was made to PR bin/52746; it has been noted by GNATS. From: David Malone To: freebsd-gnats-submit@FreeBSD.org, marka@isc.org Cc: Subject: Re: bin/52746: tcsh fails to handle large arguements Date: Tue, 03 Jun 2003 12:04:10 +0100 OK - I believe I understand the bug now. It looks like a tcsh bug on platforms that have a real version of vfork. Here's what's happening: % /bin/echo `perl -e 'print "A"x1000000'` 1) tcsh vforks to produce what is intended to become /bin/echo, I'll call this tcsh-echo. The original tcsh goes to sleep until the vfork is done. 2) tcsh-echo forks, execs perl, adds perl to it's list of helper processes. Because tcsh-echo is vforked, the original tcsh can see this extra process in its process list. 3) tcsh-echo calls stderror when too many "A"s show up, and stderr calls xexit. ktrace shows tcsh-echo exiting before perl gets its SIGPIPE, so the perl is never reaped and remains in the firends list for tcsh-echo. 4) tcsh resumes execution now that tcsh-echo has finished running in vforked space. It starts waiting for tcsh-echo and its friends to finish, but perl is stuck on the list. So, a workaround is to disable the use of vfork 'cos the child then ends up with its own address space and the perl never makes it into the original tcsh's list of processes to wait for. I've included some debugging output below, as it may be of use to the tcsh people. I'll try and raise the issue with tcsh-bugs@mx.gw.com David. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -echo tcsh RET read 4096/0x1000 -echo tcsh CALL write(0x2,0x8149b20,0xf) -echo tcsh GIO fd 2 wrote 15 bytes "Word too long. " -echo tcsh RET write 15/0xf -echo tcsh CALL exit(0x1) perl perl GIO fd 1 wrote 4096 bytes "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ . . . AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" perl perl RET write 16384/0x4000 perl perl CALL write(0x1,0x8108000,0x4000) perl perl RET write -1 errno 32 Broken pipe perl perl PSIG SIGPIPE SIG_DFL parent tcsh RET vfork -echo/0x1240e % /bin/echo `perl -e 'print "A"x1000000'` wanttty 75514 pid 75521 opgrp75521 pgrp 75514 tpgrp 75514 wanttty 75514 pid 75521 pgrp 75521 tpgrp 75521 wanttty -1 pid 75522 opgrp75522 pgrp 75521 tpgrp 75521 wanttty -1 pid 75522 pgrp 75521 tpgrp 75521 Word too long. jobflags=0 jobflags for 75522 is 10101 jobflags for 75521 is 8 75514 starting to sigpause for SIGCHLD on 75522