Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jun 2003 04:10:09 -0700 (PDT)
From:      David Malone <dwmalone@maths.tcd.ie>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/52746: tcsh fails to handle large arguements
Message-ID:  <200306031110.h53BA9P8018200@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/52746; it has been noted by GNATS.

From: David Malone <dwmalone@maths.tcd.ie>
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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306031110.h53BA9P8018200>