From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21124 invoked from network); 6 Sep 2000 15:25:52 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 Sep 2000 15:25:52 -0000 Received: (qmail 27739 invoked by alias); 6 Sep 2000 15:25:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12764 Received: (qmail 27718 invoked from network); 6 Sep 2000 15:25:43 -0000 From: "Bart Schaefer" Message-Id: <1000906152537.ZM22504@candle.brasslantern.com> Date: Wed, 6 Sep 2000 15:25:37 +0000 In-Reply-To: <000601c017ff$bedcbad0$21c9ca95@mow.siemens.ru> Comments: In reply to "Andrej Borsenkow" "When should interactive option be set/.zshrc read?" (Sep 6, 4:41pm) References: <000601c017ff$bedcbad0$21c9ca95@mow.siemens.ru> <200009061249.OAA01000@beta.informatik.hu-berlin.de> <0G0G00B57UDM35@la-la.cambridgesiliconradio.com> <000701c01803$20bcb360$21c9ca95@mow.siemens.ru> <20000906151242.A7778@picard.franken.de> <000801c01805$b10d35f0$21c9ca95@mow.siemens.ru> In-Reply-To: <200009061249.OAA01000@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: When should interactive option be set/.zshrc read?" (Sep 6, 2:49pm) In-Reply-To: <0G0G00B57UDM35@la-la.cambridgesiliconradio.com> Comments: In reply to Peter Stephenson "Re: When should interactive option be set/.zshrc read?" (Sep 6, 1:51pm) In-Reply-To: <000701c01803$20bcb360$21c9ca95@mow.siemens.ru> Comments: In reply to "Andrej Borsenkow" "RE: When should interactive option be set/.zshrc read?" (Sep 6, 5:05pm) In-Reply-To: =?iso-8859-1?Q?=3C20000906151242=2EA7778=40picard=2Efranken?= =?iso-8859-1?Q?=2Ede=3E?= =?iso-8859-1?Q?Comments=3A_In_reply_to_Thomas_K=F6hler_=3Cjean-luc=40pica?= =?iso-8859-1?Q?rd=2Efranken=2Ede=3E?= =?iso-8859-1?Q?________=22Re=3A_When_should_interactive_option_be_set=2F?= =?iso-8859-1?Q?=2Ezshrc_read=3F=22_=28Sep__6=2C__3=3A12pm=29?= In-Reply-To: <000801c01805$b10d35f0$21c9ca95@mow.siemens.ru> Comments: In reply to "Andrej Borsenkow" "RE: When should interactive option be set/.zshrc read?" (Sep 6, 5:23pm) X-Mailer: Z-Mail (5.0.0 30July97) To: "ZSH workers mailing list" Subject: Re: When should interactive option be set/.zshrc read? MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable On Sep 6, 2:49pm, Sven Wischnowsky wrote: } = } > bor@itsrm2% print $options[interactive] } > on <=3D correct } > bor@itsrm2% : | (print $options[interactive]) } > on <=3D ?? I doubt, this shell can be considered "interactive" } = } It's a copy of the interactive shell, a subshell. It doesn't read any } init files whatsoever. } = } Hm, but maybe we should turn off the option in subshells. (And probably= = } other options, too?) On Sep 6, 1:51pm, Peter Stephenson wrote: } } It does unset the options MONITOR and USEZLE, but not INTERACTIVE, for = the } subshell, however. One might have thought that it would either change= all } three or none. In particular, the effect of claiming to be interactive= but } not using ZLE looks a bit weird. The MONITOR option is turned off because it's used internally to decide whether you can background a job and then foreground it again. Although it might be sensible to do (job1 & job2 ; fg) it's not sensible to do (job1 &) ; fg because the background job is not a child of the shell doing the `fg'. Possibly the test for whether bg/fg work should be separate from the test for whether the shell reports a background job's exit status, but it has never been that way. Bash, for example, shows the "monitor" option set if you do `(set -o)', but doesn't track the status of any background jobs. Of course, you can get the equivalent of the first example with (job1 & job2 ; wait) USEZLE is a tad odd. It means you can't do things like (vared foo) I believe the reason for this is that a subshell is also used to run background jobs and jobs in pipelines, neither of which should mess with the terminal settings; it's likely that zsh could differentiate a foreground ( ) from a pipeline or backgrounded command for this purpose, but presently it does not. On Sep 6, 5:05pm, Andrej Borsenkow wrote: } Subject: RE: When should interactive option be set/.zshrc read? } } > It's a copy of the interactive shell, a subshell. It doesn't read any= } > init files whatsoever. } = } Um, really. Which is even worse. What? You've got to be kidding. } By definition, INTERACTIVE is set "if the standard input is a tty and } commands are being read from standard input". That tells how the *startup time* setting of INTERACTIVE is done. It is not intended to mean that the option changes every time you redirect inpu= t. } Well, I am concerned now how to prevent all definitions from .zshrc to } be used in subshell. If you think about this for even a few minutes, you'll realize that all sorts of things would break if subshells behaved like "zsh -f". zagzig[339] bash [schaefer@zagzig]$ alias ls=3D'echo foo' [schaefer@zagzig]$ (ls) foo [schaefer@zagzig]$ function echo () { /bin/echo bar "$@" } [schaefer@zagzig]$ (ls) bar foo [schaefer@zagzig]$ tcsh [schaefer@candle]$ alias ls 'echo foo' [schaefer@candle]$ (ls) foo [schaefer@candle]$ exit [schaefer@candle]$ (sleep 30 & sleep 3; fg) [1] 22485 No job control in subshells. [schaefer@zagzig]$ (sleep 30 & sleep 3; fg) fg: no job control [schaefer@zagzig]$ exit (Ignore the silly way that tcsh gets the hostname; "zagzig" and "candle" are host-aliases for the same machine.) On Sep 6, 3:12pm, Thomas K=F6hler wrote: } } Andrej Borsenkow wrote: } > = } [...] } > I definitely do not want that (ls foo| ...) use my alias for ls; and } > I do not want window title be mangled. Any idea? Is it possible to } > provide "clean sandbox" for subshells? } = } zsh -f More completely, zsh -fc 'ls foo|...' On Sep 6, 5:23pm, Andrej Borsenkow wrote: } } Here is what SUS V2 says: } = } A subshell environment will be created as a duplicate of the shell } environment, except that signal traps set by that shell environment } will be set to the default values. Yup. Incidentally, as to your specific problem with chpwd(), why not set the window title in precmd() instead? -- = Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net = =