Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: newuser loaded for scripts



Frank's fix seems to prevent scripts from sourcing ~/.zshenv.  (I
think it's odd that none of the regression tests detected this.

Here's how I fixed this:

--- ChangeLog~	2006-09-29 10:51:55.000000000 -0400
+++ ChangeLog	2006-09-29 13:43:41.803926416 -0400
@@ -1,3 +1,7 @@
+2006-09-29  Vin Shelton  <acs@xxxxxxxxxx>
+
+	* Src/init.c: Source zshenv even if non-interactive.
+
2006-09-28  Peter Stephenson  <pws@xxxxxxx>

	* 22783: Frank Terbeck: Src/init.c: don't load zsh/newuser
--- ../zsh-2006-09-28/Src/init.c	2006-09-28 07:30:58.000000000 -0400
+++ Src/init.c	2006-09-29 13:37:40.252890528 -0400
@@ -958,15 +958,17 @@
	source(GLOBAL_ZSHENV);
#endif

-	if (isset(RCS) && isset(INTERACTIVE) && unset(PRIVILEGED))
+	if (isset(RCS) && unset(PRIVILEGED))
	{
-	    /*
-	     * Always attempt to load the newuser module to perform
-	     * checks for new zsh users.  Don't care if we can't load it.
-	     */
-	    if (load_module_silence("zsh/newuser", 1)) {
-		/* Unload it immediately. */
-		unload_named_module("zsh/newuser", "zsh", 1);
+	    if (isset(INTERACTIVE)) {
+		/*
+		 * Always attempt to load the newuser module to perform
+		 * checks for new zsh users.  Don't care if we can't load it.
+		 */
+		if (load_module_silence("zsh/newuser", 1)) {
+		    /* Unload it immediately. */
+		    unload_named_module("zsh/newuser", "zsh", 1);
+		}
	    }

	    sourcehome(".zshenv");

 - Vin

On 9/28/06, Peter Stephenson <pws@xxxxxxx> wrote:
Frank Terbeck wrote:
> Hi workers!
>
> Somebody who doesn't use zsh wondered, why the shell wants to
> configure itself, just because he wants to run a script that is
> written in zsh.
>
> Only loading the newuser module if the shell is interactive (which
> should be enough) would fix this. I'm not too familiar with the zsh
> code, but the change should be trivial.

The module's script is supposed to check if it should really be running
later on, keeping the tests here short, but this is a perfectly
reasonable restriction, so I'll add it.  Thanks.

--
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



--
Whoever you are, no matter how lonely,
the world offers itself to your imagination,
calls to you like the wild geese, harsh and exciting--
over and over announcing your place
in the family of things.			Mary Oliver



Messages sorted by: Reverse Date, Date, Thread, Author