zsh-workers
 help / color / mirror / code / Atom feed
* newuser loaded for scripts
@ 2006-09-27 20:33 Frank Terbeck
  2006-09-28  9:41 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Terbeck @ 2006-09-27 20:33 UTC (permalink / raw)
  To: zsh workers

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.

Regards, Frank

--- Src/init.c.orig	2006-09-27 21:57:15.000000000 +0200
+++ Src/init.c	2006-09-27 21:57:39.000000000 +0200
@@ -958,7 +958,7 @@
 	source(GLOBAL_ZSHENV);
 #endif
 
-	if (isset(RCS) && unset(PRIVILEGED))
+	if (isset(RCS) && isset(INTERACTIVE) && unset(PRIVILEGED))
 	{
 	    /*
 	     * Always attempt to load the newuser module to perform


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: newuser loaded for scripts
  2006-09-27 20:33 newuser loaded for scripts Frank Terbeck
@ 2006-09-28  9:41 ` Peter Stephenson
  2006-09-29 17:56   ` Vin Shelton
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2006-09-28  9:41 UTC (permalink / raw)
  To: zsh workers

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@csr.com>                  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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: newuser loaded for scripts
  2006-09-28  9:41 ` Peter Stephenson
@ 2006-09-29 17:56   ` Vin Shelton
  2006-09-29 20:46     ` Peter Stephenson
  2006-09-29 22:10     ` Frank Terbeck
  0 siblings, 2 replies; 5+ messages in thread
From: Vin Shelton @ 2006-09-29 17:56 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh workers

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@xemacs.org>
+
+	* Src/init.c: Source zshenv even if non-interactive.
+
 2006-09-28  Peter Stephenson  <pws@csr.com>

 	* 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@csr.com> 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@csr.com>                  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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: newuser loaded for scripts
  2006-09-29 17:56   ` Vin Shelton
@ 2006-09-29 20:46     ` Peter Stephenson
  2006-09-29 22:10     ` Frank Terbeck
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2006-09-29 20:46 UTC (permalink / raw)
  To: zsh workers

On Fri, 29 Sep 2006 13:56:57 -0400
"Vin Shelton" <acs@alumni.princeton.edu> wrote:
> Frank's fix seems to prevent scripts from sourcing ~/.zshenv.

*@!@*!!.  Sorry, I didn't look hard enough.  I even noticed that emacs
wasn't setting up my shell functions any more.  I've committed this.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: newuser loaded for scripts
  2006-09-29 17:56   ` Vin Shelton
  2006-09-29 20:46     ` Peter Stephenson
@ 2006-09-29 22:10     ` Frank Terbeck
  1 sibling, 0 replies; 5+ messages in thread
From: Frank Terbeck @ 2006-09-29 22:10 UTC (permalink / raw)
  To: zsh workers

Vin Shelton <acs@alumni.princeton.edu>:
> Frank's fix seems to prevent scripts from sourcing ~/.zshenv.  (I
> think it's odd that none of the regression tests detected this.
[...]

Args! Crap, I'm able to trash even the simplest patches. :-)

Regards, Frank


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-09-29 22:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-27 20:33 newuser loaded for scripts Frank Terbeck
2006-09-28  9:41 ` Peter Stephenson
2006-09-29 17:56   ` Vin Shelton
2006-09-29 20:46     ` Peter Stephenson
2006-09-29 22:10     ` Frank Terbeck

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).