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

PATCH: global_export



I was just writing some more option tests and I discovered a bug with
global_export.  Probably no-one uses this, it's there to allow you to have
a consistent behaviour of flags by unsetting it, because it always annoyed
me that sometimes the effect became global without you asking for it.
Unfortunately it prevents the -g option from working.

% unsetopt globalexport
% fn() { typeset -gx exportme=INSIDE; }
% exportme=OUTSIDE
% fn
% print $exportme
OUTSIDE

Here's the fix.

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.45
diff -u -r1.45 builtin.c
--- Src/builtin.c	2001/04/21 18:49:13	1.45
+++ Src/builtin.c	2001/05/15 09:54:00
@@ -1946,7 +1946,7 @@
     }
 
     if (!(ops['g'] || ops['x'] || ops['m']) || ops['g'] == 2 || *name == 'l' ||
-	!isset(GLOBALEXPORT))
+	(!isset(GLOBALEXPORT) && !ops['g']))
 	on |= PM_LOCAL;
 
     if (on & PM_TIED) {

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



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