From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21869 invoked from network); 23 Jun 2008 15:24:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Jun 2008 15:24:48 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 1089 invoked from network); 23 Jun 2008 15:24:44 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Jun 2008 15:24:44 -0000 Received: (qmail 3346 invoked by alias); 23 Jun 2008 15:24:40 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25238 Received: (qmail 3329 invoked from network); 23 Jun 2008 15:24:39 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 23 Jun 2008 15:24:39 -0000 Received: from mail.o2.co.uk (vader.london.02.net [82.132.130.150]) by bifrost.dotsrc.org (Postfix) with ESMTP id E1A3F80524FD for ; Mon, 23 Jun 2008 17:24:32 +0200 (CEST) Received: from sc.homeunix.net (78.105.216.138) by mail.o2.co.uk (8.0.013.3) (authenticated as stephane.chazelas) id 4851DD9501EF73F1 for zsh-workers@sunsite.dk; Mon, 23 Jun 2008 16:24:32 +0100 Received: from chazelas by sc.homeunix.net with local (Exim 4.69) (envelope-from ) id 1KAnuB-00080M-Fg for zsh-workers@sunsite.dk; Mon, 23 Jun 2008 16:24:31 +0100 Date: Mon, 23 Jun 2008 16:24:31 +0100 From: Stephane Chazelas To: zsh-workers@sunsite.dk Subject: Re: environment settings Message-ID: <20080623152431.GM4961@sc.homeunix.net> Mail-Followup-To: zsh-workers@sunsite.dk References: <20080616074651.GB26165@marcus> <20080616080556.GA5091@sc.homeunix.net> <20080616123045.GC26165@marcus> <20080616124450.GC5091@sc.homeunix.net> <20080621062649.GA28022@blorf.net> <20080621113659.GA20796@prunille.vinc17.org> <20080621123049.GA7027@sc.homeunix.net> <20080622084152.GQ10734@prunille.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20080622084152.GQ10734@prunille.vinc17.org> User-Agent: Mutt/1.5.16 (2007-09-19) X-Virus-Scanned: ClamAV 0.92.1/7541/Mon Jun 23 16:21:03 2008 on bifrost X-Virus-Status: Clean On Sun, Jun 22, 2008 at 10:41:52AM +0200, Vincent Lefevre wrote: > On 2008-06-21 13:30:50 +0100, Stephane Chazelas wrote: > > The program to debug (here env) is run through $SHELL which > > sources ~/.zshenv which overrides the setting of the A variable. > > (PATH in Wayne's case). > > > > It's not gdb's fault and there's nothing it can do about it. > > OK, it is explained in the manual that argument building is done by > gdb, using $SHELL: > > The _arguments._ > Specify the arguments to give your program as the arguments of the > `run' command. If a shell is available on your target, the shell > is used to pass the arguments, so that you may use normal > conventions (such as wildcard expansion or variable substitution) > in describing the arguments. In Unix systems, you can control > which shell is used with the `SHELL' environment variable. *Note > Your Program's Arguments: Arguments. > > So, this is even worse. For instance, if the user changes the way > arguments are built (e.g. I use "setopt EXTENDED_GLOB" in my .zshrc), > such options should actually be in the .zshenv to get the same > behavior! [...] Note that $SHELL is called for that purpose in a number of places such as vi's :!, ftp's !, ssh host 'cmd line'... not only gdb. It's true it would be nice to be able to distinguish between zsh instances that are meant to be user shells that is that are meant to parse command lines given by the user and instances that are meant to run canonical zsh code where the user is not meant to alter the zsh behavior (as in zsh scripts, zsh -c ...) csh solves that with the -f option without which every csh instance is sourcing .cshrc (so csh scripts have #! /bin/csh -f). With zsh, you could solve that by having $SHELL be /path/to/user-zsh, user-zsh being a link to zsh and ~/.zshenv having something like: [[ $0 != (*/|)user-zsh || -o interactive ]] || . "${ZDOTDIR:-$HOME}/.zshrc" (not tested but you get the idea). -- Stéphane