From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22418 invoked from network); 28 Jul 2004 23:38:30 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Jul 2004 23:38:30 -0000 Received: (qmail 16292 invoked from network); 28 Jul 2004 23:38:23 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Jul 2004 23:38:23 -0000 Received: (qmail 7510 invoked by alias); 28 Jul 2004 23:26:14 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20217 Received: (qmail 7495 invoked from network); 28 Jul 2004 23:26:14 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 28 Jul 2004 23:26:14 -0000 Received: (qmail 89153 invoked from network); 28 Jul 2004 23:25:00 -0000 Received: from tantale.fifi.org (216.27.190.146) by a.mx.sunsite.dk with SMTP; 28 Jul 2004 23:24:58 -0000 Received: from ceramic.fifi.org (mail@ceramic.fifi.org [216.27.190.147]) by tantale.fifi.org (8.9.3p2/8.9.3/Debian 8.9.3-21) with ESMTP id QAA15374; Wed, 28 Jul 2004 16:24:54 -0700 Received: from phil by ceramic.fifi.org with local (Exim 4.22) id 1Bpxn4-0003hv-4f; Wed, 28 Jul 2004 16:24:54 -0700 To: Clint Adams Cc: zsh-workers@sunsite.dk, 205685-forwarded@bugs.debian.org Subject: Re: [vincent@vinc17.org: Re: Bug#205685: clone corruption] References: <20040720181612.GA18242@scowler.net> <87658ifrga.fsf@ceramic.fifi.org> <20040728155035.GA17226@scowler.net> Mail-Copies-To: nobody From: Philippe Troin Date: 28 Jul 2004 16:24:54 -0700 In-Reply-To: <20040728155035.GA17226@scowler.net> Message-ID: <87isc767g9.fsf@ceramic.fifi.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: Philippe Troin X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.9 required=6.0 tests=BAYES_30 autolearn=no version=2.63 X-Spam-Hits: -0.9 Clint Adams writes: > > The only way to use clone is to start it on an unused terminal, > > Is this wording accurate? > > Index: Doc/Zsh/mod_clone.yo > =================================================================== > RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_clone.yo,v > retrieving revision 1.1.1.8 > diff -u -r1.1.1.8 mod_clone.yo > --- Doc/Zsh/mod_clone.yo 20 Dec 1999 11:24:39 -0000 1.1.1.8 > +++ Doc/Zsh/mod_clone.yo 28 Jul 2004 15:49:42 -0000 > @@ -16,5 +16,10 @@ > > The return value of the builtin is zero in both shells if successful, > and non-zero on error. > + > +The target of tt(clone) should be an unused terminal, such as an unused virtual > +console or a virtual terminal created by > + > +xterm -e sh -c 'trap : INT QUIT TSTP; tty; while :; do sleep 100000000; done' Some words of explanation are warranted about this long xterm command line: when doing clone on a pseudo-terminal, some other session ("session" meant as a unix session group, or SID) is already owning the terminal. Hence the cloned zsh cannot acquire the pseudo-terminal as a controlling tty. That means two things: - the job control signals will go to the sh-started-by-xterm process group (that's why we disable INT QUIT and TSTP with trap; otherwise the while loop could get suspended or killed) - the cloned shell will have job control disabled, and the job control keys (control-C, control-\ and control-Z) will not work. This does not apply when cloning to an *unused* vc. Cloning to an used (and unprepared) terminal will result in two processes reading simultaneously from the same terminal, with input bytes going randomly to either process. Clone is mostly useful as a shell built-in replacement for openvt. Hope that explains clone better. Phil.