zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: 4.0.1: menucomplete quirk leaving extra characters behind
Date: Thu, 14 Jun 2001 10:43:13 +0100	[thread overview]
Message-ID: <Tc0a88d015422f6dcb3@mailsweeper01.cambridgesiliconradio.com> (raw)
In-Reply-To: ""Bart Schaefer""'s message of "Wed, 13 Jun 2001 17:40:48 PDT." <010613174048.ZM27798@candle.brasslantern.com>

"Bart Schaefer" wrote:
> I'd say first let's just try it with readonly being a one-way trip, and
> see where we end up.

This also does the same for autoloadable but not yet loaded parameters; the
problem in that case is usually that turning attributes on or off is
meaningless rather than dangerous, and the typeset code is complicated
enough that anything that allows us to keep different cases together is
good news.

Then $* and $@ are made readonly.  As I reported, you can't set them
directly anyway; as Bart reported, you can only cause mischief by unsetting
them.

Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.29
diff -u -r1.29 builtins.yo
--- Doc/Zsh/builtins.yo	2001/06/08 03:04:41	1.29
+++ Doc/Zsh/builtins.yo	2001/06/14 09:32:23
@@ -1192,7 +1192,9 @@
 The value is em(not) converted when assigned.
 )
 item(tt(-r))(
-The given var(name)s are marked readonly.
+The given var(name)s are marked readonly.  Note that if var(name) is a
+special parameter, the readonly attribute can be turned on, but cannot then
+be turned off.
 )
 item(tt(-t))(
 Tags the named parameters.  Tags have no special meaning to the shell.
Index: Doc/Zsh/params.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.9
diff -u -r1.9 params.yo
--- Doc/Zsh/params.yo	2001/05/29 17:54:39	1.9
+++ Doc/Zsh/params.yo	2001/06/14 09:32:23
@@ -31,9 +31,11 @@
 
 In the parameter lists that follow, the mark `<S>' indicates that the
 parameter is special.
-Special parameters cannot have their type changed, and they stay special even
-if unset.  `<Z>' indicates that the parameter does not exist when the shell
-initializes in tt(sh) or tt(ksh) emulation mode.
+Special parameters cannot have their type changed or their
+readonly attribute turned off, and if a special parameter is unset, then
+later recreated, the special properties will be retained.  `<Z>' indicates
+that the parameter does not exist when the shell initializes in tt(sh) or
+tt(ksh) emulation mode.
 startmenu()
 menu(Array Parameters)
 menu(Positional Parameters)
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.46
diff -u -r1.46 builtin.c
--- Src/builtin.c	2001/05/15 10:02:35	1.46
+++ Src/builtin.c	2001/06/14 09:32:23
@@ -1628,7 +1628,14 @@
 	if ((tc = chflags && chflags != (PM_EFLOAT|PM_FFLOAT)))
 	    usepm = 0;
     }
-    if (tc){
+
+    /*
+     * Extra checks if converting the type of a parameter, or if
+     * trying to remove readonlyness.  It's dangerous doing either
+     * with a special or a parameter which isn't loaded yet (which
+     * may be special when it is loaded; we can't tell yet).
+     */
+    if (tc || ((usepm || newspecial) && (off & pm->flags & PM_READONLY))) {
 	if (pm->flags & PM_SPECIAL) {
 	    zerrnam(cname, "%s: can't change type of a special parameter",
 		    pname, 0);
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.48
diff -u -r1.48 params.c
--- Src/params.c	2001/05/31 09:44:00	1.48
+++ Src/params.c	2001/06/14 09:32:23
@@ -216,8 +216,8 @@
 
 #define IPDEF9F(A,B,C,D) {NULL,A,D|PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT,BR((void *)B),SFN(arrvarsetfn),GFN(arrvargetfn),stdunsetfn,0,NULL,C,NULL,0}
 #define IPDEF9(A,B,C) IPDEF9F(A,B,C,0)
-IPDEF9("*", &pparams, NULL),
-IPDEF9("@", &pparams, NULL),
+IPDEF9F("*", &pparams, NULL, PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT|PM_READONLY),
+IPDEF9F("@", &pparams, NULL, PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT|PM_READONLY),
 {NULL, NULL},
 #define IPDEF10(A,B,C) {NULL,A,PM_ARRAY|PM_SPECIAL,BR(NULL),SFN(C),GFN(B),stdunsetfn,10,NULL,NULL,NULL,0}
 
-- 
Peter Stephenson <pws@csr.com>                  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.
**********************************************************************


      reply	other threads:[~2001-06-14  9:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-12 22:37 Jos Backus
2001-06-13  0:17 ` Bart Schaefer
2001-06-13  0:46   ` Jos Backus
2001-06-13  2:23     ` Bart Schaefer
2001-06-13  6:22       ` Jos Backus
2001-06-13 10:32   ` Oliver Kiddle
2001-06-13 16:27     ` Bart Schaefer
2001-06-13 16:58       ` Peter Stephenson
2001-06-13 17:58         ` Bart Schaefer
2001-06-13 18:48           ` Peter Stephenson
2001-06-14  0:40             ` Bart Schaefer
2001-06-14  9:43               ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Tc0a88d015422f6dcb3@mailsweeper01.cambridgesiliconradio.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).