From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1519 invoked by alias); 10 Feb 2011 23:19:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28733 Received: (qmail 13004 invoked from network); 10 Feb 2011 23:19:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at klanderman.net does not designate permitted sender hosts) From: Greg Klanderman To: zsh-workers@zsh.org Subject: Re: loading user startup files for zsh scripts Reply-To: gak@klanderman.net References: <19792.22365.139876.599478@gargle.gargle.HOWL> <110207213357.ZM22407@torch.brasslantern.com> <20110208172056.6a985c90@pwslap01u.europe.root.pri> <110208205856.ZM24066@torch.brasslantern.com> <110209085358.ZM29014@torch.brasslantern.com> <110210095253.ZM30860@torch.brasslantern.com> Date: Thu, 10 Feb 2011 18:10:33 -0500 In-Reply-To: <110210095253.ZM30860@torch.brasslantern.com> (Bart Schaefer's message of "Thu, 10 Feb 2011 09:52:52 -0800") Message-ID: User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.17 (linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >>>>> On February 10, 2011 Bart Schaefer wrote: > Hmm. Yeah, I tried examining things like $funcfiletrace etc. and they > don't provide any additional information. Thanks for really digging Bart! > I can suggest a draconian solution: make update more than a suggestion. Sadly, draconian solutions are just not acceptable short of needing to patch a security vulnerability. :-) > Change your shared file to have it require that $0 be passed as an > argument, e.g. > source /the/shared/zshenv $0 > This shows up as $1 in your shared file. Have the file do NOTHING if > there is no $1, otherwise test $1 against $ZSH_NAME, etc. Maybe if > the shell is interactive, print a warning. Now that's actually got me thinking of a less draconian variant which I like; if $0 is passed in (as $1) then I can DTRT, otherwise (if they have not updated ~/.zshenv), if not a login or interactive shell then do nothing. They only lose the benefit of the shared file in the case that's ambiguous and which also happens to be the case which probably almost nobody is actually taking advantage of. On a related note, would you be opposed to adding some way to find out definitively whether you're running as a script from within zsh? Would adding a new parameter be best? Can you suggest a name? Is runscript != NULL in zsh_main() the right condition to use? Or maybe just set some parameter to the value of runscript when set? thanks! Greg