From: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list),
Richard Curnow <Richard.Curnow@st.com>
Subject: PATCH: unset path problem
Date: Sun, 20 May 2001 01:42:38 +0100 [thread overview]
Message-ID: <20010520004239.21D13139CF@pwstephenson.fsnet.co.uk> (raw)
In-Reply-To: "Peter Stephenson"'s message of "Sun, 20 May 2001 00:16:36 BST." <20010519231637.16348139CF@pwstephenson.fsnet.co.uk>
Peter Stephenson wrote:
> > Richard Curnow wrote:
> > > If I change MANPATH, I don't see manpath getting changed.
> >
> > You haven't unset that in your .zshenv too, have you?
>
> Maybe the answer is to make sure `createparam' is called for the other
> value if it is also unset?
It does seem to be this simple; it's logical that if they both get unset at
once, but retain their specialness, then they should both be recreated at
once. I've added a couple of tests for this and the bug fixed by Bart, and
some documentation for special tied variables --- was there really none
before, or have I missed it?
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.45
diff -u -r1.45 params.c
--- Src/params.c 2001/05/19 00:31:23 1.45
+++ Src/params.c 2001/05/19 23:36:50
@@ -669,6 +669,12 @@
if (oldpm && (oldpm->level == locallevel || !(flags & PM_LOCAL))) {
if (!(oldpm->flags & PM_UNSET) || (oldpm->flags & PM_SPECIAL)) {
oldpm->flags &= ~PM_UNSET;
+ if ((oldpm->flags & PM_SPECIAL) && oldpm->ename) {
+ Param altpm =
+ (Param) paramtab->getnode(paramtab, oldpm->ename);
+ if (altpm)
+ altpm->flags &= ~PM_UNSET;
+ }
return NULL;
}
if ((oldpm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {
Index: Test/D04parameter.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v
retrieving revision 1.1
diff -u -r1.1 D04parameter.ztst
--- Test/D04parameter.ztst 2001/04/02 12:34:06 1.1
+++ Test/D04parameter.ztst 2001/05/19 23:36:51
@@ -526,3 +526,23 @@
>fixed
>the
>shell
+
+ unset SHLVL
+ (( SHLVL++ ))
+ print $SHLVL
+0:Unsetting and recreation of numerical special parameters
+>1
+
+ unset manpath
+ print $+MANPATH
+ manpath=(/here /there)
+ print $MANPATH
+ unset MANPATH
+ print $+manpath
+ MANPATH=/elsewhere:/somewhere
+ print $manpath
+0:Unsetting and recreation of tied special parameters
+>0
+>/here:/there
+>0
+>/elsewhere /somewhere
Index: Doc/Zsh/params.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.7
diff -u -r1.7 params.yo
--- Doc/Zsh/params.yo 2001/04/22 21:02:33 1.7
+++ Doc/Zsh/params.yo 2001/05/19 23:36:52
@@ -632,7 +632,17 @@
enditem()
texinode(Parameters Used By The Shell)()(Parameters Set By The Shell)(Parameters)
sect(Parameters Used By The Shell)
-The following parameters are used by the shell:
+The following parameters are used by the shell.
+
+In cases where there are two parameters with an upper- and lowercase
+form of the same name, such as tt(path) and tt(PATH), the lowercase form
+is an array and the uppercase form is a scalar with the elements of the
+array joined together by colons. These are similar to tied parameters
+created via `tt(typeset -T)'. The normal use for the colon-separated
+form is for exporting to the environment, while the array form is easier
+to manipulate within the shell. Note that unsetting either of the pair
+will unset the other; they retain their special properties when
+recreated, and recreating one of the pair will recreate the other.
startitem()
vindex(ARGV0)
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk
prev parent reply other threads:[~2001-05-19 23:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20010518133031.E6141@popov.bri.st.com>
2001-05-18 13:24 ` zsh4.0.1-pre4 : backticks fail if SHLVL nonexistant Peter Stephenson
2001-05-18 21:13 ` PATCH: " Bart Schaefer
2001-05-19 23:16 ` Peter Stephenson
2001-05-20 0:42 ` 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=20010520004239.21D13139CF@pwstephenson.fsnet.co.uk \
--to=pws@pwstephenson.fsnet.co.uk \
--cc=Richard.Curnow@st.com \
--cc=zsh-workers@sunsite.auc.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).